dceky 1.0.0-beta-yuenler.3 → 1.0.0-beta-yuenler.4
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.
|
@@ -7,20 +7,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
var navigateToHref = function () {
|
|
8
8
|
Cypress.Commands.add('navigateToHref', function (item) {
|
|
9
9
|
cy.waitForElementVisible(item);
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
return cy
|
|
11
|
+
.url()
|
|
12
|
+
// get origin (protocol + '//' + host) from current URL
|
|
13
|
+
.then(function (url) {
|
|
12
14
|
var _a = new URL(url), protocol = _a.protocol, host = _a.host;
|
|
13
15
|
return "".concat(protocol, "//").concat(host);
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
})
|
|
17
|
+
.then(function (origin) {
|
|
18
|
+
return cy
|
|
19
|
+
.get(item)
|
|
20
|
+
.invoke('attr', 'href')
|
|
21
|
+
.then(function (href) {
|
|
22
|
+
// If the href is a relative URL, prepend the hostname
|
|
23
|
+
if (href.startsWith('/')) {
|
|
24
|
+
return origin + href;
|
|
25
|
+
}
|
|
26
|
+
return href;
|
|
27
|
+
});
|
|
24
28
|
});
|
|
25
29
|
});
|
|
26
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigateToHref.js","sourceRoot":"","sources":["../../src/commands/navigateToHref.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAoBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAAY;QAEZ,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAE/B,
|
|
1
|
+
{"version":3,"file":"navigateToHref.js","sourceRoot":"","sources":["../../src/commands/navigateToHref.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAoBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAAY;QAEZ,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAE/B,OAAO,EAAE;aACN,GAAG,EAAE;YACN,uDAAuD;aACtD,IAAI,CAAC,UAAC,GAAW;YACV,IAAA,KAAqB,IAAI,GAAG,CAAC,GAAG,CAAC,EAA/B,QAAQ,cAAA,EAAE,IAAI,UAAiB,CAAC;YACxC,OAAO,UAAG,QAAQ,eAAK,IAAI,CAAE,CAAC;QAChC,CAAC,CAAC;aACD,IAAI,CAAC,UAAC,MAAc;YACnB,OAAO,EAAE;iBACN,GAAG,CAAC,IAAI,CAAC;iBACT,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;iBACtB,IAAI,CAAC,UAAC,IAAY;gBACjB,sDAAsD;gBACtD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBACzB,OAAO,MAAM,GAAG,IAAI,CAAC;gBACvB,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -30,21 +30,24 @@ const navigateToHref = () => {
|
|
|
30
30
|
) => {
|
|
31
31
|
cy.waitForElementVisible(item);
|
|
32
32
|
|
|
33
|
-
// get origin (protocol + '//' + host) from current URL
|
|
34
|
-
const origin = cy.url().then((url: string) => {
|
|
35
|
-
const { protocol, host } = new URL(url);
|
|
36
|
-
return `${protocol}//${host}`;
|
|
37
|
-
});
|
|
38
|
-
|
|
39
33
|
return cy
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
.then((
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return
|
|
34
|
+
.url()
|
|
35
|
+
// get origin (protocol + '//' + host) from current URL
|
|
36
|
+
.then((url: string) => {
|
|
37
|
+
const { protocol, host } = new URL(url);
|
|
38
|
+
return `${protocol}//${host}`;
|
|
39
|
+
})
|
|
40
|
+
.then((origin: string) => {
|
|
41
|
+
return cy
|
|
42
|
+
.get(item)
|
|
43
|
+
.invoke('attr', 'href')
|
|
44
|
+
.then((href: string) => {
|
|
45
|
+
// If the href is a relative URL, prepend the hostname
|
|
46
|
+
if (href.startsWith('/')) {
|
|
47
|
+
return origin + href;
|
|
48
|
+
}
|
|
49
|
+
return href;
|
|
50
|
+
});
|
|
48
51
|
});
|
|
49
52
|
},
|
|
50
53
|
);
|