diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 5a6223b20..59c096836 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -18,7 +18,7 @@ jobs: core: - {name: 'WP latest', version: 'latest'} - {name: 'WP minimum', version: 'WordPress/WordPress#6.1'} - # - {name: 'WP trunk', version: 'WordPress/WordPress#master'} + - {name: 'WP trunk', version: 'WordPress/WordPress#master'} steps: - name: Checkout uses: actions/checkout@v4 diff --git a/tests/cypress/integration/image-processing/image-generation-openai-dalle.test.js b/tests/cypress/integration/image-processing/image-generation-openai-dalle.test.js index f55bd7680..bd19fbf27 100644 --- a/tests/cypress/integration/image-processing/image-generation-openai-dalle.test.js +++ b/tests/cypress/integration/image-processing/image-generation-openai-dalle.test.js @@ -57,7 +57,7 @@ describe( 'Image Generation (OpenAI DALLĀ·E) Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the Featured image panel. const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("Featured image")`; diff --git a/tests/cypress/integration/language-processing/classify-content-ibm-watson.test.js b/tests/cypress/integration/language-processing/classify-content-ibm-watson.test.js index 578b153da..bd715c7e0 100644 --- a/tests/cypress/integration/language-processing/classify-content-ibm-watson.test.js +++ b/tests/cypress/integration/language-processing/classify-content-ibm-watson.test.js @@ -125,7 +125,7 @@ describe( '[Language processing] Classify content (IBM Watson - NLU) Tests', () } ); // Open post settings sidebar - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Open Panel const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("ClassifAI")`; @@ -214,7 +214,7 @@ describe( '[Language processing] Classify content (IBM Watson - NLU) Tests', () } ); // Open post settings sidebar - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Open Panel const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("ClassifAI")`; @@ -253,7 +253,7 @@ describe( '[Language processing] Classify content (IBM Watson - NLU) Tests', () } ); // Open post settings sidebar - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Verify Each Created taxonomies. [ 'categories', 'keywords', 'concepts', 'entities' ].forEach( @@ -292,7 +292,7 @@ describe( '[Language processing] Classify content (IBM Watson - NLU) Tests', () } ); // Open post settings sidebar - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Verify Each Created taxonomies. [ 'categories', 'keywords', 'concepts', 'entities' ].forEach( @@ -340,7 +340,7 @@ describe( '[Language processing] Classify content (IBM Watson - NLU) Tests', () } ); // Open post settings sidebar - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Verify Each Created taxonomies with threshold 75. [ 'categories', 'keywords', 'concepts', 'entities' ].forEach( @@ -381,7 +381,7 @@ describe( '[Language processing] Classify content (IBM Watson - NLU) Tests', () } ); // Open post settings sidebar - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Verify Each Created taxonomies with threshold 75 as we have already created terms with threshold 75. So, those are existing terms. [ 'categories', 'keywords', 'concepts', 'entities' ].forEach( @@ -435,7 +435,7 @@ describe( '[Language processing] Classify content (IBM Watson - NLU) Tests', () } ); // Open post settings sidebar - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Verify Each Created taxonomies. cy.verifyPostTaxonomyTerms( 'tags', threshold / 100 ); diff --git a/tests/cypress/integration/language-processing/classify-content-openapi-embeddings.test.js b/tests/cypress/integration/language-processing/classify-content-openapi-embeddings.test.js index 37dd3e480..7589784f9 100644 --- a/tests/cypress/integration/language-processing/classify-content-openapi-embeddings.test.js +++ b/tests/cypress/integration/language-processing/classify-content-openapi-embeddings.test.js @@ -51,7 +51,7 @@ describe( '[Language processing] Classify Content (OpenAI) Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the category panel. const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("Categories")`; @@ -119,7 +119,7 @@ describe( '[Language processing] Classify Content (OpenAI) Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the category panel. const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("Categories")`; diff --git a/tests/cypress/integration/language-processing/excerpt-generation-azure-openai.test.js b/tests/cypress/integration/language-processing/excerpt-generation-azure-openai.test.js index c693b8fd8..f7f9c54e3 100644 --- a/tests/cypress/integration/language-processing/excerpt-generation-azure-openai.test.js +++ b/tests/cypress/integration/language-processing/excerpt-generation-azure-openai.test.js @@ -70,7 +70,7 @@ describe( '[Language processing] Excerpt Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the excerpt panel. const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("Excerpt")`; diff --git a/tests/cypress/integration/language-processing/excerpt-generation-googleai-gemini-api.test.js b/tests/cypress/integration/language-processing/excerpt-generation-googleai-gemini-api.test.js index 9be2e7e07..ee2563294 100644 --- a/tests/cypress/integration/language-processing/excerpt-generation-googleai-gemini-api.test.js +++ b/tests/cypress/integration/language-processing/excerpt-generation-googleai-gemini-api.test.js @@ -59,7 +59,7 @@ describe( '[Language processing] Excerpt Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the excerpt panel. const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("Excerpt")`; diff --git a/tests/cypress/integration/language-processing/excerpt-generation-openapi-chatgpt.test.js b/tests/cypress/integration/language-processing/excerpt-generation-openapi-chatgpt.test.js index 475e5edf8..1de34549c 100644 --- a/tests/cypress/integration/language-processing/excerpt-generation-openapi-chatgpt.test.js +++ b/tests/cypress/integration/language-processing/excerpt-generation-openapi-chatgpt.test.js @@ -56,7 +56,7 @@ describe( '[Language processing] Excerpt Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the excerpt panel. const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("Excerpt")`; @@ -212,7 +212,7 @@ describe( '[Language processing] Excerpt Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the excerpt panel. const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("Excerpt")`; diff --git a/tests/cypress/integration/language-processing/text-to-speech-amazon-polly.test.js b/tests/cypress/integration/language-processing/text-to-speech-amazon-polly.test.js index 27ffccf47..2de8bdab7 100644 --- a/tests/cypress/integration/language-processing/text-to-speech-amazon-polly.test.js +++ b/tests/cypress/integration/language-processing/text-to-speech-amazon-polly.test.js @@ -35,7 +35,7 @@ describe( '[Language Processing] Text to Speech (Amazon Polly) Tests', () => { } ); cy.get( 'button[aria-label="Close panel"]' ).click(); - cy.get( 'button[data-label="Post"]' ).click(); + cy.openDocumentSettingsSidebarCustom(); cy.get( '.classifai-panel' ).click(); cy.get( '#classifai-audio-controls__preview-btn' ).should( 'exist' ); } ); diff --git a/tests/cypress/integration/language-processing/text-to-speech-microsoft-azure.test.js b/tests/cypress/integration/language-processing/text-to-speech-microsoft-azure.test.js index bc3eab674..ec776de3d 100644 --- a/tests/cypress/integration/language-processing/text-to-speech-microsoft-azure.test.js +++ b/tests/cypress/integration/language-processing/text-to-speech-microsoft-azure.test.js @@ -35,7 +35,7 @@ describe( '[Language Processing] Text to Speech (Microsoft Azure) Tests', () => } ); cy.get( 'button[aria-label="Close panel"]' ).click(); - cy.get( 'button[data-label="Post"]' ).click(); + cy.openDocumentSettingsSidebarCustom(); cy.get( '.classifai-panel' ).click(); cy.get( '#classifai-audio-controls__preview-btn' ).should( 'exist' ); } ); diff --git a/tests/cypress/integration/language-processing/text-to-speech-openai-text-to-speech.test.js b/tests/cypress/integration/language-processing/text-to-speech-openai-text-to-speech.test.js index 71cc9c29d..858293bf8 100644 --- a/tests/cypress/integration/language-processing/text-to-speech-openai-text-to-speech.test.js +++ b/tests/cypress/integration/language-processing/text-to-speech-openai-text-to-speech.test.js @@ -26,12 +26,11 @@ describe( '[Language Processing] Text to Speech (OpenAI) Tests', () => { it( 'Generates audio from text', () => { cy.createPost( { title: 'Text to Speech test', - content: - "This feature uses OpenAI's Text to Speech capabilities.", + content: "This feature uses OpenAI's Text to Speech capabilities.", } ); cy.get( 'button[aria-label="Close panel"]' ).click(); - cy.get( 'button[data-label="Post"]' ).click(); + cy.openDocumentSettingsSidebarCustom(); cy.get( '.classifai-panel' ).click(); cy.get( '#classifai-audio-controls__preview-btn' ).should( 'exist' ); } ); @@ -95,8 +94,7 @@ describe( '[Language Processing] Text to Speech (OpenAI) Tests', () => { cy.createClassicPost( { title: 'Text to Speech test classic', - content: - "This feature uses OpenAI's Text to Speech capabilities.", + content: "This feature uses OpenAI's Text to Speech capabilities.", postType: 'post', } ); diff --git a/tests/cypress/integration/language-processing/title-generation-azure-openai.test.js b/tests/cypress/integration/language-processing/title-generation-azure-openai.test.js index 477e20b12..8cc538763 100644 --- a/tests/cypress/integration/language-processing/title-generation-azure-openai.test.js +++ b/tests/cypress/integration/language-processing/title-generation-azure-openai.test.js @@ -63,7 +63,7 @@ describe( '[Language processing] Title Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the summary panel. const panelButtonSelector = `.components-panel__body.edit-post-post-status .components-panel__body-title button`; diff --git a/tests/cypress/integration/language-processing/title-generation-googleai-gemini-api.test.js b/tests/cypress/integration/language-processing/title-generation-googleai-gemini-api.test.js index 2d44f6bbf..6b097b83a 100644 --- a/tests/cypress/integration/language-processing/title-generation-googleai-gemini-api.test.js +++ b/tests/cypress/integration/language-processing/title-generation-googleai-gemini-api.test.js @@ -47,7 +47,7 @@ describe( '[Language processing] Title Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the summary panel. const panelButtonSelector = `.components-panel__body.edit-post-post-status .components-panel__body-title button`; diff --git a/tests/cypress/integration/language-processing/title-generation-openapi-chatgpt.test.js b/tests/cypress/integration/language-processing/title-generation-openapi-chatgpt.test.js index 7c7419b66..3970b0678 100644 --- a/tests/cypress/integration/language-processing/title-generation-openapi-chatgpt.test.js +++ b/tests/cypress/integration/language-processing/title-generation-openapi-chatgpt.test.js @@ -44,7 +44,7 @@ describe( '[Language processing] Title Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the summary panel. const panelButtonSelector = `.components-panel__body.edit-post-post-status .components-panel__body-title button`; @@ -215,7 +215,7 @@ describe( '[Language processing] Title Generation Tests', () => { } ); // Open post settings sidebar. - cy.openDocumentSettingsSidebar(); + cy.openDocumentSettingsSidebarCustom(); // Find and open the summary panel. const panelButtonSelector = `.components-panel__body.edit-post-post-status .components-panel__body-title button`; diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index dbf670dba..7fed9bc31 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -565,3 +565,51 @@ Cypress.Commands.add( } ); } ); + +/** + * Open the document settings sidebar. + * + * This has been modified to work with the new WordPress editor. + * Once the next version of Cypress WP Utils is released, we can + * remove this. + * + * @param tab - Name of the tab + * + * @example + * Open 'Post' tab + * ``` + * cy.openDocumentSettingsSidebarCustom() + * ``` + * + * @example + * Open 'Block' tab + * ``` + * cy.openDocumentSettingsSidebarCustom('Block') + * ``` + */ +Cypress.Commands.add( 'openDocumentSettingsSidebarCustom', ( tab = 'Post' ) => { + cy.get( 'body' ).then( ( $body ) => { + const $settingButtonIds = [ + 'button[aria-expanded="false"][aria-label="Settings"]', + ]; + + $settingButtonIds.forEach( ( $settingButtonId ) => { + if ( $body.find( $settingButtonId ).length ) { + cy.get( $settingButtonId ).click(); + cy.wrap( $body.find( $settingButtonId ) ).as( 'sidebarButton' ); + } + } ); + + const $tabSelectors = [ + `div[role="tablist"] button:contains("${ tab }")`, + `.edit-post-sidebar__panel-tabs button:contains("${ tab }")`, + ]; + + $tabSelectors.forEach( ( $tabSelector ) => { + if ( $body.find( $tabSelector ).length ) { + cy.get( $tabSelector ).click(); + cy.wrap( $body.find( $tabSelector ) ).as( 'selectedTab' ); + } + } ); + } ); +} );