Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

E2E tests fix: enable the attribute lookup direct updates settings #9029

Merged
merged 3 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/e2e/config/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
createBlockPages,
enablePaymentGateways,
createProductAttributes,
enableAttributeLookupDirectUpdates,
} from '../fixtures/fixture-loaders';
import { PERFORMANCE_REPORT_FILENAME } from '../../utils/constants';

Expand All @@ -28,9 +29,12 @@ module.exports = async ( globalConfig ) => {
await setupPuppeteer( globalConfig );

try {
await enableAttributeLookupDirectUpdates();

// do setupSettings separately which hopefully gives a chance for WooCommerce
// to be configured before the others are executed.
await setupSettings();

const pages = await createBlockPages();

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/fixtures/fixture-loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,16 @@ const deleteProductAttributes = ( ids ) => {
return WooCommerce.post( 'products/attributes/batch', { delete: ids } );
};

const enableAttributeLookupDirectUpdates = () =>
WooCommerce.put(
'settings/products/woocommerce_attribute_lookup_direct_updates',
{
value: 'yes',
}
);

module.exports = {
enableAttributeLookupDirectUpdates,
createProductAttributes,
deleteProductAttributes,
setupSettings,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/backend/customer-account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import { openSettingsSidebar } from '../../utils.js';
const block = {
name: 'Customer account',
slug: 'woocommerce/customer-account',
class: '.wc-block-customer-account',
class: '.wc-block-editor-customer-account',
};

const SELECTORS = {
icon: '.wp-block-woocommerce-customer-account svg',
label: '.wp-block-woocommerce-customer-account .label',
iconToggle: '.wc-block-customer-account__icon-style-toggle',
iconToggle: '.wc-block-editor-customer-account__icon-style-toggle',
displayDropdown: '.customer-account-display-style select',
};

Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/specs/shopper/filter-products-by-attribute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ describe( `${ block.name } Block`, () => {
} );

it( 'should render products', async () => {
page.setDefaultTimeout( 200000 );
const products = await page.$$(
selectors.frontend.queryProductsList
);
Expand All @@ -267,6 +268,7 @@ describe( `${ block.name } Block`, () => {
} );

it( 'should show only products that match the filter', async () => {
page.setDefaultTimeout( 200000 );
const isRefreshed = jest.fn( () => void 0 );
page.on( 'load', isRefreshed );

Expand Down Expand Up @@ -299,6 +301,7 @@ describe( `${ block.name } Block`, () => {
} );

it( 'should refresh the page only if the user clicks on button', async () => {
page.setDefaultTimeout( 200000 );
await page.goto( editorPageUrl );

await waitForCanvas();
Expand Down