From 4208207e9c8a4beba74723a74cda46062e684b4c Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Mon, 26 Apr 2021 12:18:40 -0300 Subject: [PATCH] add backbone unblocking --- tests/e2e/utils/src/components.js | 4 ++-- tests/e2e/utils/src/page-utils.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/e2e/utils/src/components.js b/tests/e2e/utils/src/components.js index 309be76beaf..a87993f10dd 100644 --- a/tests/e2e/utils/src/components.js +++ b/tests/e2e/utils/src/components.js @@ -14,7 +14,7 @@ import { setCheckbox, unsetCheckbox, evalAndClick, - clearAndFillInput, + backboneUnblocked, } from './page-utils'; import factories from './factories'; @@ -437,7 +437,7 @@ const addProductToOrder = async ( orderId, productName ) => { await expect( page ).toClick( 'li[aria-selected="true"]' ); await page.click( '.wc-backbone-modal-content #btn-ok' ); - await uiUnblocked(); + await backboneUnblocked(); // Verify the product we added shows as a line item now await expect( page ).toMatchElement( '.wc-order-item-name', { text: productName } ); diff --git a/tests/e2e/utils/src/page-utils.js b/tests/e2e/utils/src/page-utils.js index 7e7648462e0..93a31689299 100644 --- a/tests/e2e/utils/src/page-utils.js +++ b/tests/e2e/utils/src/page-utils.js @@ -82,6 +82,13 @@ export const uiUnblocked = async () => { await page.waitForFunction( () => ! Boolean( document.querySelector( '.blockUI' ) ) ); }; +/** + * Wait for backbone blocking to end. + */ +export const backboneUnblocked = async () => { + await page.waitForFunction( () => ! Boolean( document.querySelector( '.wc-backbone-modal' ) ) ); +}; + /** * Publish, verify that item was published. Trash, verify that item was trashed. *