2020-11-22 15:50:07 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-10-10 05:38:32 -04:00
|
|
|
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', () => {
|
2020-11-28 05:51:40 -05:00
|
|
|
cy.get('.modal-dialog')
|
|
|
|
.should('not.exist')
|
2020-10-10 05:38:32 -04:00
|
|
|
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')
|
2020-11-28 05:51:40 -05:00
|
|
|
.should('not.exist')
|
2020-10-10 05:38:32 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('add token', () => {
|
|
|
|
cy.get('.card.access-tokens .btn-primary')
|
|
|
|
.should('be.disabled')
|
|
|
|
cy.get('.card.access-tokens input[type=text]')
|
|
|
|
.type('cypress')
|
2020-11-28 05:51:40 -05:00
|
|
|
cy.get('.modal-dialog')
|
|
|
|
.should('not.exist')
|
2020-10-10 05:38:32 -04:00
|
|
|
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')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|