2023-04-04 10:46:28 +02:00
|
|
|
///<reference path="../../global.d.ts" />
|
2022-04-08 12:34:59 +02:00
|
|
|
|
|
|
|
describe('segments', () => {
|
2023-04-05 13:20:58 +02:00
|
|
|
const randomId = String(Math.random()).split('.')[1];
|
|
|
|
const segmentName = `unleash-e2e-${randomId}`;
|
|
|
|
let segmentId: string;
|
|
|
|
|
2022-04-08 12:34:59 +02:00
|
|
|
before(() => {
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.runBefore();
|
2022-04-08 12:34:59 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.login_UI();
|
2022-04-08 12:34:59 +02:00
|
|
|
cy.visit('/segments');
|
2022-04-08 13:13:45 +02:00
|
|
|
if (document.querySelector("[data-testid='CLOSE_SPLASH']")) {
|
|
|
|
cy.get("[data-testid='CLOSE_SPLASH']").click();
|
2022-04-08 12:34:59 +02:00
|
|
|
}
|
2023-04-04 10:46:28 +02:00
|
|
|
});
|
2022-04-08 12:34:59 +02:00
|
|
|
|
2023-04-04 10:46:28 +02:00
|
|
|
it('can create a segment', () => {
|
|
|
|
cy.createSegment_UI(segmentName);
|
2022-04-08 12:34:59 +02:00
|
|
|
cy.contains(segmentName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('gives an error if a segment exists with the same name', () => {
|
2022-04-08 13:13:45 +02:00
|
|
|
cy.get("[data-testid='NAVIGATE_TO_CREATE_SEGMENT']").click();
|
2024-06-12 14:06:44 +02:00
|
|
|
cy.wait(500);
|
2022-04-08 13:13:45 +02:00
|
|
|
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(
|
2023-10-02 14:25:46 +02:00
|
|
|
'Segment name already exists',
|
2022-04-08 12:34:59 +02:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can delete a segment', () => {
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.deleteSegment_UI(segmentName, segmentId);
|
2022-04-08 12:34:59 +02:00
|
|
|
cy.contains(segmentName).should('not.exist');
|
|
|
|
});
|
|
|
|
});
|