From 7787c5b0f226bc6d645aae39b7f707bbe851db06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Thu, 7 Nov 2024 14:43:48 +0000 Subject: [PATCH] test: fix feature e2e test --- .../cypress/integration/feature/feature.spec.ts | 14 ++++++++++++++ frontend/cypress/support/UI.ts | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/integration/feature/feature.spec.ts b/frontend/cypress/integration/feature/feature.spec.ts index d65c017b93d8..d52c7ecd5516 100644 --- a/frontend/cypress/integration/feature/feature.spec.ts +++ b/frontend/cypress/integration/feature/feature.spec.ts @@ -1,6 +1,7 @@ /// describe('feature', () => { + const baseUrl = Cypress.config().baseUrl; const randomId = String(Math.random()).split('.')[1]; const featureToggleName = `unleash-e2e-${randomId}`; const projectName = `unleash-e2e-project-${randomId}`; @@ -35,6 +36,19 @@ describe('feature', () => { beforeEach(() => { cy.login_UI(); cy.visit('/features'); + + cy.intercept('GET', `${baseUrl}/api/admin/ui-config`, (req) => { + req.headers['cache-control'] = + 'no-cache, no-store, must-revalidate'; + req.on('response', (res) => { + if (res.body) { + res.body.flags = { + ...res.body.flags, + flagOverviewRedesign: true, + }; + } + }); + }); }); it('can create a feature flag', () => { diff --git a/frontend/cypress/support/UI.ts b/frontend/cypress/support/UI.ts index d9801a494364..64ba45d62b2a 100644 --- a/frontend/cypress/support/UI.ts +++ b/frontend/cypress/support/UI.ts @@ -227,7 +227,6 @@ export const deleteFeatureStrategy_UI = ( }, ).as('deleteUserStrategy'); cy.visit(`/projects/${project}/features/${featureToggleName}`); - cy.get('[data-testid=FEATURE_ENVIRONMENT_ACCORDION_development]').click(); cy.get('[data-testid=STRATEGY_REMOVE_MENU_BTN]').first().click(); cy.get('[data-testid=STRATEGY_FORM_REMOVE_ID]').first().click(); if (!shouldWait) return cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').click();