@jahia/cypress 3.21.1 → 3.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,18 +4,18 @@ exports.apolloClient = exports.switchApolloClient = void 0;
|
|
|
4
4
|
var core_1 = require("@apollo/client/core");
|
|
5
5
|
var links_1 = require("./links");
|
|
6
6
|
var switchApolloClient = function (config, options) {
|
|
7
|
-
if (config === void 0) { config = {
|
|
7
|
+
if (config === void 0) { config = {}; }
|
|
8
8
|
if (options === void 0) { options = {
|
|
9
9
|
log: true,
|
|
10
10
|
setCurrentApolloClient: true
|
|
11
11
|
}; }
|
|
12
12
|
// Switch context to apollo client
|
|
13
|
-
cy.visit(config.url, { failOnStatusCode: false });
|
|
13
|
+
cy.visit(config.url || Cypress.config().baseUrl, { failOnStatusCode: false });
|
|
14
14
|
return exports.apolloClient(config, options);
|
|
15
15
|
};
|
|
16
16
|
exports.switchApolloClient = switchApolloClient;
|
|
17
17
|
var apolloClient = function (config, options) {
|
|
18
|
-
if (config === void 0) { config = {
|
|
18
|
+
if (config === void 0) { config = {}; }
|
|
19
19
|
if (options === void 0) { options = {
|
|
20
20
|
log: true,
|
|
21
21
|
setCurrentApolloClient: true
|
|
@@ -30,7 +30,7 @@ var apolloClient = function (config, options) {
|
|
|
30
30
|
else {
|
|
31
31
|
headers.authorization = "Basic " + btoa('root:' + Cypress.env('SUPER_USER_PASSWORD'));
|
|
32
32
|
}
|
|
33
|
-
var links = [links_1.uploadLink, links_1.formDataHttpLink(config.url, headers)];
|
|
33
|
+
var links = [links_1.uploadLink, links_1.formDataHttpLink(config.url || Cypress.config().baseUrl, headers)];
|
|
34
34
|
var client = new core_1.ApolloClient({
|
|
35
35
|
link: core_1.from(links),
|
|
36
36
|
cache: new core_1.InMemoryCache(),
|
package/package.json
CHANGED
|
@@ -22,16 +22,16 @@ export type ApolloClientOptions = Cypress.Loggable & {
|
|
|
22
22
|
setCurrentApolloClient: boolean
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export const switchApolloClient = function (config: HostConfig = {
|
|
25
|
+
export const switchApolloClient = function (config: HostConfig = {}, options: ApolloClientOptions = {
|
|
26
26
|
log: true,
|
|
27
27
|
setCurrentApolloClient: true
|
|
28
28
|
}): void {
|
|
29
29
|
// Switch context to apollo client
|
|
30
|
-
cy.visit(config.url, {failOnStatusCode: false});
|
|
30
|
+
cy.visit(config.url || Cypress.config().baseUrl, {failOnStatusCode: false});
|
|
31
31
|
return apolloClient(config, options);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export const apolloClient = function (config: HostConfig = {
|
|
34
|
+
export const apolloClient = function (config: HostConfig = {}, options: ApolloClientOptions = {
|
|
35
35
|
log: true,
|
|
36
36
|
setCurrentApolloClient: true
|
|
37
37
|
}): void {
|
|
@@ -44,7 +44,7 @@ export const apolloClient = function (config: HostConfig = {url: Cypress.config(
|
|
|
44
44
|
headers.authorization = `Basic ${btoa('root:' + Cypress.env('SUPER_USER_PASSWORD'))}`;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const links = [uploadLink, formDataHttpLink(config.url, headers)];
|
|
47
|
+
const links = [uploadLink, formDataHttpLink(config.url || Cypress.config().baseUrl, headers)];
|
|
48
48
|
|
|
49
49
|
const client = new ApolloClient({
|
|
50
50
|
link: from(links),
|