-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #950 from geonetwork/ME/delete-record
ME: delete a record and its draft, delete a draft without record
- Loading branch information
Showing
46 changed files
with
750 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
describe('delete', () => { | ||
beforeEach(() => { | ||
cy.login('admin', 'admin', false) | ||
cy.visit('/catalog/search') | ||
}) | ||
|
||
describe('record with draft', () => { | ||
it('should delete the record, delete its associated draft 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('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.visit('/catalog/search?_sort=-changeDate') | ||
cy.get('[data-cy="table-row"]') | ||
.contains('My new record') | ||
.should('have.length', 1) | ||
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '1') | ||
// Delete the record | ||
cy.get('[data-test="record-menu-button"]').first().click() | ||
cy.get('[data-test="record-menu-delete-button"]').click() | ||
cy.get('[data-cy="confirm-button"]').click() | ||
cy.get('[data-cy="table-row"]') | ||
.contains('My new record') | ||
.should('have.length', 0) | ||
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '0') | ||
}) | ||
}) | ||
|
||
describe('draft without record', () => { | ||
it('should delete the draft and refresh the interface', () => { | ||
// First create a draft | ||
cy.get('[data-cy="create-record"]').click() | ||
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.visit('/my-space/my-draft') | ||
cy.get('[data-cy="table-row"]') | ||
.contains('My new record') | ||
.should('have.length', 1) | ||
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '1') | ||
// Delete the draft | ||
cy.get('[data-test="record-menu-button"]').click() | ||
cy.get('[data-test="record-menu-delete-button"]').click() | ||
cy.get('[data-cy="confirm-button"]').click() | ||
cy.get('[data-cy="table-row"]') | ||
.contains('New record') | ||
.should('have.length', 0) | ||
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '0') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
apps/metadata-editor/src/app/dashboard/dashboard-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 14 additions & 50 deletions
64
apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.