2021-10-09 13:09:29 -04:00
|
|
|
/*
|
2022-06-08 07:19:51 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
2021-10-09 13:09:29 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-10-24 02:57:42 -04:00
|
|
|
import { MOTD_LOCAL_STORAGE_KEY } from '../../src/components/global-dialogs/motd-modal/local-storage-keys'
|
|
|
|
|
2023-10-13 15:22:21 -04:00
|
|
|
const motdMockHtml = 'This is the test motd text'
|
2021-10-09 13:09:29 -04:00
|
|
|
|
|
|
|
describe('Motd', () => {
|
2022-10-01 12:06:31 -04:00
|
|
|
it("shows, dismisses and won't show again a motd modal", () => {
|
2023-10-24 02:57:42 -04:00
|
|
|
window.localStorage.removeItem(MOTD_LOCAL_STORAGE_KEY)
|
2021-10-09 13:09:29 -04:00
|
|
|
|
2023-03-16 03:20:16 -04:00
|
|
|
cy.visitHistory()
|
2023-10-13 15:22:21 -04:00
|
|
|
cy.getSimpleRendererBody().should('contain.text', motdMockHtml)
|
2021-12-31 03:30:12 -05:00
|
|
|
cy.getByCypressId('motd-dismiss')
|
|
|
|
.click()
|
|
|
|
.then(() => {
|
2023-10-24 02:57:42 -04:00
|
|
|
expect(window.localStorage.getItem(MOTD_LOCAL_STORAGE_KEY)).not.to.be.eq(null)
|
2021-12-31 03:30:12 -05:00
|
|
|
})
|
2022-10-01 12:06:31 -04:00
|
|
|
cy.getByCypressId('motd-modal').should('not.exist')
|
2021-10-09 13:09:29 -04:00
|
|
|
cy.reload()
|
|
|
|
cy.get('main').should('exist')
|
2022-10-01 12:06:31 -04:00
|
|
|
cy.getByCypressId('motd-modal').should('not.exist')
|
2021-10-09 13:09:29 -04:00
|
|
|
})
|
|
|
|
})
|