diff --git a/frontend/cypress/global.d.ts b/frontend/cypress/global.d.ts index b1180ed914be..eeb25b91a917 100644 --- a/frontend/cypress/global.d.ts +++ b/frontend/cypress/global.d.ts @@ -93,5 +93,14 @@ declare namespace Cypress { environment: IEnvironment, options?: Partial, ): Chainable; + visit( + options: Partial & { + url: string; + }, + ): Cypress.Chainable; + visit( + url: string, + options?: Partial, + ): Cypress.Chainable; } } diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 741fd4314ed4..07da1e70aea1 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -58,3 +58,13 @@ Cypress.Commands.add( updateFlexibleRolloutStrategy_UI, ); Cypress.Commands.add('createEnvironment_API', createEnvironment_API); +Cypress.Commands.overwrite('visit', (originalFn, url, options = {}) => { + if (!options.headers) { + options.headers = {}; + } + + // Add the x-vercel-skip-toolbar header. See: https://vercel.com/docs/workflow-collaboration/vercel-toolbar/managing-toolbar#disable-toolbar-for-automation + options.headers['x-vercel-skip-toolbar'] = '1'; + + return originalFn(url, options); +});