diff --git a/src/commands/wp-cli.ts b/src/commands/wp-cli.ts index be6920c..f432715 100644 --- a/src/commands/wp-cli.ts +++ b/src/commands/wp-cli.ts @@ -13,7 +13,7 @@ * ``` */ export const wpCli = (command: string, ignoreFailures = false): void => { - const escapedCommand = command.replace(/"/g, '\\"'); + const escapedCommand = command.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); const options = { failOnNonZeroExit: !ignoreFailures, }; diff --git a/tests/cypress/e2e/create-post.test.js b/tests/cypress/e2e/create-post.test.js index 2fc608b..371a204 100644 --- a/tests/cypress/e2e/create-post.test.js +++ b/tests/cypress/e2e/create-post.test.js @@ -110,12 +110,7 @@ describe('Command: createPost', () => { .find('input[type="checkbox"]') .should('be.checked'); } else { - cy.get( - '.editor-post-sticky__toggle-control input[type="checkbox"]' - ).check(); - cy.get( - '.editor-post-sticky__toggle-control input[type="checkbox"]' - ).should('be.checked'); + cy.get('.editor-post-sticky__toggle-control').should('be.visible'); } }); }, diff --git a/tests/cypress/e2e/open-document-settings.test.js b/tests/cypress/e2e/open-document-settings.test.js index 7786903..7ca355b 100644 --- a/tests/cypress/e2e/open-document-settings.test.js +++ b/tests/cypress/e2e/open-document-settings.test.js @@ -1,3 +1,4 @@ +import { compare } from 'compare-versions'; const { randomName } = require('../support/functions'); import { getIframe } from '../../../lib/functions/get-iframe'; @@ -50,15 +51,19 @@ describe('Commands: openDocumentSettings*', () => { ) { name = 'Summary'; } - cy.openDocumentSettingsPanel(name); - - // Assertion: Stick to the top checkbox should be visible - cy.get('.components-panel__body .components-panel__body-title button') - .contains(name, { matchCase: false }) - .then($button => { - const $panel = $button.parents('.components-panel__body'); - cy.wrap($panel).should('contain', 'Stick to the top of the blog'); - }); + // WP 6.6 handling. + if ($body.find('.editor-post-summary').length === 0) { + cy.openDocumentSettingsPanel(name); + // Assertion: Stick to the top checkbox should be visible + cy.get('.components-panel__body .components-panel__body-title button') + .contains(name, { matchCase: false }) + .then($button => { + const $panel = $button.parents('.components-panel__body'); + cy.wrap($panel).should('contain', 'Stick to the top of the blog'); + }); + } else { + cy.get('.editor-post-sticky__toggle-control').should('be.visible'); + } }); }); @@ -83,6 +88,11 @@ describe('Commands: openDocumentSettings*', () => { }); it('Should be able to open Discussion panel on the existing page', () => { + if (compare(Cypress.env('WORDPRESS_CORE').toString(), '6.6', '>=')) { + assert(true, 'Skipping test'); + return; + } + cy.createPost({ title: randomName(), postType: 'page',