From a0b09c0b45ec9f4a4e42fffd6d1bd7133dfb50a5 Mon Sep 17 00:00:00 2001 From: Luigi Date: Wed, 25 Oct 2023 15:50:08 +0200 Subject: [PATCH 01/11] run E2E test suite on WordPress 6.4 --- .wp-env.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.wp-env.json b/.wp-env.json index d290c174e0d..5bc8bf748d8 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,5 +1,5 @@ { - "core": null, + "core": "https://wordpress.org/wordpress-6.4-RC2.zip", "plugins": [ "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", "https://github.com/WP-API/Basic-Auth/archive/master.zip", From fb1ad41139010fadbc0a5c7267b3840398c1d4de Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Tue, 31 Oct 2023 18:29:20 +0100 Subject: [PATCH 02/11] Fix failing E2E tests --- .../cart-template.block_theme.spec.ts | 18 ++++++++++++------ .../checkout-template.block_theme.spec.ts | 2 +- tests/e2e/utils/editor/editor-utils.page.ts | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts index b713f3cdc3b..be8abeaa2e2 100644 --- a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts @@ -21,7 +21,7 @@ test.describe( 'Test the cart template', async () => { await expect( page .frameLocator( 'iframe[title="Editor canvas"i]' ) - .locator( 'h2:has-text("Cart")' ) + .locator( 'h1:has-text("Cart")' ) .first() ).toBeVisible(); } ); @@ -35,15 +35,18 @@ test.describe( 'Test the cart template', async () => { await admin.visitAdminPage( 'site-editor.php' ); await editorUtils.waitForSiteEditorFinishLoading(); await editor.page.getByRole( 'button', { name: /Pages/i } ).click(); - await editor.page.getByRole( 'button', { name: /Cart/i } ).click(); + await editor.page + .getByRole( 'button', { name: 'Cart block', exact: true } ) + .click(); await editorUtils.enterEditMode(); + await editorUtils.closeWelcomeGuideModal(); await expect( - editor.canvas.locator( 'h2:has-text("Cart")' ).first() + editor.canvas.locator( 'h1:has-text("Cart")' ).first() ).toBeVisible(); await editor.openDocumentSettingsSidebar(); await page.getByRole( 'button', { name: 'Edit template' } ).click(); await expect( - editor.canvas.locator( 'h2:has-text("Cart")' ).first() + editor.canvas.locator( 'h1:has-text("Cart")' ).first() ).toBeVisible(); } ); @@ -53,7 +56,7 @@ test.describe( 'Test the cart template', async () => { await expect( admin.page .frameLocator( 'iframe[title="Editor canvas"i]' ) - .locator( 'h2:has-text("Cart")' ) + .locator( 'h1:has-text("Cart")' ) .first() ).toBeVisible(); } ); @@ -85,9 +88,12 @@ test.describe( 'Test editing the cart template', async () => { await editor.canvas .getByRole( 'button', { name: 'Transform into blocks' } ) .click(); + await editor.canvas.waitForSelector( + 'button:has-text("Proceed to Checkout")' + ); await expect( editor.canvas - .locator( 'button:has-text("Proceed to checkout")' ) + .locator( 'button:has-text("Proceed to Checkout")' ) .first() ).toBeVisible(); } ); diff --git a/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts b/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts index 32890422726..65aecece8ed 100644 --- a/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts @@ -21,7 +21,7 @@ test.describe( 'Test the checkout template', async () => { await expect( page .frameLocator( 'iframe[title="Editor canvas"i]' ) - .locator( 'h1:has-text("Checkout")' ) + .locator( 'h1:has-text("Checkout block")' ) .first() ).toBeVisible(); } ); diff --git a/tests/e2e/utils/editor/editor-utils.page.ts b/tests/e2e/utils/editor/editor-utils.page.ts index 355d933dd28..10da5edb611 100644 --- a/tests/e2e/utils/editor/editor-utils.page.ts +++ b/tests/e2e/utils/editor/editor-utils.page.ts @@ -272,12 +272,26 @@ export class EditorUtils { .nth( 2 ) .isVisible(); + const isModalEditingPageOpen = await this.page + .getByRole( 'dialog', { name: 'Editing a page' } ) + .locator( 'div' ) + .filter( { + hasText: + 'Editing a pageIt’s now possible to edit page content in the site editor.', + } ) + .nth( 2 ) + .isVisible(); + // eslint-disable-next-line playwright/no-conditional-in-test if ( isModalOpen ) { await this.page .getByRole( 'button', { name: 'Get started' } ) .click(); } + + if ( isModalEditingPageOpen ) { + await this.page.getByRole( 'button', { name: 'Continue' } ).click(); + } } async transformIntoBlocks() { From d1104441d6ebe6307f093060564882cb2f09905e Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Wed, 1 Nov 2023 07:00:53 +0100 Subject: [PATCH 03/11] Fix failing E2E tests due to UI change --- .../tests/templates/cart-template.block_theme.spec.ts | 11 +++++++++-- .../templates/checkout-template.block_theme.spec.ts | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts index be8abeaa2e2..8b3ed309eb1 100644 --- a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts @@ -43,8 +43,15 @@ test.describe( 'Test the cart template', async () => { await expect( editor.canvas.locator( 'h1:has-text("Cart")' ).first() ).toBeVisible(); - await editor.openDocumentSettingsSidebar(); - await page.getByRole( 'button', { name: 'Edit template' } ).click(); + await page + .getByRole( 'region', { name: 'Editor top bar' } ) + .locator( 'button' ) + .filter( { hasText: 'Cart block' } ) + .click(); + await page + .getByRole( 'option', { name: 'Edit template: Pages' } ) + .locator( 'div' ) + .click(); await expect( editor.canvas.locator( 'h1:has-text("Cart")' ).first() ).toBeVisible(); diff --git a/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts b/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts index 65aecece8ed..8dbb4098a1f 100644 --- a/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts @@ -40,8 +40,15 @@ test.describe( 'Test the checkout template', async () => { await expect( editor.canvas.locator( 'h1:has-text("Checkout")' ).first() ).toBeVisible(); - await editor.openDocumentSettingsSidebar(); - await page.getByRole( 'button', { name: 'Edit template' } ).click(); + await page + .getByRole( 'region', { name: 'Editor top bar' } ) + .locator( 'button' ) + .filter( { hasText: 'Cart block' } ) + .click(); + await page + .getByRole( 'option', { name: 'Edit template: Pages' } ) + .locator( 'div' ) + .click(); await expect( editor.canvas.locator( 'h1:has-text("Checkout")' ).first() ).toBeVisible(); From 63462e82d43d5cd38c112e4d4c09cfb701f5a23e Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Mon, 6 Nov 2023 22:56:16 +0100 Subject: [PATCH 04/11] Fix failing E2E test: fails to transform into blocks --- tests/e2e/utils/editor/editor-utils.page.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/e2e/utils/editor/editor-utils.page.ts b/tests/e2e/utils/editor/editor-utils.page.ts index 10da5edb611..1344c912cf4 100644 --- a/tests/e2e/utils/editor/editor-utils.page.ts +++ b/tests/e2e/utils/editor/editor-utils.page.ts @@ -295,21 +295,14 @@ export class EditorUtils { } async transformIntoBlocks() { - const isNotTransformedIntoBlocks = await this.page - .frameLocator( 'iframe[name="editor-canvas"]' ) + const isNotTransformedIntoBlocks = await this.editor.canvas .getByRole( 'button', { name: 'Transform into blocks' } ) .count(); if ( isNotTransformedIntoBlocks ) { - await this.page - .frameLocator( 'iframe[name="editor-canvas"]' ) - .getByRole( 'group' ) - .click(); - await this.page - .frameLocator( 'iframe[name="editor-canvas"]' ) + await this.editor.canvas .getByRole( 'button', { name: 'Transform into blocks' } ) .click(); - // save changes await this.saveSiteEditorEntities(); } From 0b0bdf2d50642405e0241bb9fbc5e020fe13bc9f Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Tue, 7 Nov 2023 00:21:50 +0100 Subject: [PATCH 05/11] Temporarily skip test to run the Normal Playwright tests --- .../checkout-block-shipping.block_theme.side_effects.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts b/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts index 38570ab27e2..710926aa5e4 100644 --- a/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts +++ b/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts @@ -27,7 +27,9 @@ test.describe( 'Shopper → Checkout block → Shipping', () => { storageState: process.env.CUSTOMERSTATE, } ); - test( 'Shopper can choose free shipping, flat rate shipping, and can have different billing and shipping addresses', async ( { + // Unskip this test before merging the PR + // eslint-disable-next-line playwright/no-skipped-test + test.skip( 'Shopper can choose free shipping, flat rate shipping, and can have different billing and shipping addresses', async ( { pageObject, frontendUtils, page, From 9d688149e1368fd421602d7744c01fa992accc28 Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Tue, 7 Nov 2023 01:42:07 +0100 Subject: [PATCH 06/11] Fix failing E2E test: Cart title not found --- .../e2e/tests/templates/cart-template.block_theme.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts index 8b3ed309eb1..0a04c042ce5 100644 --- a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts @@ -12,17 +12,17 @@ test.describe( 'Test the cart template', async () => { admin, page, editorUtils, + editor, } ) => { await admin.visitAdminPage( 'site-editor.php' ); await editorUtils.waitForSiteEditorFinishLoading(); await page.getByRole( 'button', { name: /Templates/i } ).click(); await page.getByRole( 'button', { name: /Page: Cart/i } ).click(); await editorUtils.enterEditMode(); + await editorUtils.closeWelcomeGuideModal(); + await editor.canvas.waitForSelector( 'h1:has-text("Cart block")' ); await expect( - page - .frameLocator( 'iframe[title="Editor canvas"i]' ) - .locator( 'h1:has-text("Cart")' ) - .first() + editor.canvas.locator( 'h1:has-text("Cart block")' ).first() ).toBeVisible(); } ); From 5e03c5fcd715c2e900993d6746e7980898602eac Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Tue, 7 Nov 2023 01:58:59 +0100 Subject: [PATCH 07/11] Fix E2E test: Cart title not found (Admin bar) --- .../templates/cart-template.block_theme.spec.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts index 0a04c042ce5..adaaef94aee 100644 --- a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts @@ -57,14 +57,19 @@ test.describe( 'Test the cart template', async () => { ).toBeVisible(); } ); - test( 'Admin bar edit site link opens site editor', async ( { admin } ) => { + test( 'Admin bar edit site link opens site editor', async ( { + admin, + editor, + editorUtils, + } ) => { await admin.page.goto( permalink, { waitUntil: 'load' } ); await admin.page.locator( '#wp-admin-bar-site-editor a' ).click(); + await editorUtils.enterEditMode(); + await editorUtils.closeWelcomeGuideModal(); + await editorUtils.waitForSiteEditorFinishLoading(); + await editor.canvas.waitForSelector( 'h1:has-text("Cart block")' ); await expect( - admin.page - .frameLocator( 'iframe[title="Editor canvas"i]' ) - .locator( 'h1:has-text("Cart")' ) - .first() + editor.canvas.locator( 'h1:has-text("Cart block")' ).first() ).toBeVisible(); } ); } ); From 596d23e096a19b757d7c7612ac6043969664dc72 Mon Sep 17 00:00:00 2001 From: Luigi Date: Tue, 7 Nov 2023 08:32:24 +0100 Subject: [PATCH 08/11] run all the E2E jobs even if one matrix fail --- .github/workflows/playwright.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 90202ccab89..a3ec4ba30ee 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -10,6 +10,7 @@ jobs: name: Playwright E2E tests - ${{ matrix.config.name }} timeout-minutes: 60 runs-on: ubuntu-latest + continue-on-error: true strategy: matrix: config: [ From 809c864e605bef462f9cc9831669b65281d92e75 Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Wed, 8 Nov 2023 08:38:57 +0100 Subject: [PATCH 09/11] Unskip test as it was fixed on trunk --- .../checkout-block-shipping.block_theme.side_effects.spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts b/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts index 710926aa5e4..38570ab27e2 100644 --- a/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts +++ b/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts @@ -27,9 +27,7 @@ test.describe( 'Shopper → Checkout block → Shipping', () => { storageState: process.env.CUSTOMERSTATE, } ); - // Unskip this test before merging the PR - // eslint-disable-next-line playwright/no-skipped-test - test.skip( 'Shopper can choose free shipping, flat rate shipping, and can have different billing and shipping addresses', async ( { + test( 'Shopper can choose free shipping, flat rate shipping, and can have different billing and shipping addresses', async ( { pageObject, frontendUtils, page, From e5b26f6812a393991f995a85e11f41a0b8c0cf22 Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Wed, 8 Nov 2023 15:10:54 +0100 Subject: [PATCH 10/11] Skip tests related to the issue in #11671 --- tests/e2e/tests/templates/cart-template.block_theme.spec.ts | 4 +++- .../e2e/tests/templates/checkout-template.block_theme.spec.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts index adaaef94aee..08235c84164 100644 --- a/tests/e2e/tests/templates/cart-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/cart-template.block_theme.spec.ts @@ -26,7 +26,9 @@ test.describe( 'Test the cart template', async () => { ).toBeVisible(); } ); - test( 'Template can be accessed from the page editor', async ( { + // Remove the skip once this ticket is resolved: https://github.com/woocommerce/woocommerce-blocks/issues/11671 + // eslint-disable-next-line playwright/no-skipped-test + test.skip( 'Template can be accessed from the page editor', async ( { admin, editor, page, diff --git a/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts b/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts index 8dbb4098a1f..f87269bc9db 100644 --- a/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts +++ b/tests/e2e/tests/templates/checkout-template.block_theme.spec.ts @@ -26,7 +26,9 @@ test.describe( 'Test the checkout template', async () => { ).toBeVisible(); } ); - test( 'Template can be accessed from the page editor', async ( { + // Remove the skip once this ticket is resolved: https://github.com/woocommerce/woocommerce-blocks/issues/11671 + // eslint-disable-next-line playwright/no-skipped-test + test.skip( 'Template can be accessed from the page editor', async ( { admin, editor, page, From c4d38ae7b0c07801b101290133fe3676bf219993 Mon Sep 17 00:00:00 2001 From: Saad Tarhi Date: Wed, 8 Nov 2023 15:12:09 +0100 Subject: [PATCH 11/11] Remove "core" version (WP 6.4 is released) --- .wp-env.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.wp-env.json b/.wp-env.json index 5bc8bf748d8..d290c174e0d 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,5 +1,5 @@ { - "core": "https://wordpress.org/wordpress-6.4-RC2.zip", + "core": null, "plugins": [ "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", "https://github.com/WP-API/Basic-Auth/archive/master.zip",