From 68b14e47b2137286fd55c7ac73a81def86f860b5 Mon Sep 17 00:00:00 2001 From: Eason Su Date: Tue, 20 Aug 2024 15:25:46 +0800 Subject: [PATCH] Prevent E2E tests from failing randomly due to getting product block attribute locators before they are rendered. --- tests/e2e/utils/product-editor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/e2e/utils/product-editor.js b/tests/e2e/utils/product-editor.js index 887e52dbed..25b5e94474 100644 --- a/tests/e2e/utils/product-editor.js +++ b/tests/e2e/utils/product-editor.js @@ -431,6 +431,9 @@ export function getProductBlockEditorUtils( page ) { }, async getAvailableProductAttributesWithTestValues() { + // Avoiding tests may start to get locators before they are rendered, + // leading to random failures. + await this.getProductAttributesHeading().waitFor(); return getAvailableProductAttributesWithTestValues( page, this.getDateAndTimeFields