Skip to content

Commit

Permalink
Tmp 4.22.2 (#3461)
Browse files Browse the repository at this point in the history
<!-- 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! ❤️ -->
Fixes:
- Stickiness accept any string (removed enum)
- UI sync issues when creating project->feature->Flexible rollout
strategy
- Fixes stickiness UI issue when adding variants

## 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>
  • Loading branch information
andreas-unleash committed Apr 5, 2023
1 parent f7f07dd commit 9bd595f
Show file tree
Hide file tree
Showing 24 changed files with 836 additions and 534 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.frontend.yaml
Expand Up @@ -11,7 +11,7 @@ jobs:
- groups/groups.spec.ts
- projects/access.spec.ts
- projects/overview.spec.ts
# - projects/settings.spec.ts
- projects/settings.spec.ts
- projects/notifications.spec.ts
- segments/segments.spec.ts
- import/import.spec.ts
Expand Down
5 changes: 5 additions & 0 deletions frontend/cypress.d.ts
@@ -0,0 +1,5 @@
/// <reference types="cypress" />

declare namespace Cypress {
interface Chainable {}
}
36 changes: 36 additions & 0 deletions frontend/cypress/README.md
@@ -0,0 +1,36 @@
## 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)
);
});
});
```
81 changes: 81 additions & 0 deletions frontend/cypress/global.d.ts
@@ -0,0 +1,81 @@
/// <reference types="cypress" />

declare namespace Cypress {
interface AddFlexibleRolloutStrategyOptions {
featureToggleName: string;
project?: string;
environment?: string;
stickiness?: string;
}

interface UserCredentials {
email: string;
password: string;
}
interface Chainable {
runBefore(): Chainable;

login_UI(user = AUTH_USER, password = AUTH_PASSWORD): Chainable;
logout_UI(): Chainable;

createProject_UI(
projectName: string,
defaultStickiness: string
): Chainable;

createFeature_UI(
name: string,
shouldWait?: boolean,
project?: string
): Chainable;

// VARIANTS
addVariantsToFeature_UI(
featureToggleName: string,
variants: Array<string>,
projectName?: string
);
deleteVariant_UI(
featureToggleName: string,
variant: string,
projectName?: string
): Chainable<any>;

// SEGMENTS
createSegment_UI(segmentName: string): Chainable;
deleteSegment_UI(segmentName: string, id: string): Chainable;

// STRATEGY
addUserIdStrategyToFeature_UI(
featureName: string,
strategyId: string,
projectName?: string
): Chainable;
addFlexibleRolloutStrategyToFeature_UI(
options: AddFlexibleRolloutStrategyOptions
): Chainable;
updateFlexibleRolloutStrategy_UI(
featureToggleName: string,
strategyId: string
);
deleteFeatureStrategy_UI(
featureName: string,
strategyId: string,
shouldWait?: boolean,
projectName?: string
): Chainable;

// API
createUser_API(userName: string, role: number): Chainable;
updateUserPassword_API(id: number, pass?: string): Chainable;
addUserToProject_API(
id: number,
role: number,
projectName?: string
): Chainable;
createProject_API(name: string): Chainable;
deleteProject_API(name: string): Chainable;
createFeature_API(name: string, projectName?: string): Chainable;
deleteFeature_API(name: string): Chainable;
}
}

0 comments on commit 9bd595f

Please sign in to comment.