Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E Playwright Migration: convert merchant-subscriptions-renew-action-scheduler spec #10143

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/e2e-pw/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export const config = {
},
'subscriptions-customer': {
billing: {
first_name: 'I am',
last_name: 'Subscriptions Customer',
firstname: 'I am',
lastname: 'Subscriptions Customer',
company: 'Automattic',
country: 'United States (US)',
address_1: '60 29th Street #343',
address_2: 'billing',
addressfirstline: '60 29th Street #343',
addresssecondline: 'billing',
city: 'San Francisco',
state: 'CA',
postcode: '94110',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* External dependencies
*/
import { test, expect } from '@playwright/test';

/**
* Internal dependencies
*/
import { useMerchant, describeif } from '../../utils/helpers';
import {
runSubscriptionsTests,
runActionSchedulerTests,
} from '../../utils/flows';
import { addCartProduct, placeOrder, setupCheckout } from '../../utils/shopper';
import { config } from '../../config/default';

// Run the tests if the two 'skip' environment variables are not set.
describeif( runSubscriptionsTests && runActionSchedulerTests )(
'Subscriptions > Renew a subscription via Action Scheduler',
() => {
useMerchant();

test.beforeEach( async ( { page } ) => {
await addCartProduct( page, 88 ); // Subscription no signup fee product
await setupCheckout(
page,
config.addresses[ 'subscriptions-customer' ].billing
);
await placeOrder( page );
} );

test( 'should renew a subscription with action scheduler', async ( {
page,
} ) => {
// WIP: This test is not yet implemented.
// To keep the linter happy for now:
expect( page.url() ).toContain( '/checkout/' );
} );
}
);
5 changes: 5 additions & 0 deletions tests/e2e-pw/utils/flows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const runSubscriptionsTests =
process.env.SKIP_WC_SUBSCRIPTIONS_TESTS !== '1';

export const runActionSchedulerTests =
process.env.SKIP_WC_ACTION_SCHEDULER_TESTS !== '1';
4 changes: 4 additions & 0 deletions tests/e2e-pw/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ export const getAnonymousShopper = async (
const shopperPage = await shopperContext.newPage();
return { shopperPage, shopperContext };
};

// Conditionally determine whether or not to skip a test suite
export const describeif = ( condition: boolean ) =>
condition ? test.describe : test.skip;
Loading