Merge pull request #30595 from woocommerce/e2e/reset-obw-on-retest

reset E2E onboarding on retest
This commit is contained in:
Greg 2021-08-27 13:57:55 -06:00 committed by GitHub
commit 77c7c386f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 8 deletions

View File

@ -5,13 +5,13 @@ import {
WP_ADMIN_LOGIN
} from '@woocommerce/e2e-utils';
const config = require('config');
const { HTTPClientFactory } = require('@woocommerce/api');
const config = require( 'config' );
const { HTTPClientFactory } = require( '@woocommerce/api' );
const { addConsoleSuppression, updateReadyPageStatus } = require( '@woocommerce/e2e-environment' );
const { DEFAULT_TIMEOUT_OVERRIDE } = process.env;
// @todo: remove this once https://github.com/woocommerce/woocommerce-admin/issues/6992 has been addressed
addConsoleSuppression( 'woocommerce_shared_settings' );
addConsoleSuppression( 'woocommerce_shared_settings', false );
/**
* Uses the WordPress API to delete all existing posts

View File

@ -1,10 +1,10 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests */
/**
* Internal dependencies
*/
const {
shopper,
createSimpleProductWithCategory,
utils,
} = require( '@woocommerce/e2e-utils' );
/**
@ -15,6 +15,7 @@ const {
describe,
beforeAll,
} = require( '@jest/globals' );
const { WORDPRESS_VERSION } = process.env;
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );
@ -27,7 +28,7 @@ const hardware = 'Hardware';
const productTitle = 'li.first > a > h2.woocommerce-loop-product__title';
const runProductBrowseSearchSortTest = () => {
describe('Search, browse by categories and sort items in the shop', () => {
utils.describeIf( WORDPRESS_VERSION >= '5.8' )( 'Search, browse by categories and sort items in the shop', () => {
beforeAll(async () => {
// Create 1st product with Clothing category
await createSimpleProductWithCategory(simpleProductName + ' 1', singleProductPrice, clothing);

View File

@ -2,6 +2,15 @@ const {
testAdminOnboardingWizard,
testSelectiveBundleWCPay,
} = require( '@woocommerce/admin-e2e-tests' );
const {
withRestApi,
IS_RETEST_MODE,
} = require( '@woocommerce/e2e-utils' );
// Reset onboarding profile when re-running tests on a site
if ( IS_RETEST_MODE ) {
withRestApi.resetOnboarding();
}
testAdminOnboardingWizard();
testSelectiveBundleWCPay();

View File

@ -171,9 +171,11 @@ const shopper = {
await page.waitForSelector(searchFieldSelector, { timeout: 100000 });
await expect(page).toFill(searchFieldSelector, prouductName);
await expect(page).toClick('.wp-block-search__button');
await page.waitForSelector('h2.entry-title');
// Single search results may go directly to product page
if ( await page.waitForSelector('h2.entry-title') ) {
await expect(page).toMatchElement('h2.entry-title', {text: prouductName});
await expect(page).toClick('h2.entry-title', {text: prouductName});
}
await page.waitForSelector('h1.entry-title');
await expect(page.title()).resolves.toMatch(prouductName);
await expect(page).toMatchElement('h1.entry-title', prouductName);