Skip to content

Commit

Permalink
Merge branch 'main' into release/3.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
wpscholar committed Feb 23, 2024
2 parents 0f3d51e + a62af0d commit c216e74
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,26 @@ Cypress.Commands.add( 'logout', () => {
Cypress.Commands.add(
'setPermalinkStructure',
( structure = '/%postname%/' ) => {
cy.exec( `npx wp-env run cli wp rewrite structure "${ structure }"` );
cy.request({
method: 'GET',
url: '/wp-json/',
failOnStatusCode: false,
}).then(result => {
if(result.isOkStatusCode) {
return;
}
const permalinkWpCliCommand = `wp rewrite structure "${structure}" --hard;`;
const permalinkWpEnvCommand = `npx wp-env run cli ${permalinkWpCliCommand}`;
const permalinkWpEnvTestCommand = `npx wp-env run tests-cli ${permalinkWpCliCommand}`;
cy.exec( permalinkWpEnvCommand, {failOnNonZeroExit: true})
.then((result) => {
cy.request('/wp-json/');
});
cy.exec( permalinkWpEnvTestCommand, {failOnNonZeroExit: true})
.then((result) => {
cy.request('/wp-json/');
});
});
}
);

Expand Down

0 comments on commit c216e74

Please sign in to comment.