mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
chore: remove e2e tests for legacy env variants (#7071)
This commit is contained in:
parent
f1e1de6528
commit
08e05141f3
@ -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);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -281,69 +281,6 @@ export const addUserIdStrategyToFeature_UI = (
|
|||||||
return cy.wait('@addStrategyToFeature');
|
return cy.wait('@addStrategyToFeature');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addVariantsToFeature_UI = (
|
|
||||||
featureToggleName: string,
|
|
||||||
variants: Array<string>,
|
|
||||||
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<any> => {
|
|
||||||
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<any> => {
|
export const logout_UI = (): Chainable<any> => {
|
||||||
return cy.visit('/logout');
|
return cy.visit('/logout');
|
||||||
};
|
};
|
||||||
|
@ -8,12 +8,10 @@ import {
|
|||||||
createFeature_UI,
|
createFeature_UI,
|
||||||
createSegment_UI,
|
createSegment_UI,
|
||||||
deleteSegment_UI,
|
deleteSegment_UI,
|
||||||
deleteVariant_UI,
|
|
||||||
deleteFeatureStrategy_UI,
|
deleteFeatureStrategy_UI,
|
||||||
addFlexibleRolloutStrategyToFeature_UI,
|
addFlexibleRolloutStrategyToFeature_UI,
|
||||||
addUserIdStrategyToFeature_UI,
|
addUserIdStrategyToFeature_UI,
|
||||||
updateFlexibleRolloutStrategy_UI,
|
updateFlexibleRolloutStrategy_UI,
|
||||||
addVariantsToFeature_UI,
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
} from './UI';
|
} from './UI';
|
||||||
import {
|
import {
|
||||||
@ -43,8 +41,6 @@ Cypress.Commands.add('updateUserPassword_API', updateUserPassword_API);
|
|||||||
Cypress.Commands.add('createFeature_UI', createFeature_UI);
|
Cypress.Commands.add('createFeature_UI', createFeature_UI);
|
||||||
Cypress.Commands.add('deleteFeatureStrategy_UI', deleteFeatureStrategy_UI);
|
Cypress.Commands.add('deleteFeatureStrategy_UI', deleteFeatureStrategy_UI);
|
||||||
Cypress.Commands.add('createFeature_API', createFeature_API);
|
Cypress.Commands.add('createFeature_API', createFeature_API);
|
||||||
Cypress.Commands.add('deleteVariant_UI', deleteVariant_UI);
|
|
||||||
Cypress.Commands.add('addVariantsToFeature_UI', addVariantsToFeature_UI);
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'addUserIdStrategyToFeature_UI',
|
'addUserIdStrategyToFeature_UI',
|
||||||
addUserIdStrategyToFeature_UI,
|
addUserIdStrategyToFeature_UI,
|
||||||
|
@ -55,7 +55,7 @@ const IconsRow = styled(Box)(({ theme }) => ({
|
|||||||
|
|
||||||
const Line = styled(Box)(({ theme }) => ({
|
const Line = styled(Box)(({ theme }) => ({
|
||||||
height: '1px',
|
height: '1px',
|
||||||
background: theme.palette.background.application,
|
background: theme.palette.divider,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user