1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/frontend/cypress/global.d.ts
Nuno Góis edefa6fc7e
test: add interactive demo guide e2e test (#3656)
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).
2023-05-08 09:16:18 +01:00

94 lines
2.6 KiB
TypeScript

/// <reference types="cypress" />
declare namespace Cypress {
interface AddFlexibleRolloutStrategyOptions {
featureToggleName: string;
project?: string;
environment?: string;
stickiness?: string;
}
interface UserCredentials {
email: string;
password: string;
}
interface IEnvironment {
name: string;
type: 'development' | 'preproduction' | 'test' | 'production';
}
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,
projectName?: string
): Chainable;
addFlexibleRolloutStrategyToFeature_UI(
options: AddFlexibleRolloutStrategyOptions
): Chainable;
updateFlexibleRolloutStrategy_UI(featureToggleName: string);
deleteFeatureStrategy_UI(
featureName: 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,
options?: Partial<Cypress.RequestOptions>
): Chainable;
deleteProject_API(name: string): Chainable;
createFeature_API(
name: string,
projectName?: string,
options?: Partial<Cypress.RequestOptions>
): Chainable;
deleteFeature_API(name: string): Chainable;
createEnvironment_API(
environment: IEnvironment,
options?: Partial<Cypress.RequestOptions>
): Chainable;
}
}