diff --git a/tests/e2e-tests/specs/front-end/front-end-single-product.test.js b/tests/e2e-tests/specs/front-end/front-end-single-product.test.js index 6d53b4715e8..cc0ea4f0e71 100644 --- a/tests/e2e-tests/specs/front-end/front-end-single-product.test.js +++ b/tests/e2e-tests/specs/front-end/front-end-single-product.test.js @@ -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 () => { diff --git a/tests/e2e-tests/utils/flows.js b/tests/e2e-tests/utils/flows.js index ff0bdfb806e..2547b9408fe 100644 --- a/tests/e2e-tests/utils/flows.js +++ b/tests/e2e-tests/utils/flows.js @@ -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',