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
- // get origin (protocol + '//' + host) from current URL
11
- var origin = cy.url().then(function (url) {
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
- return cy
16
- .get(item)
17
- .invoke('attr', 'href')
18
- .then(function (href) {
19
- // If the href is a relative URL, prepend the hostname
20
- if (href.startsWith('/')) {
21
- return origin + href;
22
- }
23
- return href;
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,uDAAuD;QACvD,IAAM,MAAM,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAC,GAAW;YACjC,IAAA,KAAqB,IAAI,GAAG,CAAC,GAAG,CAAC,EAA/B,QAAQ,cAAA,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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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dceky",
3
- "version": "1.0.0-beta-yuenler.3",
3
+ "version": "1.0.0-beta-yuenler.4",
4
4
  "description": "Cypress toolkit for Harvard DCE",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -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
- .get(item)
41
- .invoke('attr', 'href')
42
- .then((href: string) => {
43
- // If the href is a relative URL, prepend the hostname
44
- if (href.startsWith('/')) {
45
- return origin + href;
46
- }
47
- return href;
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
  );