Skip to content

Commit

Permalink
Port merchant subscription settings spec to Playwright (#10155)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Jinks <[email protected]>
  • Loading branch information
tpaksu and Jinksi authored Jan 16, 2025
1 parent a904341 commit 0b4605e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Migrate merchant subscription settings spec to Playwright
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* External dependencies
*/
import test, { expect } from 'playwright/test';
import { describeif, useMerchant } from '../../utils/helpers';
import { shouldRunSubscriptionsTests } from '../../utils/constants';
import { goToWooCommerceSettings } from '../../utils/merchant-navigation';

describeif( shouldRunSubscriptionsTests )(
'WooCommerce > Settings > Subscriptions',
() => {
useMerchant();
test( 'Merchant should be able to load WooCommerce Subscriptions settings tab', async ( {
page,
} ) => {
await goToWooCommerceSettings( page, 'subscriptions' );
const menuItem = page.getByRole( 'main' ).getByRole( 'link', {
name: 'Subscriptions',
exact: true,
} );
await expect( menuItem ).toBeVisible();

// An alternative way to verify the subscriptions menu page is active, avoiding the active tab classname.
const heading = await page.getByRole( 'heading', {
name: 'Subscriptions',
} );
await expect( heading ).toBeVisible();
} );
}
);
6 changes: 6 additions & 0 deletions tests/e2e-pw/utils/merchant-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export const goToWooPaymentsSettings = async ( page: Page ) => {
);
};

export const goToWooCommerceSettings = async ( page: Page, tab?: string ) => {
await page.goto(
'/wp-admin/admin.php?page=wc-settings' + ( tab ? '&tab=' + tab : '' )
);
};

export const goToOptionsPage = async ( page: Page ) => {
await page.goto( '/wp-admin/options.php', {
waitUntil: 'load',
Expand Down

This file was deleted.

0 comments on commit 0b4605e

Please sign in to comment.