From 08e05141f314c2a6060596b3134718c6bda8baa3 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Fri, 17 May 2024 10:55:22 +0200 Subject: [PATCH] chore: remove e2e tests for legacy env variants (#7071) --- .../integration/feature/feature.spec.ts | 52 --------------- frontend/cypress/support/UI.ts | 63 ------------------- frontend/cypress/support/commands.ts | 4 -- .../FeatureLifecycleTooltip.tsx | 2 +- 4 files changed, 1 insertion(+), 120 deletions(-) diff --git a/frontend/cypress/integration/feature/feature.spec.ts b/frontend/cypress/integration/feature/feature.spec.ts index ca5cf4b7b0..fd3971bdd3 100644 --- a/frontend/cypress/integration/feature/feature.spec.ts +++ b/frontend/cypress/integration/feature/feature.spec.ts @@ -60,56 +60,4 @@ describe('feature', () => { ); }); }); - - it('can add variants to the development environment', () => { - cy.addVariantsToFeature_UI( - featureToggleName, - [variant1, variant2], - projectName, - ); - }); - - it('can update variants', () => { - cy.visit( - `/projects/${projectName}/features/${featureToggleName}/variants`, - ); - - cy.get('[data-testid=EDIT_VARIANTS_BUTTON]').click(); - cy.get('[data-testid=VARIANT_NAME_INPUT]') - .last() - .children() - .find('input') - .should('have.attr', 'disabled'); - cy.get('[data-testid=VARIANT_WEIGHT_CHECK]') - .last() - .find('input') - .check(); - cy.get('[data-testid=VARIANT_WEIGHT_INPUT]').last().clear().type('15'); - - cy.intercept( - 'PATCH', - `/api/admin/projects/${projectName}/features/${featureToggleName}/environments/development/variants`, - (req) => { - expect(req.body[0].op).to.equal('replace'); - expect(req.body[0].path).to.equal('/1/weightType'); - expect(req.body[0].value).to.equal('fix'); - expect(req.body[1].op).to.equal('replace'); - expect(req.body[1].path).to.equal('/1/weight'); - expect(req.body[1].value).to.equal(150); - expect(req.body[2].op).to.equal('replace'); - expect(req.body[2].path).to.equal('/0/weight'); - expect(req.body[2].value).to.equal(850); - }, - ).as('variantUpdate'); - - cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').click(); - cy.get(`[data-testid=VARIANT_WEIGHT_${variant2}]`).should( - 'have.text', - '15 %', - ); - }); - - it('can delete variants', () => { - cy.deleteVariant_UI(featureToggleName, variant2, projectName); - }); }); diff --git a/frontend/cypress/support/UI.ts b/frontend/cypress/support/UI.ts index 363eb9eeff..406687be26 100644 --- a/frontend/cypress/support/UI.ts +++ b/frontend/cypress/support/UI.ts @@ -281,69 +281,6 @@ export const addUserIdStrategyToFeature_UI = ( return cy.wait('@addStrategyToFeature'); }; -export const addVariantsToFeature_UI = ( - featureToggleName: string, - variants: Array, - projectName: string, -) => { - const project = projectName || 'default'; - cy.visit(`/projects/${project}/features/${featureToggleName}/variants`); - cy.wait(200); - - cy.intercept( - 'PATCH', - `/api/admin/projects/${project}/features/${featureToggleName}/environments/development/variants`, - (req) => { - variants.forEach((variant, index) => { - expect(req.body[index].op).to.equal('add'); - expect(req.body[index].path).to.equal(`/${index}`); - expect(req.body[index].value.name).to.equal(variant); - expect(req.body[index].value.weight).to.equal( - 1000 / variants.length, - ); - }); - }, - ).as('variantCreation'); - - cy.get('[data-testid=ADD_VARIANT_BUTTON]').first().click(); - cy.wait(500); - variants.forEach((variant, index) => { - cy.get('[data-testid=VARIANT_NAME_INPUT]').eq(index).type(variant); - index + 1 < variants.length && - cy.get('[data-testid=MODAL_ADD_VARIANT_BUTTON]').first().click(); - }); - - cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').first().click(); - return cy.wait('@variantCreation'); -}; - -export const deleteVariant_UI = ( - featureToggleName: string, - variant: string, - projectName?: string, -): Chainable => { - const project = projectName || 'default'; - cy.visit(`/projects/${project}/features/${featureToggleName}/variants`); - cy.get('[data-testid=EDIT_VARIANTS_BUTTON]').click(); - cy.wait(300); - cy.get(`[data-testid=VARIANT_DELETE_BUTTON_${variant}]`).first().click(); - - cy.intercept( - 'PATCH', - `/api/admin/projects/${project}/features/${featureToggleName}/environments/development/variants`, - (req) => { - expect(req.body[0].op).to.equal('remove'); - expect(req.body[0].path).to.equal('/1'); - expect(req.body[1].op).to.equal('replace'); - expect(req.body[1].path).to.equal('/0/weight'); - expect(req.body[1].value).to.equal(1000); - }, - ).as('delete'); - - cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').click(); - return cy.wait('@delete'); -}; - export const logout_UI = (): Chainable => { return cy.visit('/logout'); }; diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 5f3e37f5b2..3664358146 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -8,12 +8,10 @@ import { createFeature_UI, createSegment_UI, deleteSegment_UI, - deleteVariant_UI, deleteFeatureStrategy_UI, addFlexibleRolloutStrategyToFeature_UI, addUserIdStrategyToFeature_UI, updateFlexibleRolloutStrategy_UI, - addVariantsToFeature_UI, //@ts-ignore } from './UI'; import { @@ -43,8 +41,6 @@ Cypress.Commands.add('updateUserPassword_API', updateUserPassword_API); Cypress.Commands.add('createFeature_UI', createFeature_UI); Cypress.Commands.add('deleteFeatureStrategy_UI', deleteFeatureStrategy_UI); Cypress.Commands.add('createFeature_API', createFeature_API); -Cypress.Commands.add('deleteVariant_UI', deleteVariant_UI); -Cypress.Commands.add('addVariantsToFeature_UI', addVariantsToFeature_UI); Cypress.Commands.add( 'addUserIdStrategyToFeature_UI', addUserIdStrategyToFeature_UI, diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureLifecycle/FeatureLifecycleTooltip.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureLifecycle/FeatureLifecycleTooltip.tsx index f5126cdfac..a1815bfdc9 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureLifecycle/FeatureLifecycleTooltip.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureLifecycle/FeatureLifecycleTooltip.tsx @@ -55,7 +55,7 @@ const IconsRow = styled(Box)(({ theme }) => ({ const Line = styled(Box)(({ theme }) => ({ height: '1px', - background: theme.palette.background.application, + background: theme.palette.divider, flex: 1, }));