-
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.
Feat(annotation): Add support for annotations on graphs and subresources
- Loading branch information
1 parent
5323755
commit 81f7e2e
Showing
15 changed files
with
427 additions
and
175 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 |
---|---|---|
|
@@ -34,72 +34,147 @@ describe('Annotation', () => { | |
datasetImportPage.goToPublishedResources(); | ||
}); | ||
|
||
describe('createAnnotation', () => { | ||
it('should create an annotation on resource field', () => { | ||
cy.findByText('Search').click(); | ||
searchDrawer.search('Terminator 2'); | ||
searchDrawer.waitForLoading(); | ||
cy.findAllByText('Terminator 2').eq(1).click(); | ||
describe('homepage', () => { | ||
it('should support annotations on home page', () => { | ||
annotation.createAnnotation({ | ||
fieldLabel: 'actors', | ||
fieldLabel: 'Dataset Description', | ||
comment: 'This is a comment', | ||
authorName: 'John Doe', | ||
authorEmail: '[email protected]', | ||
}); | ||
|
||
cy.findByText('Search').click(); | ||
searchDrawer.search('RoboCop'); | ||
searchDrawer.waitForLoading(); | ||
cy.findAllByText('RoboCop').eq(0).click(); | ||
annotation.createAnnotation({ | ||
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('columnheader').then((headers) => { | ||
cy.findAllByRole('cell').then((cells) => { | ||
expect( | ||
headers.toArray().map((header) => header.textContent), | ||
cells.toArray().map((cell) => cell.textContent), | ||
).to.deep.equal([ | ||
'Resource URI', | ||
'Resource title', | ||
'Field label', | ||
'Field Id', | ||
'Field Icons', | ||
'Field Internal Name', | ||
'Contributor', | ||
'Comment', | ||
'Submission date', | ||
'Home page', | ||
'', | ||
'Dataset Description', | ||
'[Doay]', | ||
'', | ||
'n/a', | ||
'John Doe', | ||
'This is a comment', | ||
new Date().toLocaleDateString(), | ||
]); | ||
}); | ||
}); | ||
}); | ||
|
||
cy.findAllByRole('cell').then((cells) => { | ||
const firstUri = cells[0].textContent; | ||
const secondUri = cells[9].textContent; | ||
describe('resources', () => { | ||
describe('createAnnotation', () => { | ||
it('should create an annotation on resource field', () => { | ||
cy.findByText('Search').click(); | ||
searchDrawer.search('Terminator 2'); | ||
searchDrawer.waitForLoading(); | ||
cy.findAllByText('Terminator 2').eq(1).click(); | ||
annotation.createAnnotation({ | ||
fieldLabel: 'actors', | ||
comment: 'This is a comment', | ||
authorName: 'John Doe', | ||
authorEmail: '[email protected]', | ||
}); | ||
|
||
cy.findByText('Search').click(); | ||
searchDrawer.search('RoboCop'); | ||
searchDrawer.waitForLoading(); | ||
cy.findAllByText('RoboCop').eq(0).click(); | ||
annotation.createAnnotation({ | ||
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('columnheader').then((headers) => { | ||
expect( | ||
headers.toArray().map((header) => header.textContent), | ||
).to.deep.equal([ | ||
'Resource URI', | ||
'Resource title', | ||
'Field label', | ||
'Field Id', | ||
'Field Icons', | ||
'Field Internal Name', | ||
'Contributor', | ||
'Comment', | ||
'Submission date', | ||
]); | ||
}); | ||
|
||
cy.findAllByRole('cell').then((cells) => { | ||
const firstUri = cells[0].textContent; | ||
const secondUri = cells[9].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+]', | ||
'', | ||
'n/a', | ||
'Jane Smith', | ||
'This is another comment', | ||
new Date().toLocaleDateString(), | ||
secondUri, | ||
'Terminator 2', | ||
'actors', | ||
'[K8Lu]', | ||
'', | ||
'n/a', | ||
'John Doe', | ||
'This is a comment', | ||
new Date().toLocaleDateString(), | ||
]); | ||
}); | ||
}); | ||
|
||
expect(firstUri).to.match(/uid:\//); | ||
expect(secondUri).to.match(/uid:\//); | ||
it('should hide annotation button when field does not support annotations', () => { | ||
cy.findByRole('button', { | ||
name: `Add an annotation to Liste des films field`, | ||
}).should('not.exist'); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('charts', () => { | ||
it('should support annotations on charts', () => { | ||
cy.findByRole('link', { name: 'Graphs' }).click(); | ||
cy.findByRole('link', { | ||
name: 'Répartition par réalisateurs uniques', | ||
}).click(); | ||
|
||
annotation.createAnnotation({ | ||
fieldLabel: 'Répartition par réalisateurs uniques', | ||
comment: 'This is a comment', | ||
authorName: 'John Doe', | ||
authorEmail: '[email protected]', | ||
}); | ||
|
||
cy.findByText('More').click(); | ||
menu.goToAdminDashboard(); | ||
cy.findByText('Annotations').click(); | ||
|
||
cy.findAllByRole('cell').then((cells) => { | ||
expect( | ||
cells.toArray().map((cell) => cell.textContent), | ||
).to.deep.equal([ | ||
firstUri, | ||
'RoboCop', | ||
'rating', | ||
'[bZE+]', | ||
'Chart page', | ||
'', | ||
'n/a', | ||
'Jane Smith', | ||
'This is another comment', | ||
new Date().toLocaleDateString(), | ||
secondUri, | ||
'Terminator 2', | ||
'actors', | ||
'[K8Lu]', | ||
'Répartition par réalisateurs uniques', | ||
'[xkoP]', | ||
'', | ||
'n/a', | ||
'John Doe', | ||
|
@@ -108,11 +183,5 @@ describe('Annotation', () => { | |
]); | ||
}); | ||
}); | ||
|
||
it('should hide annotation button when field does not support annotations', () => { | ||
cy.findByRole('button', { | ||
name: `Add an annotation to Liste des films field`, | ||
}).should('not.exist'); | ||
}); | ||
}); | ||
}); |
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.