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