mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Add simple tests to check frontend email user rights #no-deploy
This commit is contained in:
@@ -33,6 +33,5 @@ describe('Open each page, table view and detail view, and check at least some co
|
||||
cy.get('[data-cy="detailview-button-langhian"]').first().click()
|
||||
cy.contains('Sequence')
|
||||
cy.contains('gcss')
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
@@ -35,6 +35,11 @@ describe('Broadly test what different user rights see', () => {
|
||||
cy.contains('Bound')
|
||||
cy.contains('1.778')
|
||||
})
|
||||
it('Email page opens', () => {
|
||||
cy.get('div[id="/admin-menu-button"]').click()
|
||||
cy.contains('Email').click()
|
||||
cy.contains('Send email')
|
||||
})
|
||||
})
|
||||
describe('Test unlogged visibility', () => {
|
||||
beforeEach('Ensure logout', () => {
|
||||
@@ -53,5 +58,8 @@ describe('Broadly test what different user rights see', () => {
|
||||
cy.pageForbidden('/time-bound')
|
||||
cy.pageForbidden('/project')
|
||||
})
|
||||
it('Does not see email page', () => {
|
||||
cy.pageForbidden('/email')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -10,7 +10,7 @@ export const EmailPage = () => {
|
||||
const [message, setMessage] = useState('')
|
||||
const [recipients, setRecipients] = useState<string>('')
|
||||
const [sendEmailMutation, { isSuccess, isLoading, isError }] = useEmailMutation()
|
||||
if (user.role !== Role.Admin) return <Box>This page is visible only to admins</Box>
|
||||
if (user.role !== Role.Admin) return <Box>Your user is not authorized to view this page.</Box>
|
||||
|
||||
const parseRecipients = () => {
|
||||
return recipients.replace(' ', '').replace('\n', ',').replace(',', '\n').split(';')
|
||||
|
||||
Reference in New Issue
Block a user