From 7c5320ebfc2e4ffed5ed0be6feffe43682d70b3b Mon Sep 17 00:00:00 2001 From: John Munster Date: Fri, 1 Dec 2023 16:49:50 +0000 Subject: [PATCH 1/3] feature: creation of all users can access releae notes page --- .../e2e/access-to-release-notes-page.cy.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 cypress/e2e/access-to-release-notes-page.cy.js diff --git a/cypress/e2e/access-to-release-notes-page.cy.js b/cypress/e2e/access-to-release-notes-page.cy.js new file mode 100644 index 00000000..d9e40ee8 --- /dev/null +++ b/cypress/e2e/access-to-release-notes-page.cy.js @@ -0,0 +1,42 @@ +/// + +const userRoles = [ + { + 'userRole': 'admin', + }, + { + 'userRole': 'editor', + }, + { + 'userRole': 'subscriber', + }, + { + 'userRole': 'contributor', + }, + { + 'userRole': 'author', + }, +] + +describe('All users can access the release notes page', () => { + + userRoles.forEach((role) => { + + describe(`${role.userRole} accees`, () => { + beforeEach(() => { + cy.switchUser(role.userRole); + cy.visit('/admin/'); + }) + + it(`should allow ${role.userRole} to see the release notes page`, () => { + cy.get('#toplevel_page_release-notes > .wp-not-current-submenu > .wp-menu-name').contains('Release Notes').should('exist'); + cy.get('#toplevel_page_release-notes > .wp-not-current-submenu > .wp-menu-name').click(); + cy.url().should('eq', Cypress.config().baseUrl + '/wp-admin/admin.php?page=release-notes'); + cy.url().should('contain', 'release-notes'); + }) + }) + + }) + +}) + From f8e6ef94e5a8c69abcce869c65b5911f1e265a5c Mon Sep 17 00:00:00 2001 From: John Munster Date: Mon, 4 Dec 2023 09:30:43 +0000 Subject: [PATCH 2/3] fix: typo fix and changed object of varibles to an array --- .../e2e/access-to-release-notes-page.cy.js | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/cypress/e2e/access-to-release-notes-page.cy.js b/cypress/e2e/access-to-release-notes-page.cy.js index d9e40ee8..a73ac85b 100644 --- a/cypress/e2e/access-to-release-notes-page.cy.js +++ b/cypress/e2e/access-to-release-notes-page.cy.js @@ -1,30 +1,20 @@ /// const userRoles = [ - { - 'userRole': 'admin', - }, - { - 'userRole': 'editor', - }, - { - 'userRole': 'subscriber', - }, - { - 'userRole': 'contributor', - }, - { - 'userRole': 'author', - }, + 'admin', + 'editor', + 'subscriber', + 'contributor', + 'author', ] describe('All users can access the release notes page', () => { userRoles.forEach((role) => { - describe(`${role.userRole} accees`, () => { + describe(`${role} access`, () => { beforeEach(() => { - cy.switchUser(role.userRole); + cy.switchUser(role); cy.visit('/admin/'); }) From 3192f1ef7f0ed6be05c70ea1c70eed61287911ba Mon Sep 17 00:00:00 2001 From: John Munster <56341207+johnmunster@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:03:27 +0000 Subject: [PATCH 3/3] Update cypress/e2e/access-to-release-notes-page.cy.js Co-authored-by: Gareth Elwell <41474928+g-elwell@users.noreply.github.com> --- cypress/e2e/access-to-release-notes-page.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/access-to-release-notes-page.cy.js b/cypress/e2e/access-to-release-notes-page.cy.js index a73ac85b..02523849 100644 --- a/cypress/e2e/access-to-release-notes-page.cy.js +++ b/cypress/e2e/access-to-release-notes-page.cy.js @@ -18,7 +18,7 @@ describe('All users can access the release notes page', () => { cy.visit('/admin/'); }) - it(`should allow ${role.userRole} to see the release notes page`, () => { + it(`should allow ${role} to see the release notes page`, () => { cy.get('#toplevel_page_release-notes > .wp-not-current-submenu > .wp-menu-name').contains('Release Notes').should('exist'); cy.get('#toplevel_page_release-notes > .wp-not-current-submenu > .wp-menu-name').click(); cy.url().should('eq', Cypress.config().baseUrl + '/wp-admin/admin.php?page=release-notes');