Skip to content

Commit

Permalink
Merge branch 'dev/10238-update-e2e-tests-all-workflow' of https://git…
Browse files Browse the repository at this point in the history
…hub.com/Automattic/woocommerce-payments into dev/10238-update-e2e-tests-all-workflow
  • Loading branch information
eduardoumpierre committed Feb 3, 2025
2 parents 232ca49 + 4443a72 commit 55708e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 ( {
Expand Down Expand Up @@ -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();
} );
}
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e-pw/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ export const products = {
SUBSCRIPTION_SIGNUP_FEE: 70,
SUBSCRIPTION_NO_SIGNUP_FEE: 88,
};

export const wooCoreVersion = process.env.E2E_WC_VERSION;
14 changes: 12 additions & 2 deletions tests/e2e-pw/utils/merchant-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }`,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 55708e7

Please sign in to comment.