mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Merge branch 'api-tests-for-reference' of github.com:nowcommunity/nowdatabase into api-tests-for-reference
This commit is contained in:
@@ -5,7 +5,7 @@ before('Reset database', () => {
|
||||
describe('Broadly test what different user rights see', () => {
|
||||
describe('Admin visibility', () => {
|
||||
beforeEach('Login as admin', () => {
|
||||
cy.session('admin-session', () => {})
|
||||
cy.session('admin-session', () => { })
|
||||
cy.login('testSu')
|
||||
})
|
||||
it('Sees new button in tableviews', () => {
|
||||
@@ -14,28 +14,34 @@ describe('Broadly test what different user rights see', () => {
|
||||
cy.contains('Time Unit')
|
||||
cy.contains('Creating new locality')
|
||||
})
|
||||
it('Region works', () => {
|
||||
it('Regions view shows correctly', () => {
|
||||
cy.get('div[id="/admin-menu-button"]').click()
|
||||
cy.contains('Regions').click()
|
||||
cy.contains('region 4452477e')
|
||||
cy.get('[data-cy="detailview-button-1"]').first().click()
|
||||
cy.contains('Regional Coordinators')
|
||||
cy.contains('prs')
|
||||
cy.get('[id="edit-button"]').should('exist')
|
||||
cy.get('[id="delete-button"]').should('exist')
|
||||
})
|
||||
it('Project works', () => {
|
||||
it('Projects view shows correctly', () => {
|
||||
cy.get('div[id="/admin-menu-button"]').click()
|
||||
cy.get('a[id="/project-menu-link"]').click()
|
||||
cy.contains('Workgroup on Insectivores')
|
||||
cy.get('[data-cy="detailview-button-3"]').first().click()
|
||||
cy.contains('Coordinator')
|
||||
cy.contains('NOW Database')
|
||||
cy.get('[id="edit-button"]').should('exist')
|
||||
cy.get('[id="delete-button"]').should('exist')
|
||||
})
|
||||
it('Time Bound works', () => {
|
||||
it('Time Bound view shows correctly', () => {
|
||||
cy.contains('Time Bounds').click()
|
||||
cy.contains('C2N-y')
|
||||
cy.get('[data-cy="detailview-button-11"]').first().click()
|
||||
cy.contains('Bound')
|
||||
cy.contains('1.778')
|
||||
cy.get('[id="edit-button"]').should('exist')
|
||||
cy.get('[id="delete-button"]').should('exist')
|
||||
})
|
||||
it('Email page opens', () => {
|
||||
cy.get('div[id="/admin-menu-button"]').click()
|
||||
@@ -63,5 +69,33 @@ describe('Broadly test what different user rights see', () => {
|
||||
it('Does not see email page', () => {
|
||||
cy.pageForbidden('/email')
|
||||
})
|
||||
it('Does not see the New button in table view', () => {
|
||||
cy.visit('/locality')
|
||||
cy.contains('New').should('not.exist')
|
||||
cy.visit('/species')
|
||||
cy.contains('New').should('not.exist')
|
||||
cy.visit('/reference')
|
||||
cy.contains('New').should('not.exist')
|
||||
cy.visit('/time-unit')
|
||||
cy.contains('New').should('not.exist')
|
||||
})
|
||||
it('Does not see edit or delete buttons in detailview', () => {
|
||||
cy.visit('locality/20920')
|
||||
cy.contains('Lantian-Shuijiazui')
|
||||
cy.get('[id="edit-button"]').should('not.exist')
|
||||
cy.get('[id="delete-button"]').should('not.exist')
|
||||
cy.visit('species/21052')
|
||||
cy.contains('Simplomys simplicidens')
|
||||
cy.get('[id="edit-button"]').should('not.exist')
|
||||
cy.get('[id="delete-button"]').should('not.exist')
|
||||
cy.visit('reference/10039')
|
||||
cy.contains('A new geomagnetic polarity time scale')
|
||||
cy.get('[id="edit-button"]').should('not.exist')
|
||||
cy.get('[id="delete-button"]').should('not.exist')
|
||||
cy.visit('time-unit/bahean')
|
||||
cy.contains('Bahean')
|
||||
cy.get('[id="edit-button"]').should('not.exist')
|
||||
cy.get('[id="delete-button"]').should('not.exist')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -48,7 +48,9 @@ Any user can get a list of reference types.
|
||||
|
||||
Any user can view the details of a reference.
|
||||
|
||||
References cannot be created, updated or deleted by anyone at the moment.
|
||||
Creating or updating a reference requires the **Admin** or **EditUnrestricted** roles.
|
||||
|
||||
Deleting a reference requires the **Admin** role.
|
||||
|
||||
## Time Unit
|
||||
|
||||
|
||||
@@ -177,7 +177,13 @@ export const DetailView = <T extends object>({
|
||||
</Button>
|
||||
)}
|
||||
{editRights.delete && !isNew && (
|
||||
<Button onClick={onDelete} variant="contained" sx={{ width: '8em', color: 'white' }} color="error">
|
||||
<Button
|
||||
id="delete-button"
|
||||
onClick={onDelete}
|
||||
variant="contained"
|
||||
sx={{ width: '8em', color: 'white' }}
|
||||
color="error"
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user