2020-11-22 20:50:07 +00:00
|
|
|
/*
|
2022-06-08 11:19:51 +00:00
|
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-07-16 09:22:53 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
2021-02-08 14:03:11 +00:00
|
|
|
describe('Intro page', () => {
|
2020-07-16 09:22:53 +00:00
|
|
|
beforeEach(() => {
|
2022-09-16 09:03:29 +00:00
|
|
|
cy.intercept('public/intro.md', 'test content')
|
2022-01-30 20:46:43 +00:00
|
|
|
cy.visitHome()
|
2020-07-16 09:22:53 +00:00
|
|
|
})
|
|
|
|
|
2021-05-03 19:56:44 +00:00
|
|
|
describe('customizable content', () => {
|
2021-02-08 14:03:11 +00:00
|
|
|
it('fetches and shows the correct intro page content', () => {
|
2021-11-21 11:48:30 +00:00
|
|
|
cy.getIntroBody().contains('test content')
|
2020-07-16 09:22:53 +00:00
|
|
|
})
|
2021-05-03 19:56:44 +00:00
|
|
|
|
2021-11-19 17:04:04 +00:00
|
|
|
it("won't show anything if no content was found", () => {
|
2022-09-16 09:03:29 +00:00
|
|
|
cy.intercept('public/intro.md', {
|
2021-05-03 19:56:44 +00:00
|
|
|
statusCode: 404
|
|
|
|
})
|
2022-01-30 20:46:43 +00:00
|
|
|
cy.visitHome()
|
2021-05-03 19:56:44 +00:00
|
|
|
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('documentIframe').should('not.exist')
|
2021-05-03 19:56:44 +00:00
|
|
|
})
|
2021-02-08 14:03:11 +00:00
|
|
|
})
|
2020-07-16 09:22:53 +00:00
|
|
|
|
2021-02-08 14:03:11 +00:00
|
|
|
describe('features button', () => {
|
|
|
|
it('is hidden when logged in', () => {
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('features-button').should('not.exist')
|
2020-07-16 09:22:53 +00:00
|
|
|
})
|
|
|
|
|
2021-02-08 14:03:11 +00:00
|
|
|
it('is visible when logged out', () => {
|
2020-07-16 09:22:53 +00:00
|
|
|
cy.logout()
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('features-button').should('exist')
|
2020-07-16 09:22:53 +00:00
|
|
|
})
|
2021-02-08 14:03:11 +00:00
|
|
|
})
|
2020-07-16 09:22:53 +00:00
|
|
|
|
2021-02-08 14:03:11 +00:00
|
|
|
describe('sign in button', () => {
|
|
|
|
it('is hidden when logged in', () => {
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('sign-in-button').should('not.exist')
|
2020-07-16 09:22:53 +00:00
|
|
|
})
|
|
|
|
|
2021-02-08 14:03:11 +00:00
|
|
|
it('is visible when logged out', () => {
|
|
|
|
cy.logout()
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('sign-in-button').should('exist')
|
2020-07-16 09:22:53 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-02-08 14:03:11 +00:00
|
|
|
describe('version dialog', () => {
|
|
|
|
it('can be opened and closed', () => {
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('version-modal').should('not.exist')
|
|
|
|
cy.getByCypressId('show-version-modal').click()
|
|
|
|
cy.getByCypressId('version-modal').should('be.visible')
|
2022-10-16 09:20:34 +00:00
|
|
|
cy.getByCypressId('version-modal').find('.modal-header .btn-close').click()
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('version-modal').should('not.exist')
|
2021-02-08 14:03:11 +00:00
|
|
|
})
|
2020-07-16 09:22:53 +00:00
|
|
|
})
|
|
|
|
})
|