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
|
|
|
describe('History', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/history')
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('History Mode', () => {
|
|
|
|
it('Cards', () => {
|
|
|
|
cy.get('div.card')
|
2020-08-16 15:54:04 -04:00
|
|
|
.should('be.visible')
|
2020-07-16 05:22:53 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Table', () => {
|
|
|
|
cy.get('i.fa-table')
|
|
|
|
.click()
|
|
|
|
cy.get('table.history-table')
|
2020-08-16 15:54:04 -04:00
|
|
|
.should('be.visible')
|
2020-07-16 05:22:53 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Pinning', () => {
|
2020-11-30 06:31:54 -05:00
|
|
|
describe('working', () => {
|
|
|
|
beforeEach(() => {
|
2021-05-02 16:38:43 -04:00
|
|
|
cy.intercept('PUT', '/mock-backend/api/private/me/history/features', (req) => {
|
2020-11-30 06:31:54 -05:00
|
|
|
req.reply(200, req.body)
|
|
|
|
})
|
2020-11-15 12:00:53 -05:00
|
|
|
})
|
|
|
|
|
2020-11-30 06:31:54 -05:00
|
|
|
it('Cards', () => {
|
|
|
|
cy.get('div.card')
|
|
|
|
.should('be.visible')
|
|
|
|
cy.get('.history-pin.btn')
|
|
|
|
.first()
|
|
|
|
.as('pin-button')
|
|
|
|
cy.get('@pin-button')
|
2021-04-22 16:46:24 -04:00
|
|
|
.should('have.class', 'pinned')
|
2020-11-30 06:31:54 -05:00
|
|
|
.click()
|
|
|
|
cy.get('@pin-button')
|
2021-04-22 16:46:24 -04:00
|
|
|
.should('not.have.class', 'pinned')
|
2020-11-30 06:31:54 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Table', () => {
|
|
|
|
cy.get('i.fa-table')
|
|
|
|
.click()
|
|
|
|
cy.get('.history-pin.btn')
|
|
|
|
.first()
|
|
|
|
.as('pin-button')
|
|
|
|
cy.get('@pin-button')
|
2021-04-22 16:46:24 -04:00
|
|
|
.should('have.class', 'pinned')
|
2020-11-30 06:31:54 -05:00
|
|
|
.click()
|
|
|
|
cy.get('@pin-button')
|
2021-04-22 16:46:24 -04:00
|
|
|
.should('not.have.class', 'pinned')
|
2020-11-30 06:31:54 -05:00
|
|
|
})
|
2020-07-16 05:22:53 -04:00
|
|
|
})
|
|
|
|
|
2020-11-30 06:31:54 -05:00
|
|
|
describe('failing', () => {
|
|
|
|
beforeEach(() => {
|
2021-05-02 16:38:43 -04:00
|
|
|
cy.intercept('PUT', '/mock-backend/api/private/me/history/features', {
|
2020-11-30 06:31:54 -05:00
|
|
|
statusCode: 401
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Cards', () => {
|
|
|
|
cy.get('div.card')
|
|
|
|
.should('be.visible')
|
|
|
|
cy.get('.fa-thumb-tack')
|
|
|
|
.first()
|
|
|
|
.click()
|
2021-04-22 16:46:24 -04:00
|
|
|
cy.get('.notifications-area .toast')
|
2020-11-30 06:31:54 -05:00
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Table', () => {
|
|
|
|
cy.get('i.fa-table')
|
|
|
|
.click()
|
|
|
|
cy.get('.fa-thumb-tack')
|
|
|
|
.first()
|
|
|
|
.click()
|
2021-04-22 16:46:24 -04:00
|
|
|
cy.get('.notifications-area .toast')
|
2020-11-30 06:31:54 -05:00
|
|
|
.should('be.visible')
|
|
|
|
})
|
2020-07-16 05:22:53 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|