@siteimprove/alfa-cypress 0.72.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,257 @@
1
+ # @siteimprove/alfa-cypress
2
+
3
+ ## 0.72.2
4
+
5
+ ## 0.72.1
6
+
7
+ ## 0.72.0
8
+
9
+ ### Minor Changes
10
+
11
+ - **Changed:** Dummy minor version to experiment with publish flow, use the previous or next minor version instead. ([`4daf29d`](https://github.com/Siteimprove/alfa-integrations/commit/4daf29d55745310b6ac845f963b306a4f0e57b08))
12
+
13
+ ## 0.71.2
14
+
15
+ ### Patch Changes
16
+
17
+ - **Changed:** Update Alfa to ^0.92.0 ([#78](https://github.com/Siteimprove/alfa-integrations/pull/78))
18
+
19
+ ## 0.71.1
20
+
21
+ ## 0.71.0
22
+
23
+ ## 0.70.1
24
+
25
+ ### Patch Changes
26
+
27
+ - **Changed:** Update Alfa ([#75](https://github.com/Siteimprove/alfa-integrations/pull/75))
28
+
29
+ ## 0.70.0
30
+
31
+ ### Minor Changes
32
+
33
+ - **Changed:** Update Alfa ([#68](https://github.com/Siteimprove/alfa-integrations/pull/68))
34
+
35
+ ## 0.69.1
36
+
37
+ ## 0.69.0
38
+
39
+ ## 0.68.4
40
+
41
+ ## 0.68.3
42
+
43
+ ### Patch Changes
44
+
45
+ - **Changed:** Update Alfa ([#54](https://github.com/Siteimprove/alfa-integrations/pull/54))
46
+
47
+ ## 0.68.2
48
+
49
+ ### Patch Changes
50
+
51
+ - **Changed:** Update Alfa. ([#53](https://github.com/Siteimprove/alfa-integrations/pull/53))
52
+
53
+ ## 0.68.1
54
+
55
+ ### Patch Changes
56
+
57
+ - **Changed:** Update Alfa ([#52](https://github.com/Siteimprove/alfa-integrations/pull/52))
58
+
59
+ ## 0.68.0
60
+
61
+ ### Minor Changes
62
+
63
+ - - **Breaking:** TS resolution has been changed to `Node16`, target to `es2022`. ([#50](https://github.com/Siteimprove/alfa-integrations/pull/50))
64
+
65
+ - - **Breaking:** Alfa is now distributed as ESM rather than CJS modules; projects using it must be ESM or use dynamic `import()`. ([#50](https://github.com/Siteimprove/alfa-integrations/pull/50))
66
+
67
+ ⚠️ This is the last of a series of changes on the internal structure and build process of distributed packages that was started with v0.67.0.
68
+
69
+ ## 0.67.0
70
+
71
+ ### Minor Changes
72
+
73
+ - **Breaking:** The .js files are now built in the dist folder rather than in src. ([#49](https://github.com/Siteimprove/alfa-integrations/pull/49))
74
+
75
+ ⚠️ This is the first of a series of changes on the internal structure and build process of distributed packages. It is probably better to not use this version and wait until more of these internal changes have been done to jump directly to the final result. We are internally releasing these changes for validation purpose only.
76
+
77
+ This should not impact consumers, the package.json files should be set correctly to consume these files.
78
+
79
+ ## 0.66.3
80
+
81
+ ### Patch Changes
82
+
83
+ - **Changed:** Update Alfa. ([#47](https://github.com/Siteimprove/alfa-integrations/pull/47))
84
+
85
+ ## 0.66.2
86
+
87
+ ### Patch Changes
88
+
89
+ - **Changed:** Update Alfa ([#46](https://github.com/Siteimprove/alfa-integrations/pull/46))
90
+
91
+ ## 0.66.1
92
+
93
+ ### Patch Changes
94
+
95
+ - **Changed:** Update Alfa to ^0.83.1 ([#45](https://github.com/Siteimprove/alfa-integrations/pull/45))
96
+
97
+ ## 0.66.0
98
+
99
+ ### Minor Changes
100
+
101
+ - **Added:** Package dependency graphs are now included in the documentation. ([#43](https://github.com/Siteimprove/alfa-integrations/pull/43))
102
+
103
+ ### Patch Changes
104
+
105
+ - **Changed:** Update Alfa. ([#44](https://github.com/Siteimprove/alfa-integrations/pull/44))
106
+
107
+ ## 0.65.2
108
+
109
+ ### Patch Changes
110
+
111
+ - **Changed:** Update Alfa ([#42](https://github.com/Siteimprove/alfa-integrations/pull/42))
112
+
113
+ ## 0.65.1
114
+
115
+ ### Patch Changes
116
+
117
+ - **Changed:** Update Alfa. ([#41](https://github.com/Siteimprove/alfa-integrations/pull/41))
118
+
119
+ ## 0.65.0
120
+
121
+ ### Minor Changes
122
+
123
+ - **Breaking:** `toPage` is now `async`. ([#40](https://github.com/Siteimprove/alfa-integrations/pull/40))
124
+
125
+ ### Patch Changes
126
+
127
+ - **Changed:** Update Alfa to ^0.79.1 ([#40](https://github.com/Siteimprove/alfa-integrations/pull/40))
128
+
129
+ ## 0.64.11
130
+
131
+ ### Patch Changes
132
+
133
+ - **Changed:** Update Alfa to ^0.77.0 ([#38](https://github.com/Siteimprove/alfa-integrations/pull/38))
134
+
135
+ - **Changed:** Updated Alfa. ([#39](https://github.com/Siteimprove/alfa-integrations/pull/39))
136
+
137
+ ## 0.64.10
138
+
139
+ ### Patch Changes
140
+
141
+ - **Changed:** Update Alfa to ^0.76.0 ([#37](https://github.com/Siteimprove/alfa-integrations/pull/37))
142
+
143
+ ## 0.64.9
144
+
145
+ ### Patch Changes
146
+
147
+ - **Changed:** Update Alfa to ^0.75.0 ([#36](https://github.com/Siteimprove/alfa-integrations/pull/36))
148
+
149
+ ## 0.64.8
150
+
151
+ ### Patch Changes
152
+
153
+ - **Changed:** Update Alfa to ^0.74.0 ([#34](https://github.com/Siteimprove/alfa-integrations/pull/34))
154
+
155
+ ## 0.64.7
156
+
157
+ ### Patch Changes
158
+
159
+ - **Changed:** Update Alfa ([#33](https://github.com/Siteimprove/alfa-integrations/pull/33))
160
+
161
+ ## 0.64.6
162
+
163
+ ### Patch Changes
164
+
165
+ - **Changed:** Update to Alfa v0.73.0 ([#32](https://github.com/Siteimprove/alfa-integrations/pull/32))
166
+
167
+ ## 0.64.5
168
+
169
+ ### Patch Changes
170
+
171
+ - **Changed:** Update Alfa to v0.72.0 ([#31](https://github.com/Siteimprove/alfa-integrations/pull/31))
172
+
173
+ ## 0.64.4
174
+
175
+ ### Patch Changes
176
+
177
+ - **Changed:** Each package now has peer dependencies to the main Alfa packages it uses. ([#30](https://github.com/Siteimprove/alfa-integrations/pull/30))
178
+
179
+ This should ease problem with code downstream that tries to Ix, e.g., `Option` from different versions of the package and fail to build.
180
+
181
+ - **Changed:** Update Alfa to version 0.71.0. ([#30](https://github.com/Siteimprove/alfa-integrations/pull/30))
182
+
183
+ ## 0.64.3
184
+
185
+ ### Patch Changes
186
+
187
+ - **Changed:** Update Alfa. ([#29](https://github.com/Siteimprove/alfa-integrations/pull/29))
188
+
189
+ ## 0.64.2
190
+
191
+ ## 0.64.1
192
+
193
+ ### Patch Changes
194
+
195
+ - **Changed:** Update Alfa. ([`c8699c0`](https://github.com/Siteimprove/alfa-integrations/commit/c8699c081dfa36b407dbecc51baf1e11739e2537))
196
+
197
+ ## 0.64.0
198
+
199
+ ### Patch Changes
200
+
201
+ - **Changed:** Update to Alfa v0.68.0 ([#26](https://github.com/Siteimprove/alfa-integrations/pull/26))
202
+
203
+ ## 0.63.1
204
+
205
+ ### Patch Changes
206
+
207
+ - **Fixed:** Set up correct permissions in the release workflow ([`c47b1c9`](https://github.com/Siteimprove/alfa-integrations/commit/c47b1c9b3eb79ded5c872f3e31d0b33c9140c039))
208
+
209
+ ## 0.63.0
210
+
211
+ ### Minor Changes
212
+
213
+ - **Changed:** Update release flow to newer version ([#24](https://github.com/Siteimprove/alfa-integrations/pull/24))
214
+
215
+ ### Patch Changes
216
+
217
+ - **Changed:** Update Alfa to version 0.67.0 ([#24](https://github.com/Siteimprove/alfa-integrations/pull/24))
218
+
219
+ ## 0.62.11
220
+
221
+ ### Patch Changes
222
+
223
+ - **Changes:** Updated Alfa to v0.66.0 ([`f8c0275`](https://github.com/Siteimprove/alfa-integrations/commit/f8c0275d9eadc6e98ad9aa9f2a17bb95b12d4859))
224
+
225
+ ## 0.62.10
226
+
227
+ ### Patch Changes
228
+
229
+ - **Added:** Updated Alfa to v0.65.0 ([#19](https://github.com/Siteimprove/alfa-integrations/pull/19))
230
+
231
+ Functions that are building `Element` directly now add an empty box to them.
232
+
233
+ ## 0.62.9
234
+
235
+ ### Patch Changes
236
+
237
+ - **Changed:** Update Alfa to 0.64.0 ([#17](https://github.com/Siteimprove/alfa-integrations/pull/17))
238
+
239
+ ## 0.62.8
240
+
241
+ ### Patch Changes
242
+
243
+ - Update Alfa to 0.63.1 ([#10](https://github.com/Siteimprove/alfa-integrations/pull/10))
244
+
245
+ ## 0.62.7
246
+
247
+ ### Patch Changes
248
+
249
+ - **Updated:** Adapt to latest Alfa ([#9](https://github.com/Siteimprove/alfa-integrations/pull/9))
250
+
251
+ Replace the `Result#get`/`Result#getErr` with the new `Unsafe` versions.
252
+
253
+ ## 0.62.6
254
+
255
+ ## 0.62.5
256
+
257
+ ## 0.62.4
@@ -0,0 +1,44 @@
1
+ /// <reference types="cypress" preserve="true" />
2
+ /// <reference lib="dom" preserve="true" />
3
+ import type { Question } from "@siteimprove/alfa-act";
4
+ import { Asserter, type Handler } from "@siteimprove/alfa-assert";
5
+ import type { Formatter } from "@siteimprove/alfa-formatter";
6
+ import type { Hashable } from "@siteimprove/alfa-hash";
7
+ import type { Mapper } from "@siteimprove/alfa-mapper";
8
+ import { Page } from "@siteimprove/alfa-web";
9
+ import type * as act from "@siteimprove/alfa-act";
10
+ declare global {
11
+ namespace Chai {
12
+ interface Assertion {
13
+ accessible(): Promise<void>;
14
+ }
15
+ }
16
+ namespace Cypress {
17
+ interface Chainer<Subject> {
18
+ (chainer: "be.accessible"): Chainable<Subject>;
19
+ (chainer: "not.be.accessible"): Chainable<Subject>;
20
+ }
21
+ }
22
+ }
23
+ /**
24
+ * @public
25
+ */
26
+ export declare namespace Cypress {
27
+ function createPlugin<T extends Hashable, Q extends Question.Metadata = {}, S = T>(rules: Iterable<act.Rule<Page, T, Q, S>>, handlers?: Iterable<Handler<Page, T, Q, S>>, options?: Asserter.Options<Page, T, Q, S>): globalThis.Chai.ChaiPlugin;
28
+ type Type = globalThis.Node | globalThis.JQuery;
29
+ function toPage(value: Type): Promise<Page>;
30
+ namespace Handler {
31
+ /**
32
+ * @remarks
33
+ * Cypress has this rather odd model of relying on synchronously enqueued
34
+ * hooks and commands to provide a feeling of using a synchronous API. As
35
+ * the handler will run _as part of_ a command, this means that we can't
36
+ * register any additional commands when the handler runs; this must instead
37
+ * be handled beforehand. The handler therefore starts by registering an
38
+ * `after()` hook that will write any files collected during the test run
39
+ * _after_ the tests are done.
40
+ */
41
+ function persist<I, T extends Hashable, Q extends Question.Metadata, S>(output: Mapper<I, string>, format?: Formatter<I, T, Q, S>): Handler<I, T, Q, S>;
42
+ }
43
+ }
44
+ //# sourceMappingURL=cypress.d.ts.map
@@ -0,0 +1,80 @@
1
+ /// <reference lib="dom" preserve="true" />
2
+ /// <reference types="cypress" preserve="true" />
3
+ import { Asserter } from "@siteimprove/alfa-assert";
4
+ import { Device } from "@siteimprove/alfa-device";
5
+ import { Document, Node } from "@siteimprove/alfa-dom";
6
+ import { Request, Response } from "@siteimprove/alfa-http";
7
+ import { Page } from "@siteimprove/alfa-web";
8
+ import * as device from "@siteimprove/alfa-device/native";
9
+ import * as dom from "@siteimprove/alfa-dom/native";
10
+ import earl from "@siteimprove/alfa-formatter-earl";
11
+ /**
12
+ * @public
13
+ */
14
+ export var Cypress;
15
+ (function (Cypress) {
16
+ function createPlugin(rules, handlers = [], options = {}) {
17
+ const asserter = Asserter.of(rules, handlers, options);
18
+ return (chai) => {
19
+ chai.Assertion.addMethod("accessible", async function () {
20
+ const input = await toPage(this._obj);
21
+ const result = asserter
22
+ .expect(input)
23
+ .to.be.accessible()
24
+ // Cypress has aversions towards promises and asynchronous functions.
25
+ // We therefore have to synchronously unwrap the future, which it is
26
+ // fortunately designed for. This _will_ panic if the value isn't
27
+ // available, but this shouldn't happen in practice as the assertion
28
+ // handlers can't be asynchronous either.
29
+ // https://github.com/cypress-io/cypress/issues/4742
30
+ .get();
31
+ const message = result.isOk() ? result.get() : result.getErrUnsafe();
32
+ this.assert(result.isOk(), `expected #{this} to be accessible${result.isErr() ? ` but ${message}` : ""}`, `expected #{this} to not be accessible${result.isOk() ? ` but ${message}` : ""}`,
33
+ /* Expected */ true,
34
+ /* Actual */ result.isOk(),
35
+ /* Show diff */ false);
36
+ });
37
+ };
38
+ }
39
+ Cypress.createPlugin = createPlugin;
40
+ async function toPage(value) {
41
+ if ("jquery" in value) {
42
+ value = value.get(0);
43
+ }
44
+ const nodeJSON = await dom.Native.fromNode(value);
45
+ const deviceJSON = device.Native.fromWindow(window);
46
+ const pageDevice = Device.from(deviceJSON);
47
+ return Page.of(Request.empty(), Response.empty(), nodeJSON.type === "document"
48
+ ? Document.from(nodeJSON, pageDevice)
49
+ : Document.of([Node.from(nodeJSON, pageDevice)]), pageDevice);
50
+ }
51
+ Cypress.toPage = toPage;
52
+ let Handler;
53
+ (function (Handler) {
54
+ /**
55
+ * @remarks
56
+ * Cypress has this rather odd model of relying on synchronously enqueued
57
+ * hooks and commands to provide a feeling of using a synchronous API. As
58
+ * the handler will run _as part of_ a command, this means that we can't
59
+ * register any additional commands when the handler runs; this must instead
60
+ * be handled beforehand. The handler therefore starts by registering an
61
+ * `after()` hook that will write any files collected during the test run
62
+ * _after_ the tests are done.
63
+ */
64
+ function persist(output, format = earl()) {
65
+ const files = new Map();
66
+ after(() => {
67
+ for (const [file, data] of files) {
68
+ cy.writeFile(file, data);
69
+ }
70
+ });
71
+ return (input, rules, outcomes, message) => {
72
+ const file = output(input);
73
+ files.set(file, format(input, rules, outcomes) + "\n");
74
+ return `${message}, see the full report at ${file}`;
75
+ };
76
+ }
77
+ Handler.persist = persist;
78
+ })(Handler = Cypress.Handler || (Cypress.Handler = {}));
79
+ })(Cypress || (Cypress = {}));
80
+ //# sourceMappingURL=cypress.js.map
@@ -0,0 +1,2 @@
1
+ export * from "./cypress.js";
2
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./cypress.js";
2
+ //# sourceMappingURL=index.js.map
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "$schema": "http://json.schemastore.org/package",
3
+ "name": "@siteimprove/alfa-cypress",
4
+ "homepage": "https://alfa.siteimprove.com",
5
+ "version": "0.72.2",
6
+ "license": "MIT",
7
+ "description": "Integrations and utilities for the Cypress testing framework",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "github:Siteimprove/alfa-integrations",
11
+ "directory": "packages/alfa-cypress"
12
+ },
13
+ "bugs": "https://github.com/siteimprove/alfa/issues",
14
+ "engines": {
15
+ "node": ">=20.0.0"
16
+ },
17
+ "type": "module",
18
+ "main": "dist/index.js",
19
+ "types": "dist/index.d.ts",
20
+ "files": [
21
+ "dist/**/*.js",
22
+ "dist/**/*.d.ts"
23
+ ],
24
+ "dependencies": {
25
+ "@siteimprove/alfa-act": "^0.92.0",
26
+ "@siteimprove/alfa-assert": "^0.72.2",
27
+ "@siteimprove/alfa-device": "^0.92.0",
28
+ "@siteimprove/alfa-dom": "^0.92.0",
29
+ "@siteimprove/alfa-formatter": "^0.72.2",
30
+ "@siteimprove/alfa-formatter-earl": "^0.72.2",
31
+ "@siteimprove/alfa-hash": "^0.92.0",
32
+ "@siteimprove/alfa-http": "^0.92.0",
33
+ "@siteimprove/alfa-mapper": "^0.92.0",
34
+ "@siteimprove/alfa-web": "^0.92.0",
35
+ "cypress": "^13.3.1"
36
+ },
37
+ "peerDependencies": {
38
+ "@siteimprove/alfa-act": "^0.92.0",
39
+ "@siteimprove/alfa-device": "^0.92.0",
40
+ "@siteimprove/alfa-dom": "^0.92.0",
41
+ "@siteimprove/alfa-hash": "^0.92.0",
42
+ "@siteimprove/alfa-http": "^0.92.0",
43
+ "@siteimprove/alfa-mapper": "^0.92.0",
44
+ "@siteimprove/alfa-web": "^0.92.0"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public",
48
+ "registry": "https://npm.pkg.github.com/"
49
+ }
50
+ }