@siteimprove/alfa-cypress 0.76.0 → 0.76.1
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.
- package/CHANGELOG.md +13 -0
- package/dist/cypress.js +21 -2
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @siteimprove/alfa-cypress
|
|
2
2
|
|
|
3
|
+
## 0.76.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- **Added:** The page URL is now correctly filled when grabbing the page. ([#116](https://github.com/Siteimprove/alfa-integrations/pull/116))
|
|
8
|
+
|
|
9
|
+
A full `Request` and `Response` are build, with sensible values:
|
|
10
|
+
|
|
11
|
+
- The request is assumed to be a GET.
|
|
12
|
+
- The response is assumed to be a 200 OK with HTMl content.
|
|
13
|
+
|
|
14
|
+
These values are not always correct, but should be in most cases. It is not really possible to build better values because the actual request and response may be long lost by the time one decides to call `.toPage`.
|
|
15
|
+
|
|
3
16
|
## 0.76.0
|
|
4
17
|
|
|
5
18
|
## 0.75.0
|
package/dist/cypress.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { Asserter } from "@siteimprove/alfa-assert";
|
|
4
4
|
import { Device } from "@siteimprove/alfa-device";
|
|
5
5
|
import { Document, Node } from "@siteimprove/alfa-dom";
|
|
6
|
-
import { Request, Response } from "@siteimprove/alfa-http";
|
|
6
|
+
import { Header, Headers, Request, Response } from "@siteimprove/alfa-http";
|
|
7
|
+
import { URL } from "@siteimprove/alfa-url";
|
|
7
8
|
import { Page } from "@siteimprove/alfa-web";
|
|
8
9
|
import * as device from "@siteimprove/alfa-device/native";
|
|
9
10
|
import * as dom from "@siteimprove/alfa-dom/native";
|
|
@@ -51,7 +52,25 @@ export var Cypress;
|
|
|
51
52
|
: undefined) ?? window;
|
|
52
53
|
const deviceJSON = device.Native.fromWindow(view);
|
|
53
54
|
const pageDevice = Device.from(deviceJSON);
|
|
54
|
-
|
|
55
|
+
/*
|
|
56
|
+
* We cannot really grab the request and response as they may have been
|
|
57
|
+
* long-lost when .toPage is called. We can at least grab the current URL
|
|
58
|
+
* and fill the rest with reasonable defaults values. Given that we do not
|
|
59
|
+
* really use these in the audit, this is mostly OK.
|
|
60
|
+
*
|
|
61
|
+
* Known caveats:
|
|
62
|
+
* * We assume that the request was a GET and the response a 200 OK. This is
|
|
63
|
+
* probably not too wrong in most cases, but can easily be completely off.
|
|
64
|
+
* * We assume that the response was HTML. This is probably mostly correct.
|
|
65
|
+
* * We always return an empty Headers list; this is most likely wrong since
|
|
66
|
+
* at least a Content-Type header should be present on the response.
|
|
67
|
+
*/
|
|
68
|
+
// WARNING: This will throw an exception in the unlikely case that
|
|
69
|
+
// window.location.href is not a valid URL (which should never happen)
|
|
70
|
+
const url = URL.parse(view.location.href).getUnsafe();
|
|
71
|
+
const request = Request.of("GET", url);
|
|
72
|
+
const response = Response.of(url, 200, Headers.of([Header.of("Content-Type", "text/html")]));
|
|
73
|
+
return Page.of(request, response, nodeJSON.type === "document"
|
|
55
74
|
? Document.from(nodeJSON, pageDevice)
|
|
56
75
|
: Document.of([Node.from(nodeJSON, pageDevice)]), pageDevice);
|
|
57
76
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json.schemastore.org/package",
|
|
3
3
|
"name": "@siteimprove/alfa-cypress",
|
|
4
4
|
"homepage": "https://alfa.siteimprove.com",
|
|
5
|
-
"version": "0.76.
|
|
5
|
+
"version": "0.76.1",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Integrations and utilities for the Cypress testing framework",
|
|
8
8
|
"repository": {
|
|
@@ -26,14 +26,15 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@siteimprove/alfa-act": "^0.96.0",
|
|
29
|
-
"@siteimprove/alfa-assert": "^0.76.
|
|
29
|
+
"@siteimprove/alfa-assert": "^0.76.1",
|
|
30
30
|
"@siteimprove/alfa-device": "^0.96.0",
|
|
31
31
|
"@siteimprove/alfa-dom": "^0.96.0",
|
|
32
|
-
"@siteimprove/alfa-formatter": "^0.76.
|
|
33
|
-
"@siteimprove/alfa-formatter-earl": "^0.76.
|
|
32
|
+
"@siteimprove/alfa-formatter": "^0.76.1",
|
|
33
|
+
"@siteimprove/alfa-formatter-earl": "^0.76.1",
|
|
34
34
|
"@siteimprove/alfa-hash": "^0.96.0",
|
|
35
35
|
"@siteimprove/alfa-http": "^0.96.0",
|
|
36
36
|
"@siteimprove/alfa-mapper": "^0.96.0",
|
|
37
|
+
"@siteimprove/alfa-url": "^0.96.0",
|
|
37
38
|
"@siteimprove/alfa-web": "^0.96.0",
|
|
38
39
|
"cypress": "^13.14.2"
|
|
39
40
|
},
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"@siteimprove/alfa-hash": "^0.96.0",
|
|
45
46
|
"@siteimprove/alfa-http": "^0.96.0",
|
|
46
47
|
"@siteimprove/alfa-mapper": "^0.96.0",
|
|
48
|
+
"@siteimprove/alfa-url": "^0.96.0",
|
|
47
49
|
"@siteimprove/alfa-web": "^0.96.0",
|
|
48
50
|
"cypress": "^13.14.2"
|
|
49
51
|
},
|