From fa659bdd5a2b404ca85321bc04fe0adf6c2627ca Mon Sep 17 00:00:00 2001 From: aledesma-godaddy Date: Wed, 28 Feb 2024 08:13:33 -0700 Subject: [PATCH 1/9] bump the workflow for wp next --- .github/workflows/test-wp-next.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-wp-next.yml b/.github/workflows/test-wp-next.yml index 6b75ff7120b..f720fd47932 100644 --- a/.github/workflows/test-wp-next.yml +++ b/.github/workflows/test-wp-next.yml @@ -13,7 +13,7 @@ jobs: uses: ./.github/workflows/date-checker.yml with: # WP Next scheduled release date. Should be based on `https://make.wordpress.org/core/6-4/` or later. - scheduled_release_date: "2023-11-7" + scheduled_release_date: "2024-03-26" # Create WP NEXT Version Constant set_constant: @@ -22,8 +22,8 @@ jobs: if: needs.check_if_released.outputs.should_run_workflow == 'true' runs-on: ubuntu-latest outputs: - # Should be current latest WP Next release on `wordpress.org`. eg: `https://wordpress.org/wordpress-6.4-RC3.zip` - wp_next: "https://wordpress.org/wordpress-6.4-RC3.zip" + # Should be current latest WP Next release on `wordpress.org`. eg: `https://wordpress.org/wordpress-6.5-beta2.zip` + wp_next: "https://wordpress.org/wordpress-6.5-beta2.zip" steps: - run: echo "Setting WP Next Constant" @@ -35,7 +35,7 @@ jobs: uses: ./.github/workflows/test-e2e-cypress.yml with: wpVersion: ${{ needs.set_constant.outputs.wp_next }} - installPath: "tests-wordpress-6.4-RC3" + installPath: "tests-wordpress-6.5-beta2" theme: "https://downloads.wordpress.org/theme/go.zip" concurrency: group: chrome-wp-next From 1d90b4434e9429c05c2e4c12bcf18b64b02b892c Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Mon, 11 Mar 2024 14:36:24 -0400 Subject: [PATCH 2/9] RC1 --- .github/workflows/test-wp-next.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wp-next.yml b/.github/workflows/test-wp-next.yml index f720fd47932..c63fbff2e38 100644 --- a/.github/workflows/test-wp-next.yml +++ b/.github/workflows/test-wp-next.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest outputs: # Should be current latest WP Next release on `wordpress.org`. eg: `https://wordpress.org/wordpress-6.5-beta2.zip` - wp_next: "https://wordpress.org/wordpress-6.5-beta2.zip" + wp_next: "https://wordpress.org/wordpress-6.5-RC1.zip" steps: - run: echo "Setting WP Next Constant" @@ -35,7 +35,7 @@ jobs: uses: ./.github/workflows/test-e2e-cypress.yml with: wpVersion: ${{ needs.set_constant.outputs.wp_next }} - installPath: "tests-wordpress-6.5-beta2" + installPath: "tests-wordpress-6.5-RC1" theme: "https://downloads.wordpress.org/theme/go.zip" concurrency: group: chrome-wp-next From 1e007af41bbaacbcebd88d334a06ad09358b88af Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Mon, 11 Mar 2024 16:05:00 -0400 Subject: [PATCH 3/9] Start fixes for WP 6.5 --- .dev/tests/cypress/helpers.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.dev/tests/cypress/helpers.js b/.dev/tests/cypress/helpers.js index 3bf3d95a3c8..fe4afbd45ae 100644 --- a/.dev/tests/cypress/helpers.js +++ b/.dev/tests/cypress/helpers.js @@ -196,9 +196,15 @@ export function viewPage() { } } ); - cy.get( 'button[data-label="Post"]' ); + if ( isWP65AtLeast() ) { + cy.get( '[data-tab-id="edit-post/document"]' ); - cy.get( '.edit-post-post-url__dropdown button' ).click(); + cy.get( '.editor-post-url__panel-dropdown button' ).click(); + } else { + cy.get( 'button[data-label="Post"]' ); + + cy.get( '.edit-post-post-url__dropdown button' ).click(); + } cy.get( '.editor-post-url__link' ).then( ( pageLink ) => { const linkAddress = Cypress.$( pageLink ).attr( 'href' ); @@ -461,9 +467,14 @@ export function setColorPanelSetting( settingName, hexColor ) { * @param {RegExp} panelText The panel label text to open. eg: Color Settings */ export function openSettingsPanel( panelText ) { - // Ensure block tab is selected. - if ( Cypress.$( 'button[data-label="Block"]:not(.is-active)' ) ) { - cy.get( 'button[data-label="Block"]' ).click(); + if ( isWP65AtLeast() ) { + cy.get( '[data-tab-id="edit-post/block"]' ).click(); + } else { + // Ensure block tab is selected. + // eslint-disable-next-line no-lonely-if + if ( Cypress.$( 'button[data-label="Block"]:not(.is-active)' ) ) { + cy.get( 'button[data-label="Block"]' ).click(); + } } cy.get( '.components-panel__body' ) @@ -588,11 +599,14 @@ export function isNotWPLocalEnv() { } // A condition to determine if we are testing on WordPress 6.4+ -// This function should be removed in the process of the work for WP 6.5 compatibility export function isWP64AtLeast() { return Cypress.$( "[class*='branch-6-4']" ).length > 0 || Cypress.$( "[class*='branch-6-5']" ).length > 0; } +export function isWP65AtLeast() { + return Cypress.$( "[class*='branch-6-5']" ).length > 0 || Cypress.$( "[class*='branch-6-6']" ).length > 0; +} + function getIframeDocument( containerClass ) { return cy.get( containerClass + ' iframe' ).its( '0.contentDocument' ).should( 'exist' ); } From e78ec97d7cc65349f478a00d1cb7d57e326f64cc Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Mon, 11 Mar 2024 16:30:49 -0400 Subject: [PATCH 4/9] More fixes --- .dev/tests/cypress/helpers.js | 14 +++++++++++-- .../media-card/test/media-card.cypress.js | 20 ++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.dev/tests/cypress/helpers.js b/.dev/tests/cypress/helpers.js index fe4afbd45ae..f3ca6840f4d 100644 --- a/.dev/tests/cypress/helpers.js +++ b/.dev/tests/cypress/helpers.js @@ -16,7 +16,12 @@ export function addFormChild( name ) { cy.get( '.components-popover__content button' ).contains( /insert after|add after/i ).click( { force: true } ); cy.get( '[data-type="coblocks/form"] [data-type="core/paragraph"]' ).click( { force: true } ); - cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).click( { force: true } ); + if ( isWP65AtLeast() ) { + cy.get( '.edit-post-header-toolbar' ).find( '.editor-document-tools__inserter-toggle' ).click( { force: true } ); + } else { + cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).click( { force: true } ); + } + cy.get( '.block-editor-inserter__search .components-search-control__input' ).click().type( name ); cy.get( '.editor-block-list-item-coblocks-field-' + name ).first().click( { force: true } ); @@ -137,7 +142,12 @@ export function addBlockToPost( blockName, clearEditor = false ) { export function addNewGroupToPost() { clearBlocks(); - cy.get( '.edit-post-header [aria-label="Add block"], .edit-site-header [aria-label="Add block"], .edit-post-header-toolbar__inserter-toggle' ).click(); + if ( isWP65AtLeast() ) { + cy.get( '.editor-document-tools__inserter-toggle' ).click(); + } else { + cy.get( '.edit-post-header [aria-label="Add block"], .edit-site-header [aria-label="Add block"], .edit-post-header-toolbar__inserter-toggle' ).click(); + } + cy.get( '.block-editor-inserter__search-input,input.block-editor-inserter__search, .components-search-control__input' ).click().type( 'group' ); cy.wait( 1000 ); diff --git a/src/blocks/media-card/test/media-card.cypress.js b/src/blocks/media-card/test/media-card.cypress.js index c5057fd7e08..9b1c07c164b 100644 --- a/src/blocks/media-card/test/media-card.cypress.js +++ b/src/blocks/media-card/test/media-card.cypress.js @@ -1,14 +1,24 @@ +import { isWP65AtLeast } from '../../../../.dev/tests/cypress/helpers'; + describe( 'Test CoBlocks Media Card Block', function() { /** * Test that we can not insert a media-card block into the page. * Media-card blocks is deprecated and should not be usable. */ it( 'Test media-card block in not insertable.', function() { - cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).then( ( inserterButton ) => { - if ( ! Cypress.$( inserterButton ).hasClass( 'is-pressed' ) ) { - cy.get( inserterButton ).click(); - } - } ); + if ( isWP65AtLeast() ) { + cy.get( '.edit-post-header-toolbar' ).find( '.editor-document-tools__inserter-toggle' ).then( ( inserterButton ) => { + if ( ! Cypress.$( inserterButton ).hasClass( 'is-pressed' ) ) { + cy.get( inserterButton ).click(); + } + } ); + } else { + cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).then( ( inserterButton ) => { + if ( ! Cypress.$( inserterButton ).hasClass( 'is-pressed' ) ) { + cy.get( inserterButton ).click(); + } + } ); + } cy.get( '.block-editor-inserter__search' ).find( 'input' ).clear(); cy.get( '.block-editor-inserter__search' ).click().type( 'media-card' ); From fcf754fc3b8513e7c0a9285fd8b0a7a0a3fb21bf Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Mon, 11 Mar 2024 23:36:31 -0400 Subject: [PATCH 5/9] Fix Form block test --- .dev/tests/cypress/helpers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.dev/tests/cypress/helpers.js b/.dev/tests/cypress/helpers.js index f3ca6840f4d..bc57c1fcde9 100644 --- a/.dev/tests/cypress/helpers.js +++ b/.dev/tests/cypress/helpers.js @@ -18,11 +18,13 @@ export function addFormChild( name ) { if ( isWP65AtLeast() ) { cy.get( '.edit-post-header-toolbar' ).find( '.editor-document-tools__inserter-toggle' ).click( { force: true } ); + + cy.get( '.components-input-control__input' ).click().type( name ); } else { cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).click( { force: true } ); - } - cy.get( '.block-editor-inserter__search .components-search-control__input' ).click().type( name ); + cy.get( '.block-editor-inserter__search .components-search-control__input' ).click().type( name ); + } cy.get( '.editor-block-list-item-coblocks-field-' + name ).first().click( { force: true } ); cy.get( `[data-type="coblocks/field-${ name }"]` ).should( 'exist' ).click( { force: true } ); From 27cbbf1572d79f60460e4c38f46c44afbfbc3c98 Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Mon, 11 Mar 2024 23:40:43 -0400 Subject: [PATCH 6/9] Fix padding controls test --- .dev/tests/cypress/helpers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.dev/tests/cypress/helpers.js b/.dev/tests/cypress/helpers.js index bc57c1fcde9..b60c1c54461 100644 --- a/.dev/tests/cypress/helpers.js +++ b/.dev/tests/cypress/helpers.js @@ -146,11 +146,13 @@ export function addNewGroupToPost() { if ( isWP65AtLeast() ) { cy.get( '.editor-document-tools__inserter-toggle' ).click(); + + cy.get( '.components-input-control__input' ).click().type( 'group' ); } else { cy.get( '.edit-post-header [aria-label="Add block"], .edit-site-header [aria-label="Add block"], .edit-post-header-toolbar__inserter-toggle' ).click(); - } - cy.get( '.block-editor-inserter__search-input,input.block-editor-inserter__search, .components-search-control__input' ).click().type( 'group' ); + cy.get( '.block-editor-inserter__search-input,input.block-editor-inserter__search, .components-search-control__input' ).click().type( 'group' ); + } cy.wait( 1000 ); From 19f3742694b738bf6ed14dae283edc4ea3c42508 Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Mon, 11 Mar 2024 23:46:22 -0400 Subject: [PATCH 7/9] Fix media filter control test --- .../test/media-filter-control.cypress.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/media-filter-control/test/media-filter-control.cypress.js b/src/components/media-filter-control/test/media-filter-control.cypress.js index 59931b56d8d..6b37eedc0f4 100644 --- a/src/components/media-filter-control/test/media-filter-control.cypress.js +++ b/src/components/media-filter-control/test/media-filter-control.cypress.js @@ -2,6 +2,7 @@ * Include our constants */ import * as helpers from '../../../../.dev/tests/cypress/helpers'; +import { isWP65AtLeast } from '../../../../.dev/tests/cypress/helpers'; const filters = [ 'Original', @@ -95,8 +96,12 @@ describe( 'Test CoBlocks Media Filter Control component', function() { helpers.upload.imageToBlock( 'core/gallery' ); helpers.selectBlock( 'core/gallery' ); - cy.get( '.components-tab-panel__tab-content' ); - cy.get( '.block-editor-block-toolbar__slot .components-coblocks-media-filter' ).click(); + if ( isWP65AtLeast() ) { + cy.get( '.components-coblocks-media-filter' ).click(); + } else { + cy.get( '.components-tab-panel__tab-content' ); + cy.get( '.block-editor-block-toolbar__slot .components-coblocks-media-filter' ).click(); + } let childIteration = 1; From 48ded490f06f2d2bed9e4d16430739fc4c940eeb Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Tue, 12 Mar 2024 00:09:04 -0400 Subject: [PATCH 8/9] Remove exhaustive deps eslint warning --- .eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.js b/.eslintrc.js index 0b64fbb6696..460d803164c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,6 +32,7 @@ module.exports = { 'sort-imports': [ 'off' ], 'sort-keys': [ 'off' ], 'react/jsx-sort-props': [ 'off' ], + 'react-hooks/exhaustive-deps': [ 'off' ], }, noInlineConfig: false, From d51eb6b4e1b5fa54a6e7ab09393d74fe8c0e6a99 Mon Sep 17 00:00:00 2001 From: Olivier Lafleur Date: Tue, 12 Mar 2024 11:00:40 -0400 Subject: [PATCH 9/9] revert date to not trigger test-wp-next flow on main --- .github/workflows/test-wp-next.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wp-next.yml b/.github/workflows/test-wp-next.yml index c63fbff2e38..191feb1d66d 100644 --- a/.github/workflows/test-wp-next.yml +++ b/.github/workflows/test-wp-next.yml @@ -13,7 +13,7 @@ jobs: uses: ./.github/workflows/date-checker.yml with: # WP Next scheduled release date. Should be based on `https://make.wordpress.org/core/6-4/` or later. - scheduled_release_date: "2024-03-26" + scheduled_release_date: "2023-11-7" # Create WP NEXT Version Constant set_constant: