From 65325181d12073bfc8f3fa32a1538bf4941e5a4d Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Wed, 23 Nov 2022 10:53:40 +0500 Subject: [PATCH 1/4] Fix: Intermittent tests failures --- tests/cypress/integration/features/woocommerce.cy.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/cypress/integration/features/woocommerce.cy.js b/tests/cypress/integration/features/woocommerce.cy.js index 73de7633b5..da54eab564 100644 --- a/tests/cypress/integration/features/woocommerce.cy.js +++ b/tests/cypress/integration/features/woocommerce.cy.js @@ -258,6 +258,14 @@ describe('WooCommerce Feature', () => { cy.get('#the-list tr:eq(0)').should('have.id', thirdProductId); cy.refreshIndex('post').then(() => { + + /** + * Give Elasticsearch some time to process the new posts. + * + */ + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(2000); + cy.reload(); cy.get( '#debug-menu-target-EP_Debug_Bar_ElasticPress .ep-query-debug', From 543fa33afa4dce02b612eea19501c671007c0e42 Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Wed, 23 Nov 2022 10:57:01 +0500 Subject: [PATCH 2/4] Fix linting --- tests/cypress/integration/features/woocommerce.cy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cypress/integration/features/woocommerce.cy.js b/tests/cypress/integration/features/woocommerce.cy.js index da54eab564..489f061f6e 100644 --- a/tests/cypress/integration/features/woocommerce.cy.js +++ b/tests/cypress/integration/features/woocommerce.cy.js @@ -258,7 +258,6 @@ describe('WooCommerce Feature', () => { cy.get('#the-list tr:eq(0)').should('have.id', thirdProductId); cy.refreshIndex('post').then(() => { - /** * Give Elasticsearch some time to process the new posts. * From d04a4fb14eeaafad198c17117d03c409546726df Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Wed, 23 Nov 2022 10:57:39 +0500 Subject: [PATCH 3/4] minor change --- tests/cypress/integration/features/woocommerce.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/features/woocommerce.cy.js b/tests/cypress/integration/features/woocommerce.cy.js index 489f061f6e..a828cab642 100644 --- a/tests/cypress/integration/features/woocommerce.cy.js +++ b/tests/cypress/integration/features/woocommerce.cy.js @@ -259,7 +259,7 @@ describe('WooCommerce Feature', () => { cy.refreshIndex('post').then(() => { /** - * Give Elasticsearch some time to process the new posts. + * Give Elasticsearch some time to process the post. * */ // eslint-disable-next-line cypress/no-unnecessary-waiting From 8d965920650fe918fc38c6580dce07292e13a35f Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Wed, 23 Nov 2022 16:35:08 +0500 Subject: [PATCH 4/4] Minor change --- tests/cypress/integration/features/woocommerce.cy.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/cypress/integration/features/woocommerce.cy.js b/tests/cypress/integration/features/woocommerce.cy.js index a828cab642..f6b942d8eb 100644 --- a/tests/cypress/integration/features/woocommerce.cy.js +++ b/tests/cypress/integration/features/woocommerce.cy.js @@ -252,19 +252,14 @@ describe('WooCommerce Feature', () => { thirdProductId = id; }); + cy.intercept('POST', '/wp-admin/admin-ajax.php*').as('ajaxRequest'); cy.get('@thirdProduct') .drag('#the-list tr:eq(0)', { force: true }) .then(() => { + cy.wait('@ajaxRequest').its('response.statusCode').should('eq', 200); cy.get('#the-list tr:eq(0)').should('have.id', thirdProductId); cy.refreshIndex('post').then(() => { - /** - * Give Elasticsearch some time to process the post. - * - */ - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(2000); - cy.reload(); cy.get( '#debug-menu-target-EP_Debug_Bar_ElasticPress .ep-query-debug',