diff --git a/packages/js/e2e-core-tests/specs/merchant/wp-admin-product-new.test.js b/packages/js/e2e-core-tests/specs/merchant/wp-admin-product-new.test.js index 5a0cc7a9c00..7375af3586e 100644 --- a/packages/js/e2e-core-tests/specs/merchant/wp-admin-product-new.test.js +++ b/packages/js/e2e-core-tests/specs/merchant/wp-admin-product-new.test.js @@ -273,9 +273,6 @@ const runAddVariableProductTest = () => { await expect( page ).toClick( 'button.save-variation-changes', { text: 'Save changes', } ); - - // Wait for attribute form to save (triggers 2 UI blocks) - await uiUnblocked(); await uiUnblocked(); // Verify that attribute values were saved. @@ -376,6 +373,9 @@ const runAddVariableProductTest = () => { } ); await uiUnblocked(); + // Publish product. + await verifyAndPublish(); + // Navigate to the product URL await page.goto( permalink, { waitUntil: 'networkidle0' } ); @@ -389,10 +389,29 @@ const runAddVariableProductTest = () => { // Navigate back to Product page await page.goBack( { waitUntil: 'networkidle0' } ); + await waitForSelector( page, '.variations_tab' ); + await waitAndClick( page, '.variations_tab a' ); + await waitForSelector( + page, + 'select.variation_actions:not(:disabled)' + ); } ); it( 'can remove a variation', async () => { - // mytodo + // Click 'Remove' and confirm + const confirmDialog = await expect( page ).toDisplayDialog( + async () => { + await expect( page ).toClick( '.remove_variation.delete' ); + } + ); + await expect( confirmDialog.message() ).toMatch( + 'Are you sure you want to remove this variation?' + ); + await uiUnblocked(); + + // Verify that no variations were displayed. + const variationsCount = await page.$$( '.woocommerce_variation' ); + expect( variationsCount ).toHaveLength( 0 ); } ); }); };