mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
edefa6fc7e
This PR revamps e2e tests, while adding a new one for the interactive demo guide: - Bumps Cypress from `9.7.0` to `12.11.0`; - Bumps Cypress GH action from `v2` to `v5`; - Makes any adjustments needed; - Fixes a lot of issues identified with existing tests; - Adds new `demo.spec.ts` e2e test that covers the entire demo guide flow; **Note:** Currently does not include `demo.spec.ts` in the GH action, as it [fails](https://github.com/Unleash/unleash/actions/runs/4896839575/jobs/8744137231?pr=3656) on step 2.13 (last step of "user-specific" topic). It runs perfectly fine locally, though. Might be placebo, but in general tests seem less flaky now and they may even be faster (especially when not adding the `demo` one, which would always take a long time). |
||
---|---|---|
.. | ||
fixtures | ||
integration | ||
support | ||
global.d.ts | ||
README.md | ||
tsconfig.json |
Unleash Behavioural tests
Add common commands to Cypress
global.d.ts
is where we extend Cypress typesAPI.ts
contains api requests for common actions (great place for cleanup actions)UI.ts
contains common functions for UI operationscommands.ts
is the place to map the functions to a cypress command
Test Format
Ideally each test should manage its own data.
Avoid using after
and afterEach
hooks for cleaning up. According to Cypress docs, there is no guarantee that the functions will run
Suggested Format:
prepare
when
then
clean
Passing (returned) parameters around
it('can add, update and delete a gradual rollout strategy to the development environment', async () => {
cy.addFlexibleRolloutStrategyToFeature_UI({
featureToggleName,
}).then(value => {
strategyId = value;
cy.updateFlexibleRolloutStrategy_UI(featureToggleName, strategyId).then(
() => cy.deleteFeatureStrategy_UI(featureToggleName, strategyId)
);
});
});