From da9339a562ce67a2ecf638c9483f96152fc35123 Mon Sep 17 00:00:00 2001 From: "david.griffon" Date: Mon, 8 Jul 2024 15:08:23 +0200 Subject: [PATCH] TECH-1852 : provide switch apollo helper --- src/support/apollo/apolloClient.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/support/apollo/apolloClient.ts b/src/support/apollo/apolloClient.ts index 858899e..2b81fd6 100644 --- a/src/support/apollo/apolloClient.ts +++ b/src/support/apollo/apolloClient.ts @@ -22,6 +22,15 @@ export type ApolloClientOptions = Cypress.Loggable & { setCurrentApolloClient: boolean } +export const switchApolloClient = function (authMethod: AuthMethod = {url: Cypress.config().baseUrl}, options: ApolloClientOptions = { + log: true, + setCurrentApolloClient: true +}): void { + // Switch context to apollo client + cy.visit(authMethod.url, {failOnStatusCode: false}); + return apolloClient(authMethod, options); +}; + export const apolloClient = function (authMethod: AuthMethod = {url: Cypress.config().baseUrl}, options: ApolloClientOptions = { log: true, setCurrentApolloClient: true