2023-04-17 12:01:41 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2023-05-05 11:03:36 +00:00
|
|
|
import { test, expect } from '@woocommerce/e2e-playwright-utils';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2023-04-17 12:01:41 +00:00
|
|
|
|
2023-12-12 23:05:20 +00:00
|
|
|
test.describe( 'A basic set of tests to ensure WP, wp-admin and my-account load', async () => {
|
|
|
|
test( 'Load the home page', async ( { page } ) => {
|
|
|
|
await page.goto( '/', { waitUntil: 'commit' } );
|
|
|
|
const title = page
|
|
|
|
.locator( 'header' )
|
|
|
|
.locator( '.wp-block-site-title' );
|
|
|
|
await expect( title ).toHaveText( 'WooCommerce Blocks E2E Test Suite' );
|
|
|
|
} );
|
2023-04-17 12:01:41 +00:00
|
|
|
|
2023-12-12 23:05:20 +00:00
|
|
|
test.describe( 'Sign in as admin', () => {
|
|
|
|
test( 'Load wp-admin', async ( { page } ) => {
|
|
|
|
await page.goto( '/wp-admin', { waitUntil: 'commit' } );
|
|
|
|
const title = page.locator( 'div.wrap > h1' );
|
|
|
|
await expect( title ).toHaveText( 'Dashboard' );
|
2023-04-17 12:01:41 +00:00
|
|
|
} );
|
2023-12-12 23:05:20 +00:00
|
|
|
} );
|
2023-04-17 12:01:41 +00:00
|
|
|
|
2023-12-12 23:05:20 +00:00
|
|
|
test.describe( 'Sign in as customer', () => {
|
|
|
|
test.use( {
|
|
|
|
storageState: process.env.CUSTOMERSTATE,
|
|
|
|
} );
|
|
|
|
test( 'Load customer my account page', async ( { page } ) => {
|
|
|
|
await page.goto( '/my-account', { waitUntil: 'commit' } );
|
|
|
|
const title = page.locator( 'h1.wp-block-post-title' );
|
|
|
|
await expect( title ).toHaveText( 'My Account' );
|
2023-04-17 12:01:41 +00:00
|
|
|
} );
|
2023-12-12 23:05:20 +00:00
|
|
|
} );
|
|
|
|
} );
|