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(() => {
|
2021-03-09 17:00:14 -05:00
|
|
|
cy.loadConfig()
|
2020-07-16 05:22:53 -04:00
|
|
|
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(() => {
|
|
|
|
cy.intercept('PUT', '/api/v2/history/features', (req) => {
|
|
|
|
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')
|
|
|
|
.should('not.have.class', 'pinned')
|
|
|
|
.click()
|
|
|
|
cy.get('@pin-button')
|
|
|
|
.should('have.class', 'pinned')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Table', () => {
|
|
|
|
cy.get('i.fa-table')
|
|
|
|
.click()
|
|
|
|
cy.get('.history-pin.btn')
|
|
|
|
.first()
|
|
|
|
.as('pin-button')
|
|
|
|
cy.get('@pin-button')
|
|
|
|
.should('not.have.class', 'pinned')
|
|
|
|
.click()
|
|
|
|
cy.get('@pin-button')
|
|
|
|
.should('have.class', 'pinned')
|
|
|
|
})
|
2020-07-16 05:22:53 -04:00
|
|
|
})
|
|
|
|
|
2020-11-30 06:31:54 -05:00
|
|
|
describe('failing', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.intercept('PUT', '/api/v2/history/features', {
|
|
|
|
statusCode: 401
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Cards', () => {
|
|
|
|
cy.get('div.card')
|
|
|
|
.should('be.visible')
|
|
|
|
cy.get('.fa-thumb-tack')
|
|
|
|
.first()
|
|
|
|
.click()
|
|
|
|
cy.get('.modal-dialog')
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Table', () => {
|
|
|
|
cy.get('i.fa-table')
|
|
|
|
.click()
|
|
|
|
cy.get('.fa-thumb-tack')
|
|
|
|
.first()
|
|
|
|
.click()
|
|
|
|
cy.get('.modal-dialog')
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
2020-07-16 05:22:53 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|