1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

chore: validate import data using api (#5848)

Use the admin api to validate the feature toggle that has been imported.

This hopefully makes the test less fragile as we do not depend on the
frontend to validate the import.
This commit is contained in:
Gard Rimestad 2024-01-11 09:56:43 +01:00 committed by GitHub
parent 2bff3f010b
commit 623b9b127f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,17 +115,18 @@ describe('imports', () => {
cy.wait(1500); cy.wait(1500);
cy.visit(`/projects/default/features/${randomFeatureName}`); cy.request({
url: `/api/admin/projects/default/features/${randomFeatureName}`,
headers: { 'Content-Type': 'application/json' },
}).then((response) => {
expect(response.body.name).to.equal(randomFeatureName);
const devEnv = response.body.environments.find(
(env: any) => env.name === 'development',
);
cy.get( expect(devEnv.name).to.equal('development');
"[data-testid='feature-toggle-status'] input[type='checkbox']:checked", expect(devEnv.strategies[0].parameters.rollout).to.equal('50');
) expect(devEnv.enabled).to.equal(true);
.invoke('attr', 'aria-label') });
.should('eq', 'development');
cy.get(
'[data-testid="FEATURE_ENVIRONMENT_ACCORDION_development"]',
).click();
cy.contains('50%');
}); });
}); });