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 shopper-wc-blocks-checkout-purchase spec #10234

Open
wants to merge 3 commits into
base: dev/10075-playwright-migration-shopper-wc-blocks-saved-card-checkout-and-usage
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions changelog/dev-10074-pw-shopper-blocks-checkout-purchase
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

E2E Playwright Migration: convert shopper-wc-blocks-checkout-purchase spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* External dependencies
*/
import { test, expect, Page } from '@playwright/test';

/**
* Internal dependencies
*/
import {
checkPageExists,
describeif,
getMerchant,
getShopper,
} from '../../utils/helpers';
import { shouldRunWCBlocksTests } from '../../utils/constants';
import { addWCBCheckoutPage } from '../../utils/merchant';
import { goToCheckoutWCB } from '../../utils/shopper-navigation';
import {
addCartProduct,
confirmCardAuthentication,
fillBillingAddressWCB,
fillCardDetailsWCB,
} from '../../utils/shopper';
import { config } from '../../config/default';

describeif( shouldRunWCBlocksTests )(
'WooCommerce Blocks > Successful purchase',
() => {
let shopperPage: Page;

test.beforeAll( async ( { browser }, { project } ) => {
shopperPage = ( await getShopper( browser ) ).shopperPage;
if (
! ( await checkPageExists(
shopperPage,
project.use.baseURL + '/checkout-wcb'
) )
) {
const { merchantPage } = await getMerchant( browser );
await addWCBCheckoutPage( merchantPage );
}
} );

test( 'using a basic card', async () => {
await addCartProduct( shopperPage );
await goToCheckoutWCB( shopperPage );
await fillBillingAddressWCB(
shopperPage,
config.addresses.customer.billing
);
await fillCardDetailsWCB( shopperPage, config.cards.basic );
await shopperPage
.getByRole( 'button', { name: 'Place Order' } )
.click();
await shopperPage.waitForURL( /\/order-received\//, {
waitUntil: 'load',
} );
await expect(
shopperPage.getByRole( 'heading', {
name: 'Order received',
} )
).toBeVisible();
} );

test( 'using a 3DS card', async () => {
await addCartProduct( shopperPage );
await goToCheckoutWCB( shopperPage );
await fillBillingAddressWCB(
shopperPage,
config.addresses.customer.billing
);
await fillCardDetailsWCB( shopperPage, config.cards[ '3ds' ] );
await shopperPage
.getByRole( 'button', { name: 'Place Order' } )
.click();
await confirmCardAuthentication( shopperPage );
await shopperPage.waitForURL( /\/order-received\//, {
waitUntil: 'load',
} );
await expect(
shopperPage.getByRole( 'heading', {
name: 'Order received',
} )
).toBeVisible();
} );
}
);

This file was deleted.

Loading