From 5e6cc1715490ed333b2e363e1cdcefe4e8696683 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Mon, 15 Apr 2024 11:42:51 +0200 Subject: [PATCH] Use canvas param instead of manually entering edit mode --- .../add-to-cart-form.block_theme.spec.ts | 4 +- .../cart-block.merchant.block_theme.spec.ts | 4 +- ...heckout-block.merchant.block_theme.spec.ts | 9 ++-- ...k.shopper.block_theme.side_effects.spec.ts | 50 +++++++++---------- ...firmation.block_theme.side_effects.spec.ts | 2 +- ...-template.block_theme.side_effects.spec.ts | 5 +- ....merchant.block_theme.side_effects.spec.ts | 4 +- ....merchant.block_theme.side_effects.spec.ts | 4 +- ...-template.block_theme.side_effects.spec.ts | 4 +- ...ollection.block_theme.side_effects.spec.ts | 4 +- .../product-collection.page.ts | 3 +- ...-previous.block_theme.side_effects.spec.ts | 4 +- .../utils.ts | 9 +--- ...rge-image.block_theme.side_effects.spec.ts | 4 +- ...ery-pager.block_theme.side_effects.spec.ts | 4 +- ...humbnails.block_theme.side_effects.spec.ts | 4 +- .../product-gallery-thumbnails/utils.ts | 11 +--- ...t-gallery.block_theme.side_effects.spec.ts | 6 +-- .../related-products.block_theme.spec.ts | 5 +- .../cart-template.block_theme.spec.ts | 7 +-- .../checkout-template.block_theme.spec.ts | 6 +-- .../order-confirmation.block_theme.spec.ts | 2 +- ...omization.block_theme.side_effects.spec.ts | 3 +- 23 files changed, 68 insertions(+), 90 deletions(-) diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts index 1e9be0b59c8..befad92cd9a 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/add-to-cart-form/add-to-cart-form.block_theme.spec.ts @@ -62,8 +62,8 @@ test.describe( `${ blockData.name } Block`, () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//archive-product`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.insertBlock( { name: 'woocommerce/single-product' } ); @@ -89,8 +89,8 @@ test.describe( `${ blockData.name } Block`, () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//single-product`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.setContent( '' ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/cart/cart-block.merchant.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/cart/cart-block.merchant.block_theme.spec.ts index 060ffcffc47..95bc76e5eb6 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/cart/cart-block.merchant.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/cart/cart-block.merchant.block_theme.spec.ts @@ -25,12 +25,12 @@ test.describe( 'Merchant → Cart', () => { const blockSelectorInEditor = blockData.selectors.editor.block as string; test.describe( 'in page editor', () => { - test.beforeEach( async ( { editorUtils, admin } ) => { + test.beforeEach( async ( { admin } ) => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//page-cart', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); } ); test( 'renders without crashing and can only be inserted once', async ( { diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.merchant.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.merchant.block_theme.spec.ts index e60d18fb270..4a85b49993b 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.merchant.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.merchant.block_theme.spec.ts @@ -42,12 +42,13 @@ test.describe( 'Merchant → Checkout', () => { // `as string` is safe here because we know the variable is a string, it is defined above. const blockSelectorInEditor = blockData.selectors.editor.block as string; - test.beforeEach( async ( { editorUtils, admin, editor } ) => { + test.beforeEach( async ( { admin, editor } ) => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//page-checkout', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); + await editor.openDocumentSettingsSidebar(); } ); @@ -147,8 +148,8 @@ test.describe( 'Merchant → Checkout', () => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//page-checkout', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.openDocumentSettingsSidebar(); await editor.selectBlocks( blockSelectorInEditor + @@ -190,8 +191,8 @@ test.describe( 'Merchant → Checkout', () => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//page-checkout', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.openDocumentSettingsSidebar(); await editor.selectBlocks( blockSelectorInEditor + diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.shopper.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.shopper.block_theme.side_effects.spec.ts index 634a5e14c11..1bb9efd1130 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.shopper.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/checkout-block.shopper.block_theme.side_effects.spec.ts @@ -237,33 +237,31 @@ test.describe( 'Shopper → Shipping and Billing Addresses', () => { // `as string` is safe here because we know the variable is a string, it is defined above. const blockSelectorInEditor = blockData.selectors.editor.block as string; - test.beforeEach( - async ( { editor, frontendUtils, admin, editorUtils, page } ) => { - await admin.visitSiteEditor( { - postId: 'woocommerce/woocommerce//page-checkout', - postType: 'wp_template', - } ); - await editorUtils.enterEditMode(); - await editor.openDocumentSettingsSidebar(); - await editor.selectBlocks( - blockSelectorInEditor + - ' [data-type="woocommerce/checkout-shipping-address-block"]' - ); + test.beforeEach( async ( { editor, admin, editorUtils, page } ) => { + await admin.visitSiteEditor( { + postId: 'woocommerce/woocommerce//page-checkout', + postType: 'wp_template', + canvas: 'edit', + } ); + await editor.openDocumentSettingsSidebar(); + await editor.selectBlocks( + blockSelectorInEditor + + ' [data-type="woocommerce/checkout-shipping-address-block"]' + ); - const checkbox = page.getByRole( 'checkbox', { - name: 'Company', - exact: true, - } ); - await checkbox.check(); - await expect( checkbox ).toBeChecked(); - await expect( - editor.canvas.locator( - 'div.wc-block-components-address-form__company' - ) - ).toBeVisible(); - await editorUtils.saveSiteEditorEntities(); - } - ); + const checkbox = page.getByRole( 'checkbox', { + name: 'Company', + exact: true, + } ); + await checkbox.check(); + await expect( checkbox ).toBeChecked(); + await expect( + editor.canvas.locator( + 'div.wc-block-components-address-form__company' + ) + ).toBeVisible(); + await editorUtils.saveSiteEditorEntities(); + } ); test( 'User can add postcodes for different countries', async ( { frontendUtils, diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/order-confirmation.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/order-confirmation.block_theme.side_effects.spec.ts index 9476b5709c6..bc66f276186 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/order-confirmation.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/order-confirmation.block_theme.side_effects.spec.ts @@ -44,8 +44,8 @@ test.describe( 'Shopper → Order Confirmation (logged in user)', () => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//order-confirmation', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editorUtils.transformIntoBlocks(); } ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/classic-template/classic-template.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/classic-template/classic-template.block_theme.side_effects.spec.ts index 0596fe51e94..52237d2ef35 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/classic-template/classic-template.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/classic-template/classic-template.block_theme.side_effects.spec.ts @@ -62,8 +62,8 @@ for ( const { templateTitle, slug } of Object.values( templates ) ) { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); const block = await editorUtils.getBlockByName( blockData.name ); await expect( block ).toBeVisible(); @@ -75,14 +75,13 @@ for ( const { templateTitle, slug } of Object.values( templates ) ) { test.skip( `is rendered on ${ templateTitle } template - frontend side`, async ( { admin, editor, - editorUtils, page, } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.insertBlock( { name: 'core/paragraph', attributes: { content: 'Hello World' }, diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/local-pickup/local-pickup.merchant.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/local-pickup/local-pickup.merchant.block_theme.side_effects.spec.ts index fa9619faf2c..40a915bf34f 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/local-pickup/local-pickup.merchant.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/local-pickup/local-pickup.merchant.block_theme.side_effects.spec.ts @@ -37,8 +37,8 @@ test.describe( 'Merchant → Local Pickup Settings', () => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//page-checkout', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); const block = await editorUtils.getBlockByName( 'woocommerce/checkout-shipping-method-block' @@ -73,8 +73,8 @@ test.describe( 'Merchant → Local Pickup Settings', () => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//page-checkout', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await expect( editor.canvas.getByText( 'Edited from settings page' ) diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/mini-cart/mini-cart-block.merchant.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/mini-cart/mini-cart-block.merchant.block_theme.side_effects.spec.ts index 9f7c134cb07..965c48e7bae 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/mini-cart/mini-cart-block.merchant.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/mini-cart/mini-cart-block.merchant.block_theme.side_effects.spec.ts @@ -24,8 +24,8 @@ test.describe( 'Merchant → Mini Cart', () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//single-product`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.setContent( '' ); @@ -40,8 +40,8 @@ test.describe( 'Merchant → Mini Cart', () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//single-product`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editorUtils.openGlobalBlockInserter(); await editorUtils.page diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/on-sale-badge/on-sale-badge-single-product-template.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/on-sale-badge/on-sale-badge-single-product-template.block_theme.side_effects.spec.ts index 423143ce6de..9ad89cabf7d 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/on-sale-badge/on-sale-badge-single-product-template.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/on-sale-badge/on-sale-badge-single-product-template.block_theme.side_effects.spec.ts @@ -72,12 +72,12 @@ const getBoundingClientRect = async ( { }; test.describe( `${ blockData.name }`, () => { test.describe( `On the Single Product Template`, () => { - test.beforeEach( async ( { admin, editorUtils, editor } ) => { + test.beforeEach( async ( { admin, editor } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ blockData.slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.setContent( '' ); } ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.block_theme.side_effects.spec.ts index 02ee45003cf..9a70d89ff50 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.block_theme.side_effects.spec.ts @@ -953,8 +953,8 @@ test.describe( 'Product Collection', () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//taxonomy-product_cat`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editorUtils.insertBlockUsingGlobalInserter( pageObject.BLOCK_NAME ); @@ -982,8 +982,8 @@ test.describe( 'Product Collection', () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//taxonomy-product_tag`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editorUtils.insertBlockUsingGlobalInserter( pageObject.BLOCK_NAME ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.page.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.page.ts index 8f45fb77b65..3a7ca98f9ae 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.page.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-collection/product-collection.page.ts @@ -182,9 +182,8 @@ class ProductCollectionPage { await this.admin.visitSiteEditor( { postId: template, postType: 'wp_template', + canvas: 'edit', } ); - await this.editorUtils.waitForSiteEditorFinishLoading(); - await this.editorUtils.enterEditMode(); await this.editorUtils.replaceBlockByBlockName( 'core/query', this.BLOCK_SLUG diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/product-gallery-large-image-next-previous.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/product-gallery-large-image-next-previous.block_theme.side_effects.spec.ts index a2ac2988c4e..62701e51178 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/product-gallery-large-image-next-previous.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/product-gallery-large-image-next-previous.block_theme.side_effects.spec.ts @@ -87,12 +87,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( { } ); test.describe( `${ blockData.name }`, () => { - test.beforeEach( async ( { admin, editorUtils } ) => { + test.beforeEach( async ( { admin } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ blockData.slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); } ); // eslint-disable-next-line playwright/no-skipped-test diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/utils.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/utils.ts index 481f0bc07f5..74fc9b2ee7f 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/utils.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image-next-previous/utils.ts @@ -1,19 +1,14 @@ /** * External dependencies */ -import { EditorUtils } from '@woocommerce/e2e-utils'; import { Admin, Editor } from '@wordpress/e2e-test-utils-playwright'; -export const addBlock = async ( - admin: Admin, - editor: Editor, - editorUtils: EditorUtils -) => { +export const addBlock = async ( admin: Admin, editor: Editor ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//single-product`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.insertBlock( { name: 'woocommerce/product-gallery', diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image/product-gallery-large-image.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image/product-gallery-large-image.block_theme.side_effects.spec.ts index 78917b2a894..7df873a5b39 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image/product-gallery-large-image.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-large-image/product-gallery-large-image.block_theme.side_effects.spec.ts @@ -31,12 +31,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( { } ); test.describe( `${ blockData.name }`, () => { - test.beforeEach( async ( { admin, editorUtils, editor } ) => { + test.beforeEach( async ( { admin, editor } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ blockData.slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.openDocumentSettingsSidebar(); } ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-pager/product-gallery-pager.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-pager/product-gallery-pager.block_theme.side_effects.spec.ts index 746cca37d22..c02d64c762e 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-pager/product-gallery-pager.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-pager/product-gallery-pager.block_theme.side_effects.spec.ts @@ -44,12 +44,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( { } ); test.describe( `${ blockData.name }`, () => { - test.beforeEach( async ( { admin, editorUtils, editor } ) => { + test.beforeEach( async ( { admin, editor } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ blockData.slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.openDocumentSettingsSidebar(); } ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.side_effects.spec.ts index d4cecaf76a8..26e1537e8d5 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/product-gallery-thumbnails.block_theme.side_effects.spec.ts @@ -48,12 +48,12 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( { }, } ); test.describe( `${ blockData.name }`, () => { - test.beforeEach( async ( { admin, editorUtils } ) => { + test.beforeEach( async ( { admin } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ blockData.slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); } ); test( 'Renders Product Gallery Thumbnails block on the editor and frontend side', async ( { diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/utils.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/utils.ts index b36ae591a46..a81d0634531 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/utils.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/inner-blocks/product-gallery-thumbnails/utils.ts @@ -1,24 +1,17 @@ /** * External dependencies */ -import { EditorUtils } from '@woocommerce/e2e-utils'; import { Admin, Editor } from '@wordpress/e2e-test-utils-playwright'; // Define a utility function to add the "woocommerce/product-gallery" block to the editor -export const addBlock = async ( - admin: Admin, - editor: Editor, - editorUtils: EditorUtils -) => { +export const addBlock = async ( admin: Admin, editor: Editor ) => { // Visit the site editor for the specific product page await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//single-product`, postType: 'wp_template', + canvas: 'edit', } ); - // Enter the edit mode - await editorUtils.enterEditMode(); - // Insert the "woocommerce/product-gallery" block await editor.insertBlock( { name: 'woocommerce/product-gallery', diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.side_effects.spec.ts index 2ff960b88d2..bf6e32eb599 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/product-gallery/product-gallery.block_theme.side_effects.spec.ts @@ -83,12 +83,12 @@ const getThumbnailImageIdByNth = async ( }; test.describe( `${ blockData.name }`, () => { - test.beforeEach( async ( { admin, editorUtils } ) => { + test.beforeEach( async ( { admin } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//${ blockData.slug }`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); } ); test.describe( 'with thumbnails', () => { @@ -532,8 +532,8 @@ test.describe( `${ blockData.name }`, () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//product-gallery`, postType: 'wp_template_part', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editorUtils.openGlobalBlockInserter(); await page.getByRole( 'tab', { name: 'Blocks' } ).click(); const productGalleryBlockOption = page diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/related-products/related-products.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/related-products/related-products.block_theme.spec.ts index c3223ee8191..61b7afed2af 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/related-products/related-products.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/related-products/related-products.block_theme.spec.ts @@ -32,13 +32,12 @@ test.describe( `${ blockData.name } Block`, () => { test( "can't be added in the Post Editor - Product Catalog Template", async ( { admin, editor, - editorUtils, } ) => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//archive-product`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); try { await editor.insertBlock( { name: blockData.slug } ); @@ -55,8 +54,8 @@ test.describe( `${ blockData.name } Block`, () => { await admin.visitSiteEditor( { postId: `woocommerce/woocommerce//single-product`, postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.setContent( '' ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/templates/cart-template.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/templates/cart-template.block_theme.spec.ts index 739aa1c519b..0e86cf92ca1 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/templates/cart-template.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/templates/cart-template.block_theme.spec.ts @@ -11,13 +11,12 @@ test.describe( 'Test the cart template', async () => { test( 'Template can be opened in the site editor', async ( { admin, page, - editorUtils, } ) => { await admin.visitSiteEditor( { postId: templatePath, postType: templateType, + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await expect( page .frameLocator( 'iframe[title="Editor canvas"i]' ) @@ -37,7 +36,6 @@ test.describe( 'Test the cart template', async () => { .getByRole( 'button', { name: 'Cart', exact: true } ) .click(); await editorUtils.enterEditMode(); - await expect( editor.canvas.locator( 'h1:has-text("Cart")' ).first() ).toBeVisible(); @@ -66,14 +64,13 @@ test.describe( 'Test the cart template', async () => { test.describe( 'Test editing the cart template', async () => { test( 'Merchant can transform shortcode block into blocks', async ( { admin, - editorUtils, editor, } ) => { await admin.visitSiteEditor( { postId: templatePath, postType: templateType, + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.setContent( '' ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts index 55f074cc8ef..46cbc42e083 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts @@ -11,13 +11,12 @@ test.describe( 'Test the checkout template', async () => { test( 'Template can be opened in the site editor', async ( { admin, page, - editorUtils, } ) => { await admin.visitSiteEditor( { postId: templatePath, postType: templateType, + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await expect( page .frameLocator( 'iframe[title="Editor canvas"i]' ) @@ -75,14 +74,13 @@ test.describe( 'Test the checkout template', async () => { test.describe( 'Test editing the checkout template', async () => { test( 'Merchant can transform shortcode block into blocks', async ( { admin, - editorUtils, editor, } ) => { await admin.visitSiteEditor( { postId: templatePath, postType: templateType, + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editor.setContent( '' ); diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/templates/order-confirmation.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/templates/order-confirmation.block_theme.spec.ts index 4adef316079..26b04767936 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/templates/order-confirmation.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/templates/order-confirmation.block_theme.spec.ts @@ -12,8 +12,8 @@ test.describe( 'Test the order confirmation template', async () => { await admin.visitSiteEditor( { postId: 'woocommerce/woocommerce//order-confirmation', postType: 'wp_template', + canvas: 'edit', } ); - await editorUtils.enterEditMode(); await editorUtils.transformIntoBlocks(); await expect( page diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/templates/template-customization.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/templates/template-customization.block_theme.side_effects.spec.ts index aac0dc9b4dd..8b19e9a45a8 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/templates/template-customization.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/templates/template-customization.block_theme.side_effects.spec.ts @@ -48,9 +48,8 @@ for ( const testData of testToRun ) { await admin.visitSiteEditor( { postId: `${ BLOCK_THEME_WITH_TEMPLATES_SLUG }//${ testData.templatePath }`, postType: testData.templateType, + canvas: 'edit', } ); - await editorUtils.enterEditMode(); - await editorUtils.waitForSiteEditorFinishLoading(); await editorUtils.editor.insertBlock( { name: 'core/paragraph', attributes: { content: userText },