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