Introduce store owner logout flow

This commit is contained in:
Julia Amosova 2019-09-24 11:39:24 +01:00
parent 504de0012c
commit f970111721
2 changed files with 16 additions and 3 deletions

View File

@ -5,13 +5,13 @@
/**
* External dependencies
*/
import { activatePlugin, switchUserToTest } from '@wordpress/e2e-test-utils';
import { activatePlugin } from '@wordpress/e2e-test-utils';
/**
* Internal dependencies
*/
import { createSimpleProduct, createVariableProduct } from "../../utils/components";
import { CustomerFlow } from "../../utils/flows";
import { CustomerFlow, StoreOwnerFlow } from "../../utils/flows";
import { uiUnblocked } from '../../utils';
describe( 'Single Product Page', () => {
@ -19,7 +19,7 @@ describe( 'Single Product Page', () => {
await activatePlugin( 'woocommerce' );
await createSimpleProduct();
await createVariableProduct();
await switchUserToTest();
await StoreOwnerFlow.logout();
} );
it( 'should be able to add simple products to the cart', async () => {

View File

@ -82,6 +82,19 @@ const CustomerFlow = {
};
const StoreOwnerFlow = {
logout: async () => {
await page.goto( baseUrl + '/wp-login.php?action=logout', {
waitUntil: 'networkidle0',
} );
await expect( page ).toMatch( 'You are attempting to log out' );
await Promise.all( [
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
page.click( 'a' ),
] );
},
openNewProduct: async () => {
await page.goto( WP_ADMIN_NEW_PRODUCT, {
waitUntil: 'networkidle0',