-
Notifications
You must be signed in to change notification settings - Fork 14
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 #2491 from Inist-CNRS/feat/2330-delete-annotation
Feat(annotation): Improve annotation detail layout and add support for deletion
- Loading branch information
Showing
36 changed files
with
2,036 additions
and
767 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
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 |
---|---|---|
|
@@ -113,7 +113,7 @@ describe('Annotation', () => { | |
'Internal Comment', | ||
'Administrator', | ||
'Contributor', | ||
'Comment', | ||
'Contributor Comment', | ||
'Submission date', | ||
'Last modified on', | ||
]); | ||
|
@@ -162,33 +162,51 @@ describe('Annotation', () => { | |
|
||
cy.findByText('RoboCop').click(); | ||
|
||
cy.findByText('Annotation: RoboCop').should('be.visible'); | ||
cy.findByRole('heading', { | ||
name: /^Annotation: uid:\//, | ||
}).should('be.visible'); | ||
cy.findByRole('heading', { | ||
name: 'RoboCop', | ||
}).should('be.visible'); | ||
|
||
cy.findByLabelText('Field Id').should('have.text', '[bZE+]'); | ||
cy.findByLabelText('Field label').should('have.text', 'rating'); | ||
cy.findByLabelText('Field Internal Name').should( | ||
cy.findByRole('region', { name: 'Contributor Comment' }).should( | ||
'have.text', | ||
'', | ||
'Contributor CommentThis is another comment', | ||
); | ||
|
||
cy.findByLabelText('Contributor Comment:').should( | ||
cy.findByRole('region', { | ||
name: 'Contributor', | ||
exact: true, | ||
}).should( | ||
'have.text', | ||
'This is another comment', | ||
'ContributorJane [email protected]', | ||
); | ||
|
||
cy.findByLabelText('Name').should('have.text', 'Jane Smith'); | ||
cy.findByRole('region', { | ||
name: 'Contributor', | ||
exact: true, | ||
}).then((region) => { | ||
cy.findByRole('link', { | ||
name: '[email protected]', | ||
container: region, | ||
}).should( | ||
'have.attr', | ||
'href', | ||
'mailto:[email protected]', | ||
); | ||
}); | ||
|
||
cy.findByLabelText('Email').should( | ||
cy.findByLabelText('Submission date').should( | ||
'have.text', | ||
'[email protected]', | ||
new Date().toLocaleDateString(), | ||
); | ||
|
||
cy.findByLabelText('Submission date').should( | ||
cy.findByLabelText('Last modified on').should( | ||
'have.text', | ||
new Date().toLocaleDateString(), | ||
); | ||
|
||
cy.findByLabelText('Status').should('have.text', 'To Review'); | ||
cy.findByLabelText('Status').should('have.text', 'To Review'); | ||
cy.findByLabelText('Status').click(); | ||
cy.findByText('Validated').click(); | ||
cy.findByLabelText('Internal Comment *').type('Return applied'); | ||
|
@@ -198,7 +216,9 @@ describe('Annotation', () => { | |
'exist', | ||
); | ||
|
||
cy.findByText('Annotations').click(); | ||
cy.findByRole('link', { | ||
name: 'Cancel', | ||
}).click(); | ||
|
||
cy.wait(1000); | ||
cy.findByRole('progressbar').should('not.exist'); | ||
|
@@ -250,6 +270,123 @@ describe('Annotation', () => { | |
name: `Add an annotation to Liste des films`, | ||
}).should('not.exist'); | ||
}); | ||
|
||
it('should delete an annotation on resource field', () => { | ||
cy.findByText('Search').click(); | ||
searchDrawer.search('Terminator 2'); | ||
searchDrawer.waitForLoading(); | ||
cy.findByTitle('Terminator 2').click(); | ||
annotation.createTitleAnnotation({ | ||
fieldLabel: 'actors', | ||
comment: 'This is a comment', | ||
authorName: 'John Doe', | ||
authorEmail: '[email protected]', | ||
}); | ||
|
||
cy.findByText('Search').click(); | ||
searchDrawer.search('RoboCop'); | ||
searchDrawer.waitForLoading(); | ||
cy.findByTitle('RoboCop').click(); | ||
annotation.createTitleAnnotation({ | ||
fieldLabel: 'rating', | ||
comment: 'This is another comment', | ||
authorName: 'Jane Smith', | ||
authorEmail: '[email protected]', | ||
}); | ||
cy.findByText('More').click(); | ||
menu.goToAdminDashboard(); | ||
cy.findByText('Annotations').click(); | ||
|
||
cy.findAllByRole('cell').then((cells) => { | ||
const firstUri = cells[0].textContent; | ||
const secondUri = cells[14].textContent; | ||
|
||
expect(firstUri).to.match(/uid:\//); | ||
expect(secondUri).to.match(/uid:\//); | ||
|
||
expect( | ||
cells.toArray().map((cell) => cell.textContent), | ||
).to.deep.equal([ | ||
firstUri, | ||
'RoboCop', | ||
'rating', | ||
'[bZE+]', | ||
'', | ||
'', | ||
'', | ||
'To Review', | ||
'', | ||
'', | ||
'Jane Smith', | ||
'This is another comment', | ||
new Date().toLocaleDateString(), | ||
new Date().toLocaleDateString(), | ||
secondUri, | ||
'Terminator 2', | ||
'actors', | ||
'[K8Lu]', | ||
'', | ||
'', | ||
'', | ||
'To Review', | ||
'', | ||
'', | ||
'John Doe', | ||
'This is a comment', | ||
new Date().toLocaleDateString(), | ||
new Date().toLocaleDateString(), | ||
]); | ||
}); | ||
|
||
cy.findByText('Terminator 2').click(); | ||
|
||
cy.findByRole('heading', { | ||
name: /^Annotation: uid:\//, | ||
}).should('be.visible'); | ||
cy.findByRole('heading', { | ||
name: 'Terminator 2', | ||
}).should('be.visible'); | ||
|
||
cy.findByRole('button', { | ||
name: 'Delete the annotation', | ||
}).click(); | ||
|
||
cy.findByRole('button', { | ||
name: 'Delete', | ||
}).click(); | ||
|
||
cy.findByRole('alert', {}).should( | ||
'have.text', | ||
'The annotation has been deleted.', | ||
); | ||
|
||
cy.wait(500); | ||
|
||
cy.findAllByRole('cell').then((cells) => { | ||
const firstUri = cells[0].textContent; | ||
|
||
expect(firstUri).to.match(/uid:\//); | ||
|
||
expect( | ||
cells.toArray().map((cell) => cell.textContent), | ||
).to.deep.equal([ | ||
firstUri, | ||
'RoboCop', | ||
'rating', | ||
'[bZE+]', | ||
'', | ||
'', | ||
'', | ||
'To Review', | ||
'', | ||
'', | ||
'Jane Smith', | ||
'This is another comment', | ||
new Date().toLocaleDateString(), | ||
new Date().toLocaleDateString(), | ||
]); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
|
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.