Check shop page after page deletion (#46448)

Co-authored-by: Jon Lane <jon.lane@automattic.com>
This commit is contained in:
Jonathan Lane 2024-04-10 23:52:45 -07:00 committed by GitHub
parent 7efd3d4652
commit 084d10c0ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Adds some end to end tests to verify page titles of key WC pages

View File

@ -9,6 +9,13 @@ test( 'Load the home page', async ( { page } ) => {
.getByRole( 'link', { name: 'WooCommerce Core E2E Test' } )
.count()
).toBeGreaterThan( 0 );
await expect(
page.getByText( 'Proudly powered by WordPress' )
).toBeVisible();
expect( await page.title() ).toBe( 'WooCommerce Core E2E Test Suite' );
await expect(
page.getByRole( 'link', { name: 'WordPress' } )
).toBeVisible();
} );
test( 'Load wp-admin as admin', async ( { page } ) => {

View File

@ -131,7 +131,7 @@ test.describe.serial( 'Tax rates in the cart and checkout', () => {
value: 'incl',
} );
await test.step( 'Load shop page and confirm price display', async () => {
await test.step( 'Load shop page, confirm title and confirm price display', async () => {
await page.goto( '/shop/' );
await expect(
page.getByRole( 'heading', { name: 'Shop' } )
@ -140,6 +140,9 @@ test.describe.serial( 'Tax rates in the cart and checkout', () => {
await expect(
page.getByText( '$250.00', { exact: true } )
).toBeVisible();
expect( await page.title() ).toBe(
'Shop WooCommerce Core E2E Test Suite'
);
} );
await test.step( 'Load cart page and confirm price display', async () => {

View File

@ -122,6 +122,11 @@ test.describe( 'Single Product Page', () => {
test( 'should be able to see product description', async ( { page } ) => {
await page.goto( `product/${ simpleProductSlug }` );
expect( await page.title() ).toBe(
simpleProductName + ' WooCommerce Core E2E Test Suite'
);
await page.getByRole( 'tab', { name: 'Description' } ).click();
await expect(

View File

@ -0,0 +1,38 @@
const { test, expect } = require( '@playwright/test' );
// test case for bug https://github.com/woocommerce/woocommerce/pull/46429
test.describe( 'Check the title of the shop page after the page has been deleted', () => {
test.use( { storageState: process.env.ADMINSTATE } );
test.beforeEach( async ( { page } ) => {
await page.goto( 'wp-admin/edit.php?post_type=page' );
await page.getByRole( 'cell', { name: '“Shop” (Edit)' } ).hover();
await page
.getByLabel( 'Move “Shop” to the Trash' )
.click( { force: true } );
await expect(
page.getByText( 'page moved to the Trash. Undo' )
).toBeVisible();
} );
test.afterEach( async ( { page } ) => {
await page.goto( 'wp-admin/edit.php?post_status=trash&post_type=page' );
await page
.getByRole( 'cell', { name: 'Shop — Shop Page Restore “' } )
.hover();
await page
.getByLabel( 'Restore “Shop” from the Trash' )
.click( { force: true } );
await expect(
page.getByText( '1 page restored from the Trash.' )
).toBeVisible();
} );
test( 'Check the title of the shop page after the page has been deleted', async ( {
page,
} ) => {
await page.goto( '/shop/' );
expect( await page.title() ).toBe(
'Shop WooCommerce Core E2E Test Suite'
);
} );
} );