From f028d728facbde937226313f95db23f69d30122a Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Fri, 17 Sep 2021 13:55:29 -0300 Subject: [PATCH] allow CBD to be optional in business details in E2E (https://github.com/woocommerce/woocommerce-admin/pull/7675) --- .../src/sections/onboarding/IndustrySection.ts | 10 ++++++++-- .../activate-and-setup/complete-onboarding-wizard.ts | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce-admin/packages/admin-e2e-tests/src/sections/onboarding/IndustrySection.ts b/plugins/woocommerce-admin/packages/admin-e2e-tests/src/sections/onboarding/IndustrySection.ts index dc5e4d96a1b..6a82d7eb7d5 100644 --- a/plugins/woocommerce-admin/packages/admin-e2e-tests/src/sections/onboarding/IndustrySection.ts +++ b/plugins/woocommerce-admin/packages/admin-e2e-tests/src/sections/onboarding/IndustrySection.ts @@ -5,7 +5,7 @@ import { BasePage } from '../../pages/BasePage'; import { waitForElementByText } from '../../utils/actions'; export class IndustrySection extends BasePage { - async isDisplayed( industryCount?: number ) { + async isDisplayed( industryCount?: number, industryCountMax?: number ) { await waitForElementByText( 'h2', 'In which industry does the store operate?' @@ -17,7 +17,13 @@ export class IndustrySection extends BasePage { ( items ) => items.length ); - expect( length === industryCount ).toBeTruthy(); + if ( industryCountMax ) { + expect( + length >= industryCount && length <= industryCountMax + ).toBeTruthy(); + } else { + expect( length === industryCount ).toBeTruthy(); + } } } diff --git a/plugins/woocommerce-admin/packages/admin-e2e-tests/src/specs/activate-and-setup/complete-onboarding-wizard.ts b/plugins/woocommerce-admin/packages/admin-e2e-tests/src/specs/activate-and-setup/complete-onboarding-wizard.ts index 7705beb8705..d6e0062ba9b 100644 --- a/plugins/woocommerce-admin/packages/admin-e2e-tests/src/specs/activate-and-setup/complete-onboarding-wizard.ts +++ b/plugins/woocommerce-admin/packages/admin-e2e-tests/src/specs/activate-and-setup/complete-onboarding-wizard.ts @@ -48,7 +48,7 @@ const testAdminOnboardingWizard = () => { it( 'can complete the industry section', async () => { // Query for the industries checkboxes - await profileWizard.industry.isDisplayed( 8 ); + await profileWizard.industry.isDisplayed( 7, 8 ); await profileWizard.industry.uncheckIndustries(); // Select just "fashion" and "health/beauty" to get the single checkbox business section when