Skip to content

Commit

Permalink
Merge branch 'main' into update/error-messaging-in-staging
Browse files Browse the repository at this point in the history
* main:
  Move the wait to before hook
  Increasing the timeout
  PS0-1962 -A 20-second wait time has been added to load mock data.
  PRESS0-1962 bug fix
  PRESS0-1962 bug fix
  • Loading branch information
circlecube committed Sep 3, 2024
2 parents c1717e3 + 98af635 commit 68542bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/staging/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ const Staging = ({methods, constants, ...props}) => {
if ( response.hasOwnProperty( 'load_page' ) ) {
window.location.href = response.load_page;
// navigate(response.load_page);
makeNotice( 'redirecting', constants.text.switching, constants.text.switchToProductionNoticeCompleteText, 'success', 8000 );
const notifyMessageText = env === "production" ? constants.text.switchToProductionNoticeCompleteText : constants.text.switchToStagingNoticeCompleteText;
makeNotice( 'redirecting', constants.text.switching, notifyMessageText, 'success', 8000 );
} else if ( response.hasOwnProperty('status') && response.status === 'error' ) {
setError(response.message);
} else {
Expand Down
7 changes: 6 additions & 1 deletion tests/cypress/integration/staging-prod.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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 customCommandTimeout = 60000;

describe( 'Staging Page - Production Environment', function () {
const appClass = '.' + Cypress.env( 'appId' );
Expand All @@ -15,12 +16,16 @@ describe( 'Staging Page - Production Environment', function () {
url: /newfold-staging(\/|%2F)v1(\/|%2F)staging/,
},
stagingInitFixture
);
).as('mock-staging-data');
cy.visit(
'/wp-admin/admin.php?page=' +
Cypress.env( 'pluginId' ) +
'#/staging'
);
cy.wait('@mock-staging-data', { timeout: customCommandTimeout } )
.then( ( interception ) => {
expect( interception.response.statusCode ).to.eq( 200 );
});
} );

it( 'Is Accessible', () => {
Expand Down

0 comments on commit 68542bd

Please sign in to comment.