mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
99c555bf59
Adds proper typescript support. Created reusable commands Added README for cypress test Refactored tests Fixed bugs as I found them. <!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> --------- Signed-off-by: andreas-unleash <andreas@getunleash.ai>
37 lines
1.0 KiB
Markdown
37 lines
1.0 KiB
Markdown
## Unleash Behavioural tests
|
|
|
|
### Add common commands to Cypress
|
|
|
|
- `global.d.ts` is where we extend Cypress types
|
|
- `API.ts` contains api requests for common actions (great place for cleanup actions)
|
|
- `UI.ts` contains common functions for UI operations
|
|
- `commands.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
|
|
|
|
```ts
|
|
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)
|
|
);
|
|
});
|
|
});
|
|
```
|