From eff47d790a1aa8b3fb44cd4b7f8226ffe7abc64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Fri, 29 Sep 2023 08:18:51 +0100 Subject: [PATCH] test: makes overview spec less flaky by doing 2 step search (#4862) Makes the Cypress project overview e2e spec less flaky by making the search action a 2 step process. This test is now passing for me locally when before it wasn't. --- .../integration/projects/overview.spec.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/cypress/integration/projects/overview.spec.ts b/frontend/cypress/integration/projects/overview.spec.ts index 36eedbdb99..79b593b25e 100644 --- a/frontend/cypress/integration/projects/overview.spec.ts +++ b/frontend/cypress/integration/projects/overview.spec.ts @@ -48,7 +48,8 @@ describe('project overview', () => { cy.visit('/projects/default'); // Use search to filter feature toggles and check that the feature toggle is listed in the table. - cy.get("[data-testid='SEARCH_INPUT']").click().type(featureToggleName); + cy.get(`[data-testid="${SEARCH_INPUT}"]`).as('search').click(); + cy.get('@search').type(featureToggleName); cy.get('table').contains('td', `${featureToggleName}-A`); cy.get('table tbody tr').should('have.length', 2); }); @@ -57,7 +58,8 @@ describe('project overview', () => { cy.login_UI(); cy.visit('/projects/default'); cy.viewport(1920, 1080); - cy.get("[data-testid='SEARCH_INPUT']").click().type(featureToggleName); + cy.get(`[data-testid="${SEARCH_INPUT}"]`).as('search').click(); + cy.get('@search').type(featureToggleName); cy.get('body').type('{esc}'); cy.get('table tbody tr').should('have.length', 2); const counter = `[data-testid="${BATCH_SELECTED_COUNT}"]`; @@ -106,9 +108,8 @@ describe('project overview', () => { cy.login_UI(); cy.visit('/projects/default'); cy.viewport(1920, 1080); - cy.get(`[data-testid='${SEARCH_INPUT}']`) - .click() - .type(featureToggleName); + cy.get(`[data-testid="${SEARCH_INPUT}"]`).as('search').click(); + cy.get('@search').type(featureToggleName); cy.get('body').type('{esc}'); cy.get('table tbody tr').should('have.length', 2); cy.get(selectAll).click(); @@ -125,9 +126,8 @@ describe('project overview', () => { cy.login_UI(); cy.visit('/projects/default'); cy.viewport(1920, 1080); - cy.get(`[data-testid='${SEARCH_INPUT}']`) - .click() - .type(featureToggleName); + cy.get(`[data-testid="${SEARCH_INPUT}"]`).as('search').click(); + cy.get('@search').type(featureToggleName); cy.get('body').type('{esc}'); cy.get('table tbody tr').should('have.length', 2);