1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/frontend/cypress
Nuno Góis eb01b44e69
test: skip vercel toolbar in e2e tests (#8273)
Some e2e Cypress tests were failing due to the Vercel live feedback
toolbar covering interactive elements, preventing test actions from
completing:
https://github.com/Unleash/unleash/actions/runs/11048512034/job/30692949711#step:4:136

This PR addresses the issue by disabling the Vercel toolbar specifically
during Cypress tests. This is done by setting the
`x-vercel-skip-toolbar` header, which Vercel provides to prevent the
toolbar from interfering with automated tests. You can find more
information about this feature in the Vercel documentation: [Disable
Toolbar for
Automation](https://vercel.com/docs/workflow-collaboration/vercel-toolbar/managing-toolbar#disable-toolbar-for-automation).

Specific type declarations were needed due to
https://github.com/cypress-io/cypress/issues/19564
2024-09-26 12:53:31 +01:00
..
fixtures
integration fix: force languages in cypress browser for tests (#8049) 2024-09-03 10:06:58 +00:00
oss/feature
support test: skip vercel toolbar in e2e tests (#8273) 2024-09-26 12:53:31 +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)
        );
    });
});