Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
olafleur-godaddy committed Mar 11, 2024
1 parent 1e007af commit e78ec97
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
14 changes: 12 additions & 2 deletions .dev/tests/cypress/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } );
Expand Down Expand Up @@ -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 );
Expand Down
20 changes: 15 additions & 5 deletions src/blocks/media-card/test/media-card.cypress.js
Original file line number Diff line number Diff line change
@@ -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' );
Expand Down

0 comments on commit e78ec97

Please sign in to comment.