Skip to content

Commit

Permalink
Fixed an issue with providing auth values without URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Fgerthoffert committed Jul 11, 2024
1 parent ce92f00 commit 5a9805d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jahia/cypress",
"version": "3.21.1",
"version": "3.21.2",
"scripts": {
"build": "tsc",
"lint": "eslint src -c .eslintrc.json --ext .ts"
Expand Down
8 changes: 4 additions & 4 deletions src/support/apollo/apolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ export type ApolloClientOptions = Cypress.Loggable & {
setCurrentApolloClient: boolean
}

export const switchApolloClient = function (config: HostConfig = {url: Cypress.config().baseUrl}, options: ApolloClientOptions = {
export const switchApolloClient = function (config: HostConfig = {}, options: ApolloClientOptions = {
log: true,
setCurrentApolloClient: true
}): void {
// Switch context to apollo client
cy.visit(config.url, {failOnStatusCode: false});
cy.visit(config.url || Cypress.config().baseUrl, {failOnStatusCode: false});
return apolloClient(config, options);
};

export const apolloClient = function (config: HostConfig = {url: Cypress.config().baseUrl}, options: ApolloClientOptions = {
export const apolloClient = function (config: HostConfig = {}, options: ApolloClientOptions = {
log: true,
setCurrentApolloClient: true
}): void {
Expand All @@ -44,7 +44,7 @@ export const apolloClient = function (config: HostConfig = {url: Cypress.config(
headers.authorization = `Basic ${btoa('root:' + Cypress.env('SUPER_USER_PASSWORD'))}`;
}

const links = [uploadLink, formDataHttpLink(config.url, headers)];
const links = [uploadLink, formDataHttpLink(config.url || Cypress.config().baseUrl, headers)];

const client = new ApolloClient({
link: from(links),
Expand Down

0 comments on commit 5a9805d

Please sign in to comment.