Skip to content

Commit

Permalink
Merge pull request #14 from newfold-labs/update/test
Browse files Browse the repository at this point in the history
update before test to not wait on alias for fixture stubbed intercept…
  • Loading branch information
circlecube authored Sep 19, 2023
2 parents 498a019 + 6b3509b commit 5a045d4
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions tests/cypress/integration/staging.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// <reference types="Cypress" />
const stagingInit = require('../fixtures/stagingInit.json');
const stagingClone = require('../fixtures/stagingClone.json');
const stagingDelete = require('../fixtures/stagingDelete.json');
const stagingCreate = require('../fixtures/stagingCreate.json');
const stagingSwitch = require('../fixtures/stagingSwitch.json');
const stagingStaging = require('../fixtures/stagingStaging.json');
const stagingDeploy = require('../fixtures/stagingDeploy.json');
const stagingInitFixture = require('../fixtures/stagingInit.json');
const stagingCloneFixture = require('../fixtures/stagingClone.json');
const stagingDeleteFixture = require('../fixtures/stagingDelete.json');
const stagingCreateFixture = require('../fixtures/stagingCreate.json');
const stagingSwitchFixture = require('../fixtures/stagingSwitch.json');
const stagingStagingFixture = require('../fixtures/stagingStaging.json');
const stagingDeployFixture = require('../fixtures/stagingDeploy.json');

describe('Staging Page', function () {
let appClass = '.' + Cypress.env('appId');
Expand All @@ -14,9 +14,8 @@ describe('Staging Page', function () {
cy.intercept({
method: 'GET',
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging/
}, stagingInit ).as('stagingInit');
}, stagingInitFixture );
cy.visit('/wp-admin/admin.php?page=' + Cypress.env('pluginId') + '#/staging');
cy.wait('@stagingInit');
});

it('Is Accessible', () => {
Expand Down Expand Up @@ -81,7 +80,7 @@ describe('Staging Page', function () {
cy.intercept({
method: 'POST',
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging(\/|%2F)clone/
}, stagingClone ).as('stagingClone');
}, stagingCloneFixture ).as('stagingClone');

cy.get('#staging-clone-button').click();
cy.get('.nfd-modal')
Expand All @@ -102,7 +101,7 @@ describe('Staging Page', function () {
it('Delete Works', () => {
cy.intercept({
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging/
}, stagingDelete ).as('stagingDelete');
}, stagingDeleteFixture ).as('stagingDelete');

cy.get('#staging-delete-button').click();
cy.get('.nfd-modal')
Expand Down Expand Up @@ -142,7 +141,7 @@ describe('Staging Page', function () {
method: 'POST',
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging/
}, {
body: stagingCreate,
body: stagingCreateFixture,
delay: 1000,
}).as('stagingCreate');

Expand Down Expand Up @@ -179,7 +178,7 @@ describe('Staging Page', function () {
method: 'GET',
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging(\/|%2F)switch-to(\&|%26)env(\=|%3D)staging/
}, {
body: stagingSwitch,
body: stagingSwitchFixture,
delay: 500,
}).as('stagingSwitch');

Expand Down Expand Up @@ -231,9 +230,8 @@ describe('Staging Page - Staging environmant', function () {
cy.intercept({
method: 'GET',
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging/
}, stagingStaging ).as('stagingStaging');
}, stagingStagingFixture );
cy.visit('/wp-admin/admin.php?page=' + Cypress.env('pluginId') + '#/staging');
cy.wait('@stagingStaging');
});

it('Displays staging environemnt properly', () => {
Expand Down Expand Up @@ -269,7 +267,7 @@ describe('Staging Page - Staging environmant', function () {
method: 'POST',
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging(\/|%2F)deploy/
}, {
body: stagingDeploy,
body: stagingDeployFixture,
delay: 500,
}).as('stagingDeploy');

Expand Down

0 comments on commit 5a045d4

Please sign in to comment.