diff --git a/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts index 37c9c4f2ef5..380f8014393 100644 --- a/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts +++ b/tests/e2e-pw/specs/subscriptions/merchant/merchant-subscriptions-renew-action-scheduler.spec.ts @@ -29,8 +29,6 @@ describeif( shouldRunSubscriptionsTests && shouldRunActionSchedulerTests )( const customerBillingConfig = config.addresses[ 'subscriptions-customer' ].billing; - let subscriptionId: string; - test.beforeAll( async ( { browser }, { project } ) => { const { shopperPage } = await getShopper( browser, @@ -48,10 +46,6 @@ describeif( shouldRunSubscriptionsTests && shouldRunActionSchedulerTests )( await expect( shopperPage.getByRole( 'heading', { name: 'Order received' } ) ).toBeVisible(); - - subscriptionId = await shopperPage - .getByLabel( 'View subscription number' ) - .innerText(); } ); test( 'should renew a subscription with action scheduler', async ( { @@ -81,12 +75,8 @@ describeif( shouldRunSubscriptionsTests && shouldRunActionSchedulerTests )( // Go to Subscriptions and verify the subscription renewal await goToSubscriptions( merchantPage ); - const numericSubscriptionId = subscriptionId.substring( 1 ); - await expect( - merchantPage - .locator( `#order-${ numericSubscriptionId }` ) - .getByRole( 'cell', { name: '2', exact: true } ) + merchantPage.getByRole( 'cell', { name: '2', exact: true } ) ).toBeVisible(); } ); } diff --git a/tests/e2e-pw/utils/constants.ts b/tests/e2e-pw/utils/constants.ts index f223b1fd078..ec274824acb 100644 --- a/tests/e2e-pw/utils/constants.ts +++ b/tests/e2e-pw/utils/constants.ts @@ -10,3 +10,5 @@ export const products = { SUBSCRIPTION_SIGNUP_FEE: 70, SUBSCRIPTION_NO_SIGNUP_FEE: 88, }; + +export const wooCoreVersion = process.env.E2E_WC_VERSION; diff --git a/tests/e2e-pw/utils/merchant-navigation.ts b/tests/e2e-pw/utils/merchant-navigation.ts index d258e5d09e4..7b74533016a 100644 --- a/tests/e2e-pw/utils/merchant-navigation.ts +++ b/tests/e2e-pw/utils/merchant-navigation.ts @@ -4,6 +4,11 @@ import { Page } from 'playwright/test'; import { dataHasLoaded } from './merchant'; +/** + * Internal dependencies + */ +import { wooCoreVersion } from './constants'; + export const goToOrder = async ( page: Page, orderId: string ) => { await page.goto( `/wp-admin/admin.php?page=wc-orders&action=edit&id=${ orderId }`, @@ -114,10 +119,15 @@ export const goToConnect = async ( page: Page ) => { await dataHasLoaded( page ); }; -export const goToSubscriptions = async ( page: Page ) => - await page.goto( '/wp-admin/admin.php?page=wc-orders--shop_subscription', { +export const goToSubscriptions = async ( page: Page ) => { + const subscriptionsUrl = + wooCoreVersion === '7.7.0' + ? '/wp-admin/edit.php?post_type=shop_subscription' + : '/wp-admin/admin.php?page=wc-orders--shop_subscription'; + await page.goto( subscriptionsUrl, { waitUntil: 'load', } ); +}; export const goToSubscriptionPage = async ( page: Page,