mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
a11cb72d99
* feat: persistent table query * project overview sort query * refactor: api methods as hook callbacks * persitent columns in project overview * enable new project overview * fix: refactor feature state change in overview * add type to sort * update e2e tests now takes 10% less time with use of cypress session * prevent sort reset on features list * fix feature toggle list loading * fix: update column state saving * update local storage hook test
58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
/// <reference types="cypress" />
|
|
|
|
export {};
|
|
const randomId = String(Math.random()).split('.')[1];
|
|
const segmentName = `unleash-e2e-${randomId}`;
|
|
|
|
// Disable all active splash pages by visiting them.
|
|
const disableActiveSplashScreens = () => {
|
|
cy.visit(`/splash/operators`);
|
|
};
|
|
|
|
describe('segments', () => {
|
|
before(() => {
|
|
disableActiveSplashScreens();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.login();
|
|
cy.visit('/segments');
|
|
});
|
|
|
|
it('can create a segment', () => {
|
|
if (document.querySelector("[data-testid='CLOSE_SPLASH']")) {
|
|
cy.get("[data-testid='CLOSE_SPLASH']").click();
|
|
}
|
|
|
|
cy.get("[data-testid='NAVIGATE_TO_CREATE_SEGMENT']").click();
|
|
|
|
cy.intercept('POST', '/api/admin/segments').as('createSegment');
|
|
|
|
cy.get("[data-testid='SEGMENT_NAME_ID']").type(segmentName);
|
|
cy.get("[data-testid='SEGMENT_DESC_ID']").type('hello-world');
|
|
cy.get("[data-testid='SEGMENT_NEXT_BTN_ID']").click();
|
|
cy.get("[data-testid='SEGMENT_CREATE_BTN_ID']").click();
|
|
cy.wait('@createSegment');
|
|
cy.contains(segmentName);
|
|
});
|
|
|
|
it('gives an error if a segment exists with the same name', () => {
|
|
cy.get("[data-testid='NAVIGATE_TO_CREATE_SEGMENT']").click();
|
|
|
|
cy.get("[data-testid='SEGMENT_NAME_ID']").type(segmentName);
|
|
cy.get("[data-testid='SEGMENT_NEXT_BTN_ID']").should('be.disabled');
|
|
cy.get("[data-testid='INPUT_ERROR_TEXT']").contains(
|
|
'Segment name already exists'
|
|
);
|
|
});
|
|
|
|
it('can delete a segment', () => {
|
|
cy.get(`[data-testid='SEGMENT_DELETE_BTN_ID_${segmentName}']`).click();
|
|
|
|
cy.get("[data-testid='SEGMENT_DIALOG_NAME_ID']").type(segmentName);
|
|
cy.get("[data-testid='DIALOGUE_CONFIRM_ID'").click();
|
|
|
|
cy.contains(segmentName).should('not.exist');
|
|
});
|
|
});
|