From c656fdc59b31e156d73c446503d49c20de409780 Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:02:58 +0100 Subject: [PATCH] [e2e tests] Clean up created test products in product edit tests (#51112) --- .../e2e-cleanup-created-products-in-prduct-edit-tests | 4 ++++ .../tests/e2e-pw/tests/merchant/product-edit.spec.js | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 plugins/woocommerce/changelog/e2e-cleanup-created-products-in-prduct-edit-tests diff --git a/plugins/woocommerce/changelog/e2e-cleanup-created-products-in-prduct-edit-tests b/plugins/woocommerce/changelog/e2e-cleanup-created-products-in-prduct-edit-tests new file mode 100644 index 00000000000..4f73f5cc6c2 --- /dev/null +++ b/plugins/woocommerce/changelog/e2e-cleanup-created-products-in-prduct-edit-tests @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + + diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/product-edit.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/product-edit.spec.js index e94595088b6..9c67ba6d340 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/product-edit.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/product-edit.spec.js @@ -67,7 +67,10 @@ test( } ); await test.step( 'publish the updated product', async () => { - await page.getByRole( 'button', { name: 'Update' } ).click(); + await page + .locator( '#publishing-action' ) + .getByRole( 'button', { name: 'Update' } ) + .click(); } ); await test.step( 'verify the changes', async () => { @@ -276,7 +279,7 @@ test( .toBe( 0 ); await expect - .soft( await page.locator( 'bdi' ).first() ) + .soft( page.locator( 'bdi' ).first() ) .toContainText( expectedRegularPrice ); } } ); @@ -340,7 +343,7 @@ test( test( 'increasing the sale price from 0 does not change the sale price when bulk editing products', { tag: [ '@gutenberg', '@services' ] }, - async ( { page, api } ) => { + async ( { page, api, products } ) => { let product; await api .post( 'products', { @@ -355,6 +358,8 @@ test( } ) .then( ( response ) => { product = response.data; + // For cleanup: products from this list are deleted in the fixture + products.push( product ); } ); const salePriceIncrease = 10;