mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 08:34:54 -04:00
Add access token management to profile (#653)
* Add mock-files, API calls and overall tokens-UI * Added ability to add tokens * Added token deletion feature (based on timestamp) * Replace mock-method by real API code * Add cypress tests * Added CHANGELOG information * Un-access-ify i18n * Set unique react-element key to timestamp of token-creation * Remove 'now' from changelog * Use @mrdrogdrog's suggestion for the info label
This commit is contained in:
parent
f72380edd1
commit
053edb9ace
9 changed files with 302 additions and 4 deletions
61
cypress/integration/profile.spec.ts
Normal file
61
cypress/integration/profile.spec.ts
Normal file
|
@ -0,0 +1,61 @@
|
|||
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('.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.be.visible')
|
||||
})
|
||||
|
||||
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('.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')
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue