From 696d5646cd6ab93ddf32468a8af7449332f01c17 Mon Sep 17 00:00:00 2001 From: DustyReagan Date: Fri, 17 May 2024 17:10:35 -0500 Subject: [PATCH 1/2] Try fix flakey test --- ...ecycle__signup-onboarding-launch-cancel.ts | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts b/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts index 0f290d318e829..4279be4ca12af 100644 --- a/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts +++ b/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts @@ -84,7 +84,16 @@ describe( 'Lifecyle: Signup, onboard, launch and cancel subscription', function it( 'See secure payment', async function () { cartCheckoutPage = new CartCheckoutPage( page ); - await cartCheckoutPage.validateCartItem( `WordPress.com ${ newPlanName }` ); + try { + await Promise.any( [ + cartCheckoutPage.validateCartItem( 'WordPress.com Beginner' ), + cartCheckoutPage.validateCartItem( `WordPress.com ${ newPlanName }` ), + ] ); + } catch ( error ) { + // If both promises are rejected, handle the error (optional) + console.log( `Neither "Beginner" or "Starter" were found on the page.` ); + throw error; // Re-throw the error to fail the test + } } ); it( 'Prices are shown in GBP', async function () { @@ -231,11 +240,22 @@ describe( 'Lifecyle: Signup, onboard, launch and cancel subscription', function it( 'View details of purchased plan', async function () { purchasesPage = new PurchasesPage( page ); - await purchasesPage.clickOnPurchase( - `WordPress.com ${ newPlanName }`, - newSiteDetails.blog_details.site_slug - ); - await purchasesPage.purchaseAction( 'Cancel plan' ); + try { + await Promise.any( [ + purchasesPage.clickOnPurchase( + 'WordPress.com Beginner', + newSiteDetails.blog_details.site_slug + ), + purchasesPage.clickOnPurchase( + `WordPress.com ${ newPlanName }`, + newSiteDetails.blog_details.site_slug + ), + ] ); + await purchasesPage.purchaseAction( 'Cancel plan' ); + } catch ( error ) { + console.log( `Neither "Beginner" nor "Starter" plan was found.` ); + throw error; + } } ); it( 'Cancel plan renewal', async function () { From 9cfea94f253fc5dc19897c2dabd2a93ec2937e55 Mon Sep 17 00:00:00 2001 From: DustyReagan Date: Fri, 17 May 2024 17:33:37 -0500 Subject: [PATCH 2/2] Update comments --- .../onboarding/lifecycle__signup-onboarding-launch-cancel.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts b/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts index 4279be4ca12af..7d5ff95c30247 100644 --- a/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts +++ b/test/e2e/specs/onboarding/lifecycle__signup-onboarding-launch-cancel.ts @@ -85,14 +85,14 @@ describe( 'Lifecyle: Signup, onboard, launch and cancel subscription', function it( 'See secure payment', async function () { cartCheckoutPage = new CartCheckoutPage( page ); try { + // Check for either the "Beginner" or "Starter" plan while the name change experiment is in progress. await Promise.any( [ cartCheckoutPage.validateCartItem( 'WordPress.com Beginner' ), cartCheckoutPage.validateCartItem( `WordPress.com ${ newPlanName }` ), ] ); } catch ( error ) { - // If both promises are rejected, handle the error (optional) console.log( `Neither "Beginner" or "Starter" were found on the page.` ); - throw error; // Re-throw the error to fail the test + throw error; } } ); @@ -241,6 +241,7 @@ describe( 'Lifecyle: Signup, onboard, launch and cancel subscription', function purchasesPage = new PurchasesPage( page ); try { + // Check for either the "Beginner" or "Starter" plan while the name change experiment is in progress. await Promise.any( [ purchasesPage.clickOnPurchase( 'WordPress.com Beginner',