1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-18 00:19:49 +01:00
unleash.unleash/frontend/cypress
Gastón Fournier f718e00b39
fix: frontend tests after Cypress upgrade (#9505)
The fix involved:

1. [Find the first button to click to create a feature
flag](9b4500cded) (there are 2)
2. [Find the button that's not disabled to remove
access](fad627c6b3)
3. [Don't wait for animations](5ce6ca59f5)
except in [this case](f4a7819ad1)
2025-03-11 10:43:26 +01:00
..
fixtures
integration fix: frontend tests after Cypress upgrade (#9505) 2025-03-11 10:43:26 +01:00
oss/feature fix: migrations e2e test (#8965) 2024-12-12 11:19:03 +01:00
support fix: frontend tests after Cypress upgrade (#9505) 2025-03-11 10:43:26 +01:00
global.d.ts test: skip vercel toolbar in e2e tests (#8273) 2024-09-26 12:53:31 +01:00
README.md
tsconfig.json

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

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)
        );
    });
});