hedgedoc/cypress/integration/profile.spec.ts
renovate[bot] a7aae1ae4a
Update dependency cypress to v6 (#798)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2020-11-28 11:51:40 +01:00

71 lines
1.7 KiB
TypeScript

/*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
describe('profile page', () => {
beforeEach(() => {
cy.route({
url: '/api/v2/tokens',
method: 'GET',
response: [
{
label: "cypress-App",
created: 1601991518
}
]
})
cy.route({
url: '/api/v2/tokens',
method: 'POST',
response: {
label: 'cypress',
secret: 'c-y-p-r-e-s-s',
created: Date.now()
}
})
cy.route({
url: '/api/v2/tokens/1601991518',
method: 'DELETE',
response: []
})
cy.visit('/profile')
})
describe('access tokens', () => {
it('list existing tokens', () => {
cy.get('.card.access-tokens .list-group-item .text-start.col')
.contains('cypress-App')
})
it('delete token', () => {
cy.get('.modal-dialog')
.should('not.exist')
cy.get('.card.access-tokens .list-group-item .btn-danger')
.click()
cy.get('.modal-dialog')
.should('be.visible')
.get('.modal-footer .btn-danger')
.click()
cy.get('.modal-dialog')
.should('not.exist')
})
it('add token', () => {
cy.get('.card.access-tokens .btn-primary')
.should('be.disabled')
cy.get('.card.access-tokens input[type=text]')
.type('cypress')
cy.get('.modal-dialog')
.should('not.exist')
cy.get('.card.access-tokens .btn-primary')
.should('not.be.disabled')
.click()
cy.get('.modal-dialog')
.should('be.visible')
.get('.modal-dialog input[readonly]')
.should('have.value', 'c-y-p-r-e-s-s')
})
})
})