Skip to content

Commit

Permalink
e2e(editor): undo
Browse files Browse the repository at this point in the history
  • Loading branch information
LHBruneton-C2C committed Aug 23, 2024
1 parent 5e27dc1 commit 72b087c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions apps/metadata-editor-e2e/src/e2e/undo.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
describe('undo', () => {
beforeEach(() => {
cy.login('admin', 'admin', false)
cy.visit('/catalog/search')
})

it('should restore the record and refresh the interface', () => {
// First create a record and its draft
cy.get('[data-cy="create-record"]').click()
cy.get('gn-ui-form-field[ng-reflect-model=abstract] textarea').type(
'record abstract'
)
cy.intercept({
method: 'PUT',
pathname: '**/records',
}).as('insertRecord')
cy.get('md-editor-publish-button').click()
cy.wait('@insertRecord')
cy.get('[data-cy="undo-button"]').should('be.disabled')
cy.get('gn-ui-form-field[ng-reflect-model=abstract] textarea').type(
'draft abstract'
)
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000) // waiting for draft saving to kick in
cy.get('[data-cy="undo-button"]').click()
cy.get('[data-cy="confirm-button"]').click()
cy.get('gn-ui-form-field[ng-reflect-model=abstract] textarea').should(
'contain',
'record abstract'
)
})
})

0 comments on commit 72b087c

Please sign in to comment.