Skip to content

Commit

Permalink
Can only be inserted once test excludes the mini-cart template button (
Browse files Browse the repository at this point in the history
…#46478)

* Can only be inserted once test excludes the mini-cart template button

* Use function for testing disabled state

* Account for blocks advertise and change selector
  • Loading branch information
ralucaStan authored and nielslange committed Apr 20, 2024
1 parent 33a55ff commit afd962f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ const blockData: BlockData = {
slug: 'woocommerce/mini-cart',
mainClass: '.wc-block-minicart',
selectors: {
editor: {
block: '.wp-block-woocommerce-mini-cart',
insertButton: "//button//span[text()='Mini-Cart']",
},
frontend: {},
editor: {},
},
};

Expand Down Expand Up @@ -54,15 +57,19 @@ test.describe( 'Merchant → Mini Cart', () => {
.getByLabel( 'Search for blocks and patterns' )
.fill( blockData.slug );

// Await for blocks commercial to be loaded in the Blocks inserter.
await expect(
editorUtils.page.locator(
'.block-directory-downloadable-block-list-item__details'
)
).toBeVisible();

const miniCartButton = editorUtils.page.getByRole( 'option', {
name: blockData.name,
exact: true,
} );

await expect( miniCartButton ).toHaveAttribute(
'aria-disabled',
'true'
);
await expect( miniCartButton ).toBeVisible();
await expect( miniCartButton ).toBeDisabled();
} );
} );
} );
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/fix-mini-cart-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

can only be inserted once excludes the mini-cart template button

0 comments on commit afd962f

Please sign in to comment.