woocommerce/plugins/woocommerce-blocks/tests/e2e/tests/basic.block_theme.spec.ts

38 lines
1.1 KiB
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import { test, expect } from '@woocommerce/e2e-playwright-utils';
/**
* Internal dependencies
*/
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-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-12-12 23:05:20 +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-12-12 23:05:20 +00:00
} );
} );