Skip to content

Commit

Permalink
Merge pull request #225 from uselagoon/test-network-idle-handlers
Browse files Browse the repository at this point in the history
add idle handlers
  • Loading branch information
DaveDarsa authored Mar 1, 2024
2 parents 33fb8ad + 4d56d4c commit 6f86991
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions cypress/e2e/general/variables.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Project variables page', () => {
it('Adds or updates a variable', () => {
const { name, value } = testData.variables[0];

cy.waitForNetworkIdle('@idle', 500);
environment.doAddVariable(name, value);

cy.intercept('POST', Cypress.env('api')).as('addRequest');
Expand Down
3 changes: 3 additions & 0 deletions cypress/e2e/rbac/developer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ describe('DEVELOPER permission test suites', () => {
cy.intercept('POST', Cypress.env('api'), req => {
aliasMutation(req, 'addEnvVariable');
});
registerIdleHandler('idle');

const { name, value } = testData.variables[0];

cy.waitForNetworkIdle('@idle', 500);

variable.doAddVariable(name, value);

cy.wait('@gqladdEnvVariableMutation').then(interception => {
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/rbac/guest.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ describe('GUEST permission test suites', () => {
it('Fails to add a variable - no permission for GUEST', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/project-variables`);

registerIdleHandler('idle');

cy.intercept('POST', Cypress.env('api'), req => {
aliasMutation(req, 'addEnvVariable');
});

const { name, value } = testData.variables[0];

cy.waitForNetworkIdle('@idle', 500);

variable.doAddVariable(name, value);

cy.wait('@gqladdEnvVariableMutation').then(interception => {
Expand Down
3 changes: 3 additions & 0 deletions cypress/e2e/rbac/maintainer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ describe('MAINTAINER permission test suites', () => {
});
it('Adds or updates a variable', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/project-variables`);
registerIdleHandler('idle');

cy.intercept('POST', Cypress.env('api'), req => {
aliasMutation(req, 'addEnvVariable');
});

const { name, value } = testData.variables[0];

cy.waitForNetworkIdle('@idle', 500);

variable.doAddVariable(name, value);

cy.wait('@gqladdEnvVariableMutation');
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/rbac/reporter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,16 @@ describe('REPORTER permission test suites', () => {
it('Fails to add a variable - no permission for REPORTER', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/project-variables`);

registerIdleHandler('idle');

cy.intercept('POST', Cypress.env('api'), req => {
aliasMutation(req, 'addEnvVariable');
});

const { name, value } = testData.variables[0];

cy.waitForNetworkIdle('@idle', 500);

variable.doAddVariable(name, value);

cy.wait('@gqladdEnvVariableMutation').then(interception => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/actions/deployment/DeploymentAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const deployment = new DeploymentRepository();

export default class deploymentAction {
doCancelDeployment() {
deployment.getCancelDeploymentBtn().click();
deployment.getCancelDeploymentBtn().first().click();

cy.wait('@gqlcancelDeploymentMutation');

Expand Down
4 changes: 4 additions & 0 deletions cypress/support/actions/organizations/OverviewAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export default class OverviewAction {

cy.wait('@gqlupdateOrganizationFriendlyNameMutation');

cy.waitForNetworkIdle('@idle', 500);

overviewRepo
.getfriendlyName()
.invoke('text')
Expand Down Expand Up @@ -71,6 +73,8 @@ export default class OverviewAction {

cy.wait('@gqlupdateOrganizationFriendlyNameMutation');

cy.waitForNetworkIdle('@idle', 500);

overviewRepo
.getDescription()
.invoke('text')
Expand Down

0 comments on commit 6f86991

Please sign in to comment.