From 46a8938d2670ce2aa00e9954bf83bac2af7d2389 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Fri, 13 Sep 2024 10:50:57 +1000 Subject: [PATCH] tests: Modify Cypress error attribute checks --- cypress/e2e/rbac/developer.cy.ts | 2 +- cypress/e2e/rbac/guest.cy.ts | 4 ++-- cypress/e2e/rbac/organizations/orgViewer.cy.ts | 4 ++-- cypress/e2e/rbac/reporter.cy.ts | 4 ++-- cypress/support/actions/envOverview/EnvOverviewAction.ts | 2 +- cypress/support/actions/organizations/GroupsAction.ts | 2 +- .../support/actions/organizations/NotificationsAction.ts | 2 +- cypress/support/actions/organizations/OverviewAction.ts | 4 ++-- cypress/support/actions/organizations/ProjectsActions.ts | 2 +- cypress/support/actions/project/ProjectAction.ts | 2 +- cypress/support/actions/tasks/TasksAction.ts | 8 ++++---- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cypress/e2e/rbac/developer.cy.ts b/cypress/e2e/rbac/developer.cy.ts index a12fc488..39523a52 100644 --- a/cypress/e2e/rbac/developer.cy.ts +++ b/cypress/e2e/rbac/developer.cy.ts @@ -85,7 +85,7 @@ describe('DEVELOPER permission test suites', () => { cy.wait('@gqladdEnvVariableMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = 'Unauthorized: You don\'t have permission to "project:add" on "env_var": {"project":18}'; + const errorMessage = 'Unauthorized: You don\'t have permission to "project:add" on "env_var"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); diff --git a/cypress/e2e/rbac/guest.cy.ts b/cypress/e2e/rbac/guest.cy.ts index 0bed5fe7..e2d650ba 100644 --- a/cypress/e2e/rbac/guest.cy.ts +++ b/cypress/e2e/rbac/guest.cy.ts @@ -85,7 +85,7 @@ describe('GUEST permission test suites', () => { cy.wait('@gqladdEnvVariableMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = 'Unauthorized: You don\'t have permission to "project:add" on "env_var": {"project":18}'; + const errorMessage = 'Unauthorized: You don\'t have permission to "project:add" on "env_var"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); @@ -182,7 +182,7 @@ describe('GUEST permission test suites', () => { cy.waitForNetworkIdle('@idle', 500); const errMessage = - 'Error: GraphQL error: Unauthorized: You don\'t have permission to "view" on "backup": {"project":18}'; + 'Error: GraphQL error: Unauthorized: You don\'t have permission to "view" on "backup"'; cy.get('main').should('exist').find('p').should('exist').and('have.text', errMessage); }); diff --git a/cypress/e2e/rbac/organizations/orgViewer.cy.ts b/cypress/e2e/rbac/organizations/orgViewer.cy.ts index 704efcab..8fdce9aa 100644 --- a/cypress/e2e/rbac/organizations/orgViewer.cy.ts +++ b/cypress/e2e/rbac/organizations/orgViewer.cy.ts @@ -103,7 +103,7 @@ describe(`Organizations ORGVIEWER journey`, () => { cy.wait('@gqladdProjectToGroupMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = `Unauthorized: You don't have permission to "addGroup" on "organization": {"organization":1}`; + const errorMessage = `Unauthorized: You don't have permission to "addGroup" on "organization"`; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); @@ -121,7 +121,7 @@ describe(`Organizations ORGVIEWER journey`, () => { cy.wait('@gqladdNotificationToProjectMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = `Unauthorized: You don't have permission to "addNotification" on "organization": {"organization":1}`; + const errorMessage = `Unauthorized: You don't have permission to "addNotification" on "organization"`; expect(interception.response?.body).to.have.property('errors'); diff --git a/cypress/e2e/rbac/reporter.cy.ts b/cypress/e2e/rbac/reporter.cy.ts index 4f916a7b..f0070835 100644 --- a/cypress/e2e/rbac/reporter.cy.ts +++ b/cypress/e2e/rbac/reporter.cy.ts @@ -82,7 +82,7 @@ describe('REPORTER permission test suites', () => { cy.wait('@gqladdEnvVariableMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = 'Unauthorized: You don\'t have permission to "project:add" on "env_var": {"project":18}'; + const errorMessage = 'Unauthorized: You don\'t have permission to "project:add" on "env_var"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); @@ -182,7 +182,7 @@ describe('REPORTER permission test suites', () => { cy.waitForNetworkIdle('@idle', 500); const errMessage = - 'Error: GraphQL error: Unauthorized: You don\'t have permission to "view" on "backup": {"project":18}'; + 'Error: GraphQL error: Unauthorized: You don\'t have permission to "view" on "backup"'; cy.get('main').should('exist').find('p').should('exist').and('have.text', errMessage); }); diff --git a/cypress/support/actions/envOverview/EnvOverviewAction.ts b/cypress/support/actions/envOverview/EnvOverviewAction.ts index 4ab8b0c7..da14b335 100644 --- a/cypress/support/actions/envOverview/EnvOverviewAction.ts +++ b/cypress/support/actions/envOverview/EnvOverviewAction.ts @@ -47,7 +47,7 @@ export default class EnvOverviewAction { const errorMessage = `Unauthorized: You don\'t have permission to "delete:${ branch === 'main' ? 'production' : 'development' - }" on "environment": {"project":18}`; + }" on "environment"`; cy.wait('@gqldeleteEnvironmentMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); diff --git a/cypress/support/actions/organizations/GroupsAction.ts b/cypress/support/actions/organizations/GroupsAction.ts index b4ee4c53..034bbb33 100644 --- a/cypress/support/actions/organizations/GroupsAction.ts +++ b/cypress/support/actions/organizations/GroupsAction.ts @@ -31,7 +31,7 @@ export default class GroupAction { cy.wait('@gqladdGroupToOrganizationMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = `Unauthorized: You don't have permission to "addGroup" on "organization": {"organization":1}`; + const errorMessage = `Unauthorized: You don't have permission to "addGroup" on "organization"`; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); diff --git a/cypress/support/actions/organizations/NotificationsAction.ts b/cypress/support/actions/organizations/NotificationsAction.ts index 4ba942e8..a50795f3 100644 --- a/cypress/support/actions/organizations/NotificationsAction.ts +++ b/cypress/support/actions/organizations/NotificationsAction.ts @@ -89,7 +89,7 @@ export default class NotificationsAction { cy.wait(`@gqladdNotification${getMutationName(notifType)}Mutation`).then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = `Unauthorized: You don't have permission to "addNotification" on "organization": {"organization":1}`; + const errorMessage = `Unauthorized: You don't have permission to "addNotification" on "organization"`; expect(interception.response?.body).to.have.property('errors'); diff --git a/cypress/support/actions/organizations/OverviewAction.ts b/cypress/support/actions/organizations/OverviewAction.ts index 0742173c..8283bf5a 100644 --- a/cypress/support/actions/organizations/OverviewAction.ts +++ b/cypress/support/actions/organizations/OverviewAction.ts @@ -60,7 +60,7 @@ export default class OverviewAction { cy.wait('@gqlupdateOrganizationFriendlyNameMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = 'Unauthorized: You don\'t have permission to "updateOrganization" on "organization": 1'; + const errorMessage = 'Unauthorized: You don\'t have permission to "updateOrganization" on "organization"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); @@ -92,7 +92,7 @@ export default class OverviewAction { cy.wait('@gqlupdateOrganizationFriendlyNameMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = 'Unauthorized: You don\'t have permission to "updateOrganization" on "organization": 1'; + const errorMessage = 'Unauthorized: You don\'t have permission to "updateOrganization" on "organization"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); diff --git a/cypress/support/actions/organizations/ProjectsActions.ts b/cypress/support/actions/organizations/ProjectsActions.ts index dae3d962..6d6a67fc 100644 --- a/cypress/support/actions/organizations/ProjectsActions.ts +++ b/cypress/support/actions/organizations/ProjectsActions.ts @@ -37,7 +37,7 @@ export default class ProjectsActions { cy.wait('@gqladdProjectToOrganizationMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = `Unauthorized: You don't have permission to "addProject" on "organization": {"organization":1}`; + const errorMessage = `Unauthorized: You don't have permission to "addProject" on "organization"`; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); diff --git a/cypress/support/actions/project/ProjectAction.ts b/cypress/support/actions/project/ProjectAction.ts index d8c79e9f..69e46c0e 100644 --- a/cypress/support/actions/project/ProjectAction.ts +++ b/cypress/support/actions/project/ProjectAction.ts @@ -58,7 +58,7 @@ export default class ProjectAction { .should('exist') .should( 'include.text', - 'GraphQL error: Unauthorized: You don\'t have permission to "deploy:development" on "environment": {"project":18}' + 'GraphQL error: Unauthorized: You don\'t have permission to "deploy:development" on "environment"' ); } } diff --git a/cypress/support/actions/tasks/TasksAction.ts b/cypress/support/actions/tasks/TasksAction.ts index 78dee92c..07fe65d2 100644 --- a/cypress/support/actions/tasks/TasksAction.ts +++ b/cypress/support/actions/tasks/TasksAction.ts @@ -36,7 +36,7 @@ export default class TasksAction { expect(interception.response?.statusCode).to.eq(200); const errorMessage = - 'Unauthorized: You don\'t have permission to "drushSqlDump:production" on "task": {"project":18}'; + 'Unauthorized: You don\'t have permission to "drushSqlDump:production" on "task"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); @@ -57,7 +57,7 @@ export default class TasksAction { expect(interception.response?.statusCode).to.eq(200); const errorMessage = - 'Unauthorized: You don\'t have permission to "drushArchiveDump:production" on "task": {"project":18}'; + 'Unauthorized: You don\'t have permission to "drushArchiveDump:production" on "task"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); @@ -78,7 +78,7 @@ export default class TasksAction { expect(interception.response?.statusCode).to.eq(200); const errorMessage = - 'Unauthorized: You don\'t have permission to "drushUserLogin:production" on "task": {"project":18}'; + 'Unauthorized: You don\'t have permission to "drushUserLogin:production" on "task"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage }); @@ -106,7 +106,7 @@ export default class TasksAction { cy.wait('@gqlcancelTaskMutation').then(interception => { expect(interception.response?.statusCode).to.eq(200); - const errorMessage = 'Unauthorized: You don\'t have permission to "cancel:production" on "task": {"project":18}'; + const errorMessage = 'Unauthorized: You don\'t have permission to "cancel:production" on "task"'; expect(interception.response?.body).to.have.property('errors'); cy.wrap(interception.response?.body.errors[0]).should('deep.include', { message: errorMessage });