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' );