Skip to content

Commit 9ef3ba2

Browse files
committed
update tests for read access
1 parent e70e1c4 commit 9ef3ba2

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

cypress/e2e/new-roles.cy.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const USER_WITHOUT_ACCESS_CREDENTIALS = {
1313
password: 'Password1234',
1414
}
1515

16-
describe('wip test refactor', () => {
16+
describe('Roles', () => {
1717
// TODO: refactor as Cypress command
1818
const loginUser = ({ email, password }) => {
1919
cy.visit(`${adminUrl}`)
@@ -24,7 +24,14 @@ describe('wip test refactor', () => {
2424
cy.get('button[type="submit"]').click()
2525
}
2626

27-
describe('admin user without plugin access', () => {
27+
// TODO: refactor as Cypress command
28+
const visitPluginPage = () => {
29+
cy.visit(`${adminUrl}/plugins/meilisearch`)
30+
cy.contains('Collections').should('be.visible')
31+
cy.contains('Settings').should('be.visible')
32+
}
33+
34+
describe('User without plugin access', () => {
2835
beforeEach(() => {
2936
cy.session(
3037
USER_WITHOUT_ACCESS_CREDENTIALS.email,
@@ -56,7 +63,7 @@ describe('wip test refactor', () => {
5663
})
5764
})
5865

59-
describe('admin user with plugin access', () => {
66+
describe('User with `read` access', () => {
6067
beforeEach(() => {
6168
cy.session(
6269
USER_WITH_ACCESS_CREDENTIALS.email,
@@ -75,7 +82,7 @@ describe('wip test refactor', () => {
7582
)
7683
})
7784

78-
it.only('can access the plugin page', () => {
85+
it('can access the plugin page', () => {
7986
cy.visit(`${adminUrl}`)
8087
cy.get('nav')
8188
.get('a[aria-label="Meilisearch"]', { timeout: 10000 })
@@ -86,5 +93,15 @@ describe('wip test refactor', () => {
8693

8794
cy.url().should('eq', `${adminUrl}/plugins/meilisearch`)
8895
})
96+
97+
it('cannot create an index', () => {
98+
visitPluginPage()
99+
cy.root().should('not.contain', 'button[role="checkbox"]')
100+
})
101+
102+
it.only('cannot change settings', () => {
103+
visitPluginPage()
104+
cy.root().should('not.contain', 'button:contains("Save")')
105+
})
89106
})
90107
})

0 commit comments

Comments
 (0)