2023-04-04 10:46:28 +02:00
|
|
|
///<reference path="../../global.d.ts" />
|
2023-03-17 13:41:59 +01:00
|
|
|
|
2023-04-04 10:46:28 +02:00
|
|
|
describe('project settings', () => {
|
2023-04-05 13:20:58 +02:00
|
|
|
const randomId = String(Math.random()).split('.')[1];
|
|
|
|
const baseUrl = Cypress.config().baseUrl;
|
|
|
|
const projectName = `stickiness-project-${randomId}`;
|
|
|
|
const TEST_STICKINESS = 'userId';
|
|
|
|
const featureToggleName = `settings-${randomId}`;
|
|
|
|
let cleanFeature = false;
|
|
|
|
let cleanProject = false;
|
|
|
|
|
2023-03-17 13:41:59 +01:00
|
|
|
before(() => {
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.runBefore();
|
2023-03-17 13:41:59 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.login_UI();
|
|
|
|
if (cleanFeature) {
|
|
|
|
cy.deleteFeature_API(featureToggleName);
|
2023-03-17 13:41:59 +01:00
|
|
|
}
|
2023-04-04 10:46:28 +02:00
|
|
|
if (cleanProject) {
|
|
|
|
cy.deleteProject_API(projectName);
|
|
|
|
}
|
|
|
|
cy.visit(`/projects`);
|
|
|
|
cy.wait(300);
|
2023-03-17 13:41:59 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should store default project stickiness when creating, retrieve it when editing a project', () => {
|
2023-04-04 10:46:28 +02:00
|
|
|
//when
|
|
|
|
cleanProject = true;
|
|
|
|
cy.createProject_UI(projectName, TEST_STICKINESS);
|
2023-03-17 13:41:59 +01:00
|
|
|
cy.visit(`/projects/${projectName}`);
|
|
|
|
cy.get("[data-testid='NAVIGATE_TO_EDIT_PROJECT']").click();
|
|
|
|
|
|
|
|
//then
|
|
|
|
cy.get("[id='stickiness-select']")
|
|
|
|
.first()
|
|
|
|
.should('have.text', 'userId');
|
2023-04-04 10:46:28 +02:00
|
|
|
|
|
|
|
//clean
|
|
|
|
cy.request('DELETE', `${baseUrl}/api/admin/projects/${projectName}`);
|
2023-03-17 13:41:59 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should respect the default project stickiness when creating a Gradual Rollout Strategy', () => {
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.createProject_UI(projectName, TEST_STICKINESS);
|
|
|
|
cy.createFeature_UI(featureToggleName, true, projectName);
|
|
|
|
cleanFeature = true;
|
|
|
|
|
|
|
|
//when - then
|
|
|
|
cy.addFlexibleRolloutStrategyToFeature_UI({
|
|
|
|
featureToggleName,
|
|
|
|
project: projectName,
|
|
|
|
stickiness: TEST_STICKINESS,
|
|
|
|
});
|
|
|
|
|
|
|
|
//clean
|
|
|
|
});
|
|
|
|
|
2023-04-05 10:20:50 +02:00
|
|
|
it.skip('should respect the default project stickiness when creating a variant', () => {
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.createProject_UI(projectName, TEST_STICKINESS);
|
|
|
|
cy.createFeature_UI(featureToggleName, true, projectName);
|
|
|
|
|
|
|
|
//when
|
2023-03-17 13:41:59 +01:00
|
|
|
cy.visit(
|
2023-04-04 10:46:28 +02:00
|
|
|
`/projects/${projectName}/features/${featureToggleName}/variants`
|
2023-03-17 13:41:59 +01:00
|
|
|
);
|
|
|
|
|
2023-04-04 10:46:28 +02:00
|
|
|
cy.get("[data-testid='ADD_VARIANT_BUTTON']").first().click();
|
2023-03-17 13:41:59 +01:00
|
|
|
//then
|
|
|
|
cy.get("[id='stickiness-select']")
|
|
|
|
.first()
|
|
|
|
.should('have.text', 'userId');
|
|
|
|
|
2023-04-04 10:46:28 +02:00
|
|
|
//clean
|
|
|
|
cy.deleteFeature_API(featureToggleName);
|
|
|
|
cy.deleteProject_API(projectName);
|
2023-03-17 13:41:59 +01:00
|
|
|
});
|
|
|
|
});
|