skip product search on WP versions < 5.8
This commit is contained in:
parent
d129a980d9
commit
1cd8d14ac4
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
await expect(page).toMatchElement('h2.entry-title', {text: prouductName});
|
||||
await expect(page).toClick('h2.entry-title', {text: prouductName});
|
||||
// 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);
|
||||
|
|
Loading…
Reference in New Issue