diff --git a/.dev/tests/cypress/helpers.js b/.dev/tests/cypress/helpers.js index e1668bc3565..8d277326785 100644 --- a/.dev/tests/cypress/helpers.js +++ b/.dev/tests/cypress/helpers.js @@ -27,7 +27,7 @@ export function addFormChild( name ) { cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).click( { force: true } ); cy.get( '.block-editor-inserter__search' ).click().type( name ); - cy.get( '.block-editor-inserter__content .editor-block-list-item-coblocks-field-' + name ).first().click( { force: true } ); + 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 } ); } @@ -137,6 +137,25 @@ 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(); + cy.get( '.block-editor-inserter__search-input,input.block-editor-inserter__search, .components-search-control__input' ).click().type( 'group' ); + + // The different structure of classes is here + cy.get( '.block-editor-block-types-list__item' ).first().click(); + + // Make sure the block was added to our page + cy.get( `[class*="-visual-editor"] [data-type='core/group']` ).should( 'exist' ).then( () => { + // Then close the block inserter if still open. + const inserterButton = Cypress.$( 'button[class*="__inserter-toggle"].is-pressed' ); + if ( !! inserterButton.length ) { + cy.get( 'button[class*="__inserter-toggle"].is-pressed' ).click(); + } + } ); +} + /** * From inside the WordPress editor open the CoBlocks Gutenberg editor panel */ @@ -178,12 +197,22 @@ export function viewPage() { cy.get( 'button[data-label="Post"]' ); - openSettingsPanel( /permalink/i ); + // WP 6.1 + if ( isWP61AtLeast() ) { + cy.get( '.edit-post-post-url__dropdown button' ).click(); - cy.get( '.edit-post-post-link__link' ).then( ( pageLink ) => { - const linkAddress = Cypress.$( pageLink ).attr( 'href' ); - cy.visit( linkAddress ); - } ); + cy.get( '.editor-post-url__link' ).then( ( pageLink ) => { + const linkAddress = Cypress.$( pageLink ).attr( 'href' ); + cy.visit( linkAddress ); + } ); + } else { // <= WP 6.0 + openSettingsPanel( /permalink/i ); + + cy.get( '.edit-post-post-link__link' ).then( ( pageLink ) => { + const linkAddress = Cypress.$( pageLink ).attr( 'href' ); + cy.visit( linkAddress ); + } ); + } } /** @@ -239,8 +268,7 @@ export function setBlockStyle( style ) { export function selectBlock( name, isChildBlock = false ) { cy.get( '.edit-post-header__toolbar' ).find( '.block-editor-block-navigation,.edit-post-header-toolbar__list-view-toggle' ).click(); - // >= WP 6.0 - if ( isChildBlock && Cypress.$( '.branch-5-9' ).length === 0 ) { + if ( isChildBlock ) { cy.get( '.block-editor-list-view__expander svg' ).first().click(); } @@ -356,31 +384,39 @@ export const upload = { * @param {string} hexColor */ export function setColorSettingsFoldableSetting( settingName, hexColor ) { - openSettingsPanel( /color settings|color/i ); + // Not needed in WP 6.1 anymore + if ( ! isWP61AtLeast() ) { + openSettingsPanel( /color settings|color/i ); + } const formattedHex = hexColor.split( '#' )[ 1 ]; cy.get( '.block-editor-panel-color-gradient-settings__dropdown' ).contains( settingName, { matchCase: false } ).click(); cy.get( '.components-color-palette__custom-color' ).click(); - cy.get( '[aria-label="Show detailed inputs"]' ).click(); + // Not needed in WP 6.1 anymore + if ( ! isWP61AtLeast() ) { + cy.get( '[aria-label="Show detailed inputs"]' ).click(); + } + cy.get( '.components-color-picker' ).find( '.components-input-control__input' ).click().clear().type( formattedHex ); - cy.get( '.block-editor-panel-color-gradient-settings__dropdown' ).contains( settingName, { matchCase: false } ).click(); + cy.get( '.block-editor-panel-color-gradient-settings__dropdown' ) + .contains( settingName, { matchCase: false } ) + .click( { force: true } ); } export function setColorPanelSetting( settingName, hexColor ) { - // If WP 5.9, we may need to open the panel. Since WP 6.0, it is always open - if ( Cypress.$( '.branch-5-9' ).length > 0 ) { - openSettingsPanel( /color settings|color/i ); - } - const formattedHex = hexColor.split( '#' )[ 1 ]; cy.get( '.block-editor-panel-color-gradient-settings__dropdown' ).contains( settingName, { matchCase: false } ).click(); cy.get( '.components-color-palette__custom-color' ).click(); - cy.get( '[aria-label="Show detailed inputs"]' ).click(); + // Not needed in WP 6.1 anymore + if ( ! isWP61AtLeast() ) { + cy.get( '[aria-label="Show detailed inputs"]' ).click(); + } + cy.get( '.components-color-picker' ).find( '.components-input-control__input' ).click().clear().type( formattedHex ); cy.get( '.block-editor-panel-color-gradient-settings__dropdown' ).contains( settingName, { matchCase: false } ).click(); @@ -424,7 +460,7 @@ export function openHeadingToolbarAndSelect( headingLevel ) { export function toggleSettingCheckbox( checkboxLabelText ) { cy.get( '.components-toggle-control__label' ) .contains( checkboxLabelText ) - .parent( '.components-base-control__field' ) + .closest( '.components-base-control__field' ) .find( '.components-form-toggle__input' ) .click(); } @@ -510,13 +546,13 @@ export function hexToRGB( hex ) { return 'rgb(' + +r + ', ' + +g + ', ' + +b + ')'; } -function getIframeDocument( containerClass ) { - return cy.get( containerClass + ' iframe' ).its( '0.contentDocument' ).should( 'exist' ); +export function isNotWPLocalEnv() { + return Cypress.env( 'testURL' ) !== 'http://localhost:8889'; } -export function getIframeBody( containerClass ) { - return getIframeDocument( containerClass ).its( 'body' ).should( 'not.be.undefined' ) - // wraps "body" DOM element to allow - // chaining more Cypress commands, like ".find(...)" - .then( cy.wrap ); +// A condition to determine if we are testing on WordPress 6.1+ +export function isWP61AtLeast() { + // WP 6.0 uses the branch-6 class, and version 6.1+ uses branch-6-x (ex : branch-6-1 for WP 6.1) + // So we are looking for a class that starts with branch-6- + return Cypress.$( "[class^='branch-6-']" ).length > 0; } diff --git a/src/blocks/dynamic-separator/test/dynamic-separator.cypress.js b/src/blocks/dynamic-separator/test/dynamic-separator.cypress.js index 54a5fc5686d..f247958babd 100644 --- a/src/blocks/dynamic-separator/test/dynamic-separator.cypress.js +++ b/src/blocks/dynamic-separator/test/dynamic-separator.cypress.js @@ -3,7 +3,7 @@ */ import * as helpers from '../../../../.dev/tests/cypress/helpers'; -describe( 'Test CoBlocks Dynamic Seperator Block', function() { +describe( 'Test CoBlocks Dynamic Separator Block', function() { /** * Test that we can add a dynamic separator block to the page */ diff --git a/src/blocks/food-and-drinks/food-item/test/food-item.cypress.js b/src/blocks/food-and-drinks/food-item/test/food-item.cypress.js index b564305954e..8c2720386cb 100644 --- a/src/blocks/food-and-drinks/food-item/test/food-item.cypress.js +++ b/src/blocks/food-and-drinks/food-item/test/food-item.cypress.js @@ -17,23 +17,33 @@ describe( 'Block: Food Item', () => { } ); it( 'removes .is-empty when the \'title\', \'description\', \'price\' attributes have content', () => { + let headingClass = '.wp-block-coblocks-food-item__heading'; + let priceEditableSelector = '.wp-block-coblocks-food-item__price .block-editor-rich-text__editable'; + let descriptionEditableSelector = '.wp-block-coblocks-food-item__description .block-editor-rich-text__editable'; + + if ( helpers.isWP61AtLeast() ) { + headingClass += '-wrapper'; + priceEditableSelector = '[aria-label="$0.00"]'; + descriptionEditableSelector = '[aria-label="Add description…"]'; + } + cy.get( '[data-type="coblocks/food-item"]' ).first().within( () => { // Set heading. - cy.get( '.wp-block-coblocks-food-item__heading .block-editor-rich-text__editable' ).focus().type( 'item heading', { force: true } ); + cy.get( headingClass + ' .block-editor-rich-text__editable' ).focus().type( 'item heading', { force: true } ); cy.get( '.wp-block-coblocks-food-item' ).should( 'not.have.class', 'is-empty' ); - cy.get( '.wp-block-coblocks-food-item__heading .block-editor-rich-text__editable' ).focus().type( '{selectall}{del}', { force: true } ); + cy.get( headingClass + ' .block-editor-rich-text__editable' ).focus().type( '{selectall}{del}', { force: true } ); cy.get( '.wp-block-coblocks-food-item' ).should( 'have.class', 'is-empty' ); // Set price. - cy.get( '.wp-block-coblocks-food-item__price .block-editor-rich-text__editable' ).focus().type( 'item price', { force: true } ); + cy.get( priceEditableSelector ).focus().type( 'item price', { force: true } ); cy.get( '.wp-block-coblocks-food-item' ).should( 'not.have.class', 'is-empty' ); - cy.get( '.wp-block-coblocks-food-item__price .block-editor-rich-text__editable' ).focus().type( '{selectall}{del}', { force: true } ); + cy.get( priceEditableSelector ).focus().type( '{selectall}{del}', { force: true } ); cy.get( '.wp-block-coblocks-food-item' ).should( 'have.class', 'is-empty' ); // Set description. - cy.get( '.wp-block-coblocks-food-item__description .block-editor-rich-text__editable' ).focus().type( 'item description', { force: true } ); + cy.get( descriptionEditableSelector ).focus().type( 'item description', { force: true } ); cy.get( '.wp-block-coblocks-food-item' ).should( 'not.have.class', 'is-empty' ); - cy.get( '.wp-block-coblocks-food-item__description .block-editor-rich-text__editable' ).focus().type( '{selectall}{del}', { force: true } ); + cy.get( descriptionEditableSelector ).focus().type( '{selectall}{del}', { force: true } ); cy.get( '.wp-block-coblocks-food-item' ).should( 'have.class', 'is-empty' ); } ); } ); @@ -51,13 +61,19 @@ describe( 'Block: Food Item', () => { } ); it( 'can toggle price', () => { + let priceSelector = '.wp-block-coblocks-food-item__price'; + + if ( helpers.isWP61AtLeast() ) { + priceSelector = '[aria-label="$0.00"]'; + } + cy.get( '[data-type="coblocks/food-item"]' ).first().click(); - cy.get( '[data-type="coblocks/food-item"]' ).first().find( '.wp-block-coblocks-food-item__price' ).should( 'exist' ); + cy.get( '[data-type="coblocks/food-item"]' ).first().find( priceSelector ).should( 'exist' ); helpers.openSettingsPanel( /item settings/i ); cy.get( '.components-toggle-control' ).find( '.components-base-control__field' ).contains( /price/i ).click(); - cy.get( '[data-type="coblocks/food-item"]' ).first().find( '.wp-block-coblocks-food-item__price' ).should( 'not.exist' ); + cy.get( '[data-type="coblocks/food-item"]' ).first().find( priceSelector ).should( 'not.exist' ); helpers.checkForBlockErrors( 'coblocks/food-item' ); } ); diff --git a/src/blocks/food-and-drinks/test/food-and-drinks.cypress.js b/src/blocks/food-and-drinks/test/food-and-drinks.cypress.js index 6e80257c391..495c99982c6 100644 --- a/src/blocks/food-and-drinks/test/food-and-drinks.cypress.js +++ b/src/blocks/food-and-drinks/test/food-and-drinks.cypress.js @@ -4,16 +4,14 @@ import * as helpers from '../../../../.dev/tests/cypress/helpers'; describe( 'Block: Food and Drinks', function() { - beforeEach( () => { - helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); - helpers.selectBlock( 'food & drink' ); - } ); - /** * Test that we can add a food-and-drinks block to the content, not alter * any settings, and are able to successfully save the block without errors. */ it( 'can be inserted without errors', function() { + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); + cy.get( '.wp-block-coblocks-food-and-drinks' ).should( 'exist' ); helpers.checkForBlockErrors( 'coblocks/food-and-drinks' ); } ); @@ -22,6 +20,9 @@ describe( 'Block: Food and Drinks', function() { * Test the food-and-drinks block saves with custom classes */ it( 'can set custom classes', () => { + helpers.addBlockToPost( 'coblocks/food-and-drinks', false ); // Was failing when true here + helpers.selectBlock( 'food & drink' ); + helpers.addCustomBlockClass( 'my-custom-class', 'food-and-drinks' ); cy.get( '.wp-block-coblocks-food-and-drinks' ).should( 'have.class', 'my-custom-class' ); @@ -29,6 +30,9 @@ describe( 'Block: Food and Drinks', function() { } ); it( 'can set the number of columns between 2 and 4', () => { + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); + helpers.setBlockStyle( 'grid' ); helpers.openSettingsPanel( /food & drinks settings/i ); @@ -44,6 +48,9 @@ describe( 'Block: Food and Drinks', function() { } ); it( 'can set the gutter to small, medium, large, and huge', () => { + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); + helpers.setBlockStyle( 'grid' ); helpers.openSettingsPanel( /food & drinks settings/i ); @@ -57,6 +64,9 @@ describe( 'Block: Food and Drinks', function() { } ); it( 'can toggle images for inner food-item blocks', () => { + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); + cy.get( '[data-type="coblocks/food-and-drinks"]' ).first().within( () => { cy.get( '[data-type="coblocks/food-item"]' ).first().click( 'left' ); cy.get( '[data-type="coblocks/food-item"]' ).first().find( '.block-editor-media-placeholder' ).should( 'not.exist' ); @@ -76,9 +86,18 @@ describe( 'Block: Food and Drinks', function() { } ); it( 'can toggle prices for inner food-item blocks', () => { + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); + + let priceSelector = '.wp-block-coblocks-food-item__price'; + + if ( helpers.isWP61AtLeast() ) { + priceSelector = '[aria-label="$0.00"]'; + } + cy.get( '[data-type="coblocks/food-and-drinks"]' ).first().within( () => { cy.get( '[data-type="coblocks/food-item"]' ).first().click( 'left' ); - cy.get( '[data-type="coblocks/food-item"]' ).first().find( '.wp-block-coblocks-food-item__price' ).should( 'exist' ); + cy.get( '[data-type="coblocks/food-item"]' ).first().find( priceSelector ).should( 'exist' ); } ); helpers.selectBlock( 'Food & Drink' ); @@ -88,7 +107,7 @@ describe( 'Block: Food and Drinks', function() { cy.get( '[data-type="coblocks/food-and-drinks"]' ).first().within( () => { cy.get( '[data-type="coblocks/food-item"]' ).first().click( 'left' ); - cy.get( '[data-type="coblocks/food-item"]' ).first().find( '.wp-block-coblocks-food-item__price' ).should( 'not.exist' ); + cy.get( '[data-type="coblocks/food-item"]' ).first().find( priceSelector ).should( 'not.exist' ); } ); helpers.checkForBlockErrors( 'coblocks/food-and-drinks' ); @@ -98,6 +117,9 @@ describe( 'Block: Food and Drinks', function() { * Test the food-and-drinks block saves with custom classes */ it( 'Test the food-and-drinks block custom classes.', function() { + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); helpers.selectBlock( 'food & drink' ); @@ -114,6 +136,15 @@ describe( 'Block: Food and Drinks', function() { } ); it( 'can insert menu section with the same attributes', () => { + let priceSelector = '.wp-block-coblocks-food-item__price'; + + if ( helpers.isWP61AtLeast() ) { + priceSelector = '[aria-label="$0.00"]'; + } + + helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); + helpers.openSettingsPanel( /food & drinks settings/i ); // Set a couple attributes. @@ -128,7 +159,7 @@ describe( 'Block: Food and Drinks', function() { cy.get( '[data-type="coblocks/food-and-drinks"]' ).last().within( () => { cy.get( '[data-type="coblocks/food-item"]' ).first().click( 'left' ); cy.get( '[data-type="coblocks/food-item"]' ).first().find( '.block-editor-media-placeholder' ).should( 'exist' ); - cy.get( '[data-type="coblocks/food-item"]' ).first().find( '.wp-block-coblocks-food-item__price' ).should( 'exist' ); + cy.get( '[data-type="coblocks/food-item"]' ).first().find( priceSelector ).should( 'exist' ); cy.get( '.wp-block-coblocks-food-and-drinks' ).should( 'have.class', 'my-custom-class' ); } ); @@ -141,6 +172,7 @@ describe( 'Block: Food and Drinks', function() { */ it( 'Updates the inner blocks when the "Heading Level" control is changed.', function() { helpers.addBlockToPost( 'coblocks/food-and-drinks', true ); + helpers.selectBlock( 'food & drink' ); // Assert headings levels are set to default (h4) cy.get( '[data-type="coblocks/food-and-drinks"] [data-type="coblocks/food-item"] h4' ).should( 'have.length', 2 ); diff --git a/src/blocks/form/test/form.cypress.js b/src/blocks/form/test/form.cypress.js index 00b6afedf05..fd593287b4a 100644 --- a/src/blocks/form/test/form.cypress.js +++ b/src/blocks/form/test/form.cypress.js @@ -355,17 +355,20 @@ describe( 'Test CoBlocks Form Block', function() { cy.get( '.coblocks-form__submit button' ) .click(); - cy.get( '.coblocks-form__submitted' ).contains( 'Your message was sent:' ); + // Mailserver is not necessarily installed locally + if ( helpers.isNotWPLocalEnv() ) { + cy.get( '.coblocks-form__submitted' ).contains( 'Your message was sent:' ); - cy.get( '.coblocks-form__submitted ul li:first-child' ).contains( 'Name: Name' ); - cy.get( '.coblocks-form__submitted ul li:nth-child(2)' ).contains( 'Email: email@example.com' ); - cy.get( '.coblocks-form__submitted ul li:last-child' ).contains( 'Message: My message for you.' ); + cy.get( '.coblocks-form__submitted ul li:first-child' ).contains( 'Name: Name' ); + cy.get( '.coblocks-form__submitted ul li:nth-child(2)' ).contains( 'Email: email@example.com' ); + cy.get( '.coblocks-form__submitted ul li:last-child' ).contains( 'Message: My message for you.' ); - cy.exec( 'curl http://127.0.0.1:8025/api/v2/messages' ) - .its( 'stdout' ) - .should( 'contain', 'Name: Name' ) - .should( 'contain', 'Email: email@example.com' ) - .should( 'contain', 'Message: My message for you.' ); + cy.exec( 'curl http://127.0.0.1:8025/api/v2/messages' ) + .its( 'stdout' ) + .should( 'contain', 'Name: Name' ) + .should( 'contain', 'Email: email@example.com' ) + .should( 'contain', 'Message: My message for you.' ); + } helpers.editPage(); } ); @@ -436,11 +439,14 @@ describe( 'Test CoBlocks Form Block', function() { cy.get( '.coblocks-form__submit button' ) .click(); - cy.get( '.coblocks-form__submitted' ).contains( 'Your message was sent:' ); + // Mailserver is not necessarily installed locally + if ( helpers.isNotWPLocalEnv() ) { + cy.get( '.coblocks-form__submitted' ).contains( 'Your message was sent:' ); - cy.exec( 'curl http://127.0.0.1:8025/api/v2/messages' ) - .its( 'stdout' ) - .should( 'contain', 'Custom Subject Line: Email From email@example.com - Name' ); + cy.exec( 'curl http://127.0.0.1:8025/api/v2/messages' ) + .its( 'stdout' ) + .should( 'contain', 'Custom Subject Line: Email From email@example.com - Name' ); + } helpers.editPage(); } ); @@ -497,7 +503,10 @@ describe( 'Test CoBlocks Form Block', function() { cy.get( '.coblocks-form__submit button' ) .click(); - cy.get( '.coblocks-form__submitted' ).contains( 'Thank you for submitting this form!' ); + // Mailserver is not necessarily installed locally + if ( helpers.isNotWPLocalEnv() ) { + cy.get( '.coblocks-form__submitted' ).contains( 'Thank you for submitting this form!' ); + } helpers.editPage(); } ); diff --git a/src/blocks/gallery-collage/test/gallery-collage.cypress.js b/src/blocks/gallery-collage/test/gallery-collage.cypress.js index fd79c211434..fb9927c00d8 100644 --- a/src/blocks/gallery-collage/test/gallery-collage.cypress.js +++ b/src/blocks/gallery-collage/test/gallery-collage.cypress.js @@ -117,10 +117,14 @@ describe( 'Test CoBlocks Gallery Collage Block', function() { helpers.toggleSettingCheckbox( /captions/i ); - cy.get( '.wp-block-coblocks-gallery-collage__item' ).first().click() - .find( 'figcaption' ).focus(); + // Focus the image + cy.get( '.wp-block-coblocks-gallery-collage__item' ).first().click(); - cy.get( '[data-type="coblocks/gallery-collage"]' ).find( 'figcaption' ).focus(); + // Locate the caption and type in it + cy.get( '.wp-block-coblocks-gallery-collage__item' ) + .find( 'figcaption' ) + .first() + .type( 'a caption', { force: true } ); cy.get( '.block-editor-format-toolbar, .block-editor-rich-text__inline-format-toolbar-group' ); diff --git a/src/blocks/gallery-masonry/test/gallery-masonry.cypress.js b/src/blocks/gallery-masonry/test/gallery-masonry.cypress.js index c52f9043030..203ddddcee7 100644 --- a/src/blocks/gallery-masonry/test/gallery-masonry.cypress.js +++ b/src/blocks/gallery-masonry/test/gallery-masonry.cypress.js @@ -190,6 +190,8 @@ describe( 'Test CoBlocks Gallery Masonry Block', function() { cy.get( '.block-editor-block-toolbar div:nth-of-type(4) button' ).contains( 'Replace' ).click(); + cy.get( '[data-type="coblocks/gallery-masonry"]' ).click(); + cy.get( '.components-popover__content' ).should( 'not.exist' ); helpers.savePage(); diff --git a/src/blocks/icon/test/icon.cypress.js b/src/blocks/icon/test/icon.cypress.js index 56d90b8ad10..6f46a276675 100644 --- a/src/blocks/icon/test/icon.cypress.js +++ b/src/blocks/icon/test/icon.cypress.js @@ -132,7 +132,10 @@ describe( 'Test CoBlocks Icon Block', function() { // Make sure that controls who are lazy loaded finished loading cy.contains( 'Color settings' ); - helpers.openSettingsPanel( 'Color settings' ); + // Not needed in WP 6.1 anymore + if ( ! helpers.isWP61AtLeast() ) { + helpers.openSettingsPanel( 'Color settings' ); + } helpers.setColorSettingsFoldableSetting( 'background', '#e60099' ); helpers.setColorSettingsFoldableSetting( 'icon color', '#55e7ff' ); diff --git a/src/blocks/pricing-table/pricing-table-item/test/pricing-table-item.cypress.js b/src/blocks/pricing-table/pricing-table-item/test/pricing-table-item.cypress.js index c2faabcc23d..035d574e759 100644 --- a/src/blocks/pricing-table/pricing-table-item/test/pricing-table-item.cypress.js +++ b/src/blocks/pricing-table/pricing-table-item/test/pricing-table-item.cypress.js @@ -39,6 +39,8 @@ describe( 'Test CoBlocks Pricing Table Item Block', function() { */ it( 'Test pricing-table block saves with content values set.', function() { const { textColor, backgroundColor, textColorRGB, backgroundColorRGB, title, currency, amount, features, buttonText } = pricingTableItemData; + let featuresText = features; + helpers.addBlockToPost( 'coblocks/pricing-table', true ); const firstTableItem = () => { @@ -66,7 +68,13 @@ describe( 'Test CoBlocks Pricing Table Item Block', function() { firstTableItem().find( '.wp-block-coblocks-pricing-table-item__title' ).should( 'have.html', title ); firstTableItem().find( '.wp-block-coblocks-pricing-table-item__currency' ).should( 'have.html', currency ); firstTableItem().find( '.wp-block-coblocks-pricing-table-item__amount' ).should( 'have.html', amount ); - firstTableItem().find( '.wp-block-coblocks-pricing-table-item__features > li' ).should( 'have.html', features ); + + // There is a slight spacing difference in WP 6.1 + if ( helpers.isWP61AtLeast() ) { + featuresText = ' ' + featuresText; + } + + firstTableItem().find( '.wp-block-coblocks-pricing-table-item__features > li' ).should( 'have.html', featuresText ); firstTableItem().find( '.wp-block-button' ).should( 'have.text', buttonText ); } ); } ); diff --git a/src/extensions/padding-controls/test/padding-controls.cypress.js b/src/extensions/padding-controls/test/padding-controls.cypress.js index 7a35bd20e25..7e4f0526c97 100644 --- a/src/extensions/padding-controls/test/padding-controls.cypress.js +++ b/src/extensions/padding-controls/test/padding-controls.cypress.js @@ -8,7 +8,13 @@ describe( 'Extension: CoBlocks Padding Controls', function() { * Test that the CoBlocks panel padding controls function as expected. */ it( 'Can control padding settings as expected.', function() { - helpers.addBlockToPost( 'core/group', true ); + // WP 6.1 : Group icon class in inserter has different structure than the other blocks + if ( helpers.isWP61AtLeast() ) { + helpers.addNewGroupToPost(); + } else { + helpers.addBlockToPost( 'core/group', true ); + } + helpers.selectBlock( 'group' ); helpers.openSettingsPanel( /group settings/i );