mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
b4fde58fa0
https://linear.app/unleash/issue/2-2826/enabling-environment-via-feature-flag-environment-section-header https://linear.app/unleash/issue/2-2825/feature-flag-list-bottom-left-to-be-a-nav-section Follow-up to: https://github.com/Unleash/unleash/pull/8663 Implements most of the remaining work for our flag overview page redesign. Most of the code you see is a straight copy/paste from our older existing components, with the slight improvement here and there. Includes some improvements to our vertical tabs component to suit our use case. Also updates the Demo flow accordingly. I did some manual tests and it seems to work decently in both scenarios, whether `flagOverviewRedesign` is enabled or not. The demo needs some love but that's a story for a different PR and a different time. Once again, due to the duplicate file pattern, we should remember to clean this up if we decide to remove the flag. <img width="1086" alt="image" src="https://github.com/user-attachments/assets/0c375e34-cbb5-4ac4-a764-39a36b6c6781">
132 lines
4.4 KiB
TypeScript
132 lines
4.4 KiB
TypeScript
///<reference path="../../global.d.ts" />
|
|
import { TOPICS } from '../../../src/component/demo/demo-topics';
|
|
|
|
describe('demo', () => {
|
|
const baseUrl = Cypress.config().baseUrl;
|
|
const randomId = String(Math.random()).split('.')[1];
|
|
|
|
before(() => {
|
|
cy.runBefore();
|
|
cy.login_UI();
|
|
|
|
const optionsIgnore409 = { failOnStatusCode: false };
|
|
|
|
cy.createEnvironment_API(
|
|
{
|
|
name: 'dev',
|
|
type: 'development',
|
|
},
|
|
optionsIgnore409,
|
|
);
|
|
cy.createProject_API('demo-app', optionsIgnore409);
|
|
cy.createFeature_API('demoApp.step1', 'demo-app', optionsIgnore409);
|
|
cy.createFeature_API('demoApp.step2', 'demo-app', optionsIgnore409);
|
|
cy.createFeature_API('demoApp.step3', 'demo-app', optionsIgnore409);
|
|
cy.createFeature_API('demoApp.step4', 'demo-app', optionsIgnore409);
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.login_UI();
|
|
cy.visit('/projects');
|
|
if (document.querySelector("[data-testid='CLOSE_SPLASH']")) {
|
|
cy.get("[data-testid='CLOSE_SPLASH']").click();
|
|
}
|
|
|
|
cy.intercept('GET', `${baseUrl}/api/admin/ui-config`, (req) => {
|
|
req.headers['cache-control'] =
|
|
'no-cache, no-store, must-revalidate';
|
|
req.on('response', (res) => {
|
|
if (res.body) {
|
|
res.body.flags = {
|
|
...res.body.flags,
|
|
demo: true,
|
|
flagOverviewRedesign: true,
|
|
};
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
cy.intercept('GET', `${baseUrl}/api/admin/ui-config`).as('uiConfig');
|
|
});
|
|
|
|
after(() => {
|
|
cy.request({
|
|
method: 'DELETE',
|
|
url: `${baseUrl}/api/admin/projects/demo-app/features/demoApp.step1`,
|
|
});
|
|
cy.request({
|
|
method: 'DELETE',
|
|
url: `${baseUrl}/api/admin/projects/demo-app/features/demoApp.step2`,
|
|
});
|
|
cy.request({
|
|
method: 'DELETE',
|
|
url: `${baseUrl}/api/admin/projects/demo-app/features/demoApp.step3`,
|
|
});
|
|
cy.request({
|
|
method: 'DELETE',
|
|
url: `${baseUrl}/api/admin/projects/demo-app/features/demoApp.step4`,
|
|
});
|
|
cy.request({
|
|
method: 'POST',
|
|
url: `${baseUrl}/api/admin/projects/demo-app/delete`,
|
|
body: {
|
|
features: [
|
|
'demoApp.step1',
|
|
'demoApp.step2',
|
|
'demoApp.step3',
|
|
'demoApp.step4',
|
|
],
|
|
},
|
|
});
|
|
});
|
|
|
|
it('can complete the demo', () => {
|
|
cy.get('[data-testid="DEMO_START_BUTTON"]').click();
|
|
|
|
for (let topic = 0; topic < TOPICS.length; topic++) {
|
|
const currentTopic = TOPICS[topic];
|
|
for (let step = 0; step < currentTopic.steps.length; step++) {
|
|
const currentStep = currentTopic.steps[step];
|
|
|
|
cy.task(
|
|
'log',
|
|
`Testing topic #${topic + 1} "${
|
|
currentTopic.title
|
|
}", step #${step + 1}...`,
|
|
);
|
|
|
|
if (!currentStep.optional) {
|
|
cy.wait(2000);
|
|
|
|
if (currentStep.nextButton) {
|
|
if (currentStep.focus) {
|
|
if (currentStep.focus === true) {
|
|
cy.get(currentStep.target as string)
|
|
.first()
|
|
.type(randomId, { force: true });
|
|
} else {
|
|
cy.get(currentStep.target as string)
|
|
.first()
|
|
.find(currentStep.focus)
|
|
.first()
|
|
.type(randomId, { force: true });
|
|
}
|
|
}
|
|
cy.get('[data-testid="DEMO_NEXT_BUTTON"]').click({
|
|
force: true,
|
|
});
|
|
} else {
|
|
cy.get(currentStep.target as string)
|
|
.first()
|
|
.click({
|
|
force: true,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|