Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Test that templates exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jun 22, 2023
1 parent 7a2dafa commit 3bace80
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@
* External dependencies
*/
import { test, expect } from '@woocommerce/e2e-playwright-utils';

/**
* Internal dependencies
*/
import { cli } from '@woocommerce/e2e-utils';

test.describe(
'Tests permalink settings for the cart and checkout templates',
async () => {
test.afterAll( async () => {
await cli(
'npm run wp-env run tests-cli "wp option update woocommerce_cart_page_endpoint cart"'
);
await cli(
'npm run wp-env run tests-cli "wp option update woocommerce_checkout_page_endpoint checkout"'
);
} );

test.describe( 'Go to the advanced settings page', () => {
test( 'Load advanced settings', async ( { page } ) => {
await page.goto(
Expand Down
21 changes: 21 additions & 0 deletions tests/e2e-pw/tests/templates/cart-template.block_theme.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* External dependencies
*/
import { test, expect } from '@woocommerce/e2e-playwright-utils';

test.describe( 'Test the cart template', async () => {
test.describe( 'Template is available', () => {
test( 'Open template in the site editor', async ( { page } ) => {
await page.goto( '/wp-admin/site-editor.php' );
await page.click( 'text=Templates' );
await page.click( 'text=Cart' );
await page.getByRole( 'button', { name: /Edit/i } ).click();

const iframeButton = await page
.frameLocator( 'iFrame' )
.locator( 'button:has-text("Proceed to checkout")' )
.first();
await expect( iframeButton ).toBeVisible();
} );
} );
} );
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* External dependencies
*/
import { test, expect } from '@woocommerce/e2e-playwright-utils';

test.describe( 'Test the checkout header template part', async () => {
test.describe( 'Template part is available', () => {
test( 'Open template in the site editor', async ( { page } ) => {
await page.goto( '/wp-admin/site-editor.php' );
await page.click( 'text=Template Parts' );
await page.click( 'text=Checkout Header' );

const editButton = page.getByRole( 'button', { name: /Edit/i } );
await expect( editButton ).toBeVisible();
} );
} );
} );
21 changes: 21 additions & 0 deletions tests/e2e-pw/tests/templates/checkout-template.block_theme.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* External dependencies
*/
import { test, expect } from '@woocommerce/e2e-playwright-utils';

test.describe( 'Test the checkout template', async () => {
test.describe( 'Template is available', () => {
test( 'Open template in the site editor', async ( { page } ) => {
await page.goto( '/wp-admin/site-editor.php' );
await page.click( 'text=Templates' );
await page.click( 'text=Checkout' );
await page.getByRole( 'button', { name: /Edit/i } ).click();

const iframeButton = await page
.frameLocator( 'iFrame' )
.locator( 'button:has-text("Place order")' )
.first();
await expect( iframeButton ).toBeVisible();
} );
} );
} );
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* External dependencies
*/
import { test, expect } from '@woocommerce/e2e-playwright-utils';

test.describe( 'Test the order confirmation template', async () => {
test.describe( 'Template is available', () => {
test( 'Open template in the site editor', async ( { page } ) => {
await page.goto( '/wp-admin/site-editor.php' );
await page.click( 'text=Templates' );
await page.click( 'text=Order confirmation' );
await page.getByRole( 'button', { name: /Edit/i } ).click();

const iframeButton = await page
.frameLocator( 'iFrame' )
.locator(
'p:has-text("Thank you. Your order has been received.")'
)
.first();
await expect( iframeButton ).toBeVisible();
} );
} );
} );

0 comments on commit 3bace80

Please sign in to comment.