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

Fix E2E tests #8263

Merged
merged 4 commits into from
Jan 25, 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
157 changes: 124 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"@wordpress/data-controls": "2.2.7",
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
"@wordpress/dom": "3.16.0",
"@wordpress/e2e-test-utils": "9.0.0",
"@wordpress/e2e-test-utils": "9.2.0",
"@wordpress/e2e-tests": "4.6.0",
"@wordpress/element": "4.20.0",
"@wordpress/env": "^4.9.0",
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/specs/backend/active-filters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import {
visitBlockPage,
selectBlockByName,
switchBlockInspectorTabWhenGutenbergIsInstalled,
} from '@woocommerce/blocks-test-utils';

const block = {
Expand All @@ -31,6 +32,7 @@ describe( `${ block.name } Block`, () => {
describe( 'attributes', () => {
beforeEach( async () => {
await openDocumentSettingsSidebar();
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
await selectBlockByName( block.slug );
} );

Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/specs/backend/attribute-filter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
visitBlockPage,
saveOrPublish,
selectBlockByName,
switchBlockInspectorTabWhenGutenbergIsInstalled,
} from '@woocommerce/blocks-test-utils';

const block = {
Expand Down Expand Up @@ -64,6 +65,7 @@ describe( `${ block.name } Block`, () => {
beforeEach( async () => {
await openDocumentSettingsSidebar();
await selectBlockByName( block.slug );
await switchBlockInspectorTabWhenGutenbergIsInstalled( 'Settings' );
} );

it( "allows changing the block's title", async () => {
Expand Down
18 changes: 13 additions & 5 deletions tests/e2e/specs/backend/cart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import {
clickBlockToolbarButton,
openDocumentSettingsSidebar,
switchUserToAdmin,
getAllBlocks,
searchForBlock,
openGlobalBlockInserter,
} from '@wordpress/e2e-test-utils';
import {
findLabelWithText,
visitBlockPage,
selectBlockByName,
switchBlockInspectorTabWhenGutenbergIsInstalled,
} from '@woocommerce/blocks-test-utils';
import { merchant } from '@woocommerce/e2e-utils';

/**
* Internal dependencies
*/
import {
searchForBlock,
insertBlockDontWaitForInsertClose,
openWidgetEditor,
closeModalIfExists,
openWidgetsEditorBlockInserter,
Expand All @@ -29,6 +29,9 @@ const block = {
name: 'Cart',
slug: 'woocommerce/cart',
class: '.wp-block-woocommerce-cart',
selectors: {
insertButton: "//button//span[text()='Cart']",
},
};

const filledCartBlock = {
Expand Down Expand Up @@ -62,8 +65,10 @@ describe( `${ block.name } Block`, () => {
} );

it( 'can only be inserted once', async () => {
await insertBlockDontWaitForInsertClose( block.name );
expect( await getAllBlocks() ).toHaveLength( 1 );
await openGlobalBlockInserter();
await page.keyboard.type( block.name );
const button = await page.$x( block.selectors.insertButton );
expect( button ).toHaveLength( 0 );
} );

it( 'renders without crashing', async () => {
Expand Down Expand Up @@ -114,6 +119,9 @@ describe( `${ block.name } Block`, () => {
describe( 'attributes', () => {
beforeEach( async () => {
await openDocumentSettingsSidebar();
await switchBlockInspectorTabWhenGutenbergIsInstalled(
'Settings'
);
await selectBlockByName(
'woocommerce/cart-order-summary-shipping-block'
);
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/backend/catalog-sorting.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
createNewPost,
insertBlock,
switchUserToAdmin,
searchForBlock,
} from '@wordpress/e2e-test-utils';
import { searchForBlock } from '@wordpress/e2e-test-utils/build/inserter';

/**
* Internal dependencies
Expand Down Expand Up @@ -41,7 +41,7 @@ describe( `${ block.name } Block`, () => {
} );
} );

describe( 'in FSE editor', () => {
describe.skip( 'in FSE editor', () => {
useTheme( 'emptytheme' );

beforeEach( async () => {
Expand Down
Loading