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