Skip to content

Commit 0b4605e

Browse files
tpaksuJinksi
andauthored
Port merchant subscription settings spec to Playwright (#10155)
Co-authored-by: Eric Jinks <[email protected]>
1 parent a904341 commit 0b4605e

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: dev
3+
4+
Migrate merchant subscription settings spec to Playwright
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import test, { expect } from 'playwright/test';
5+
import { describeif, useMerchant } from '../../utils/helpers';
6+
import { shouldRunSubscriptionsTests } from '../../utils/constants';
7+
import { goToWooCommerceSettings } from '../../utils/merchant-navigation';
8+
9+
describeif( shouldRunSubscriptionsTests )(
10+
'WooCommerce > Settings > Subscriptions',
11+
() => {
12+
useMerchant();
13+
test( 'Merchant should be able to load WooCommerce Subscriptions settings tab', async ( {
14+
page,
15+
} ) => {
16+
await goToWooCommerceSettings( page, 'subscriptions' );
17+
const menuItem = page.getByRole( 'main' ).getByRole( 'link', {
18+
name: 'Subscriptions',
19+
exact: true,
20+
} );
21+
await expect( menuItem ).toBeVisible();
22+
23+
// An alternative way to verify the subscriptions menu page is active, avoiding the active tab classname.
24+
const heading = await page.getByRole( 'heading', {
25+
name: 'Subscriptions',
26+
} );
27+
await expect( heading ).toBeVisible();
28+
} );
29+
}
30+
);

tests/e2e-pw/utils/merchant-navigation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export const goToWooPaymentsSettings = async ( page: Page ) => {
2323
);
2424
};
2525

26+
export const goToWooCommerceSettings = async ( page: Page, tab?: string ) => {
27+
await page.goto(
28+
'/wp-admin/admin.php?page=wc-settings' + ( tab ? '&tab=' + tab : '' )
29+
);
30+
};
31+
2632
export const goToOptionsPage = async ( page: Page ) => {
2733
await page.goto( '/wp-admin/options.php', {
2834
waitUntil: 'load',

tests/e2e/specs/subscriptions/merchant/merchant-subscriptions-settings.spec.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)