@harnessed-ts/testcafe 0.0.0-stage → 0.7.0
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 +80 -0
- package/LICENSE +21 -0
- package/README.md +30 -2
- package/dist/driver-id.d.ts +3 -0
- package/dist/driver-id.d.ts.map +1 -0
- package/dist/env.d.ts +24 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.cjs +772 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +768 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +10 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/page-functions.d.ts +77 -0
- package/dist/page-functions.d.ts.map +1 -0
- package/dist/session.d.ts +48 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/testcafe-query.d.ts +117 -0
- package/dist/testcafe-query.d.ts.map +1 -0
- package/package.json +67 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @harnessed-ts/testcafe
|
|
2
|
+
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ec06bdf]
|
|
8
|
+
- @harnessed-ts/core@0.7.0
|
|
9
|
+
- @harnessed-ts/resolve@0.7.0
|
|
10
|
+
|
|
11
|
+
## 0.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- e324e94: ember-test-selectors style test ids: `configure({ testIdAttribute: 'data-test-*' })` makes `testId('x')` match any element that has the attribute `data-test-x`, whatever its value, with the same scoping, strictness, `{ global: true }`, frame and absence rules as before under every driver. A plain attribute name keeps matching by value. A presence id is held to letters, digits, `-`, `_`, `.` and `:`, and anything else (or a `RegExp`) is refused rather than spliced into a selector.
|
|
16
|
+
|
|
17
|
+
`Query.boundingBox()` resolves to `{ x, y, width, height }`: the target's border box in CSS pixels, relative to the top-level viewport, offset by every frame crossed. Strict, and on an absent target it rejects after the timeout, as `text()` does. A node that draws no box reads as all zeros, and so does every node under the dom driver: jsdom computes no layout.
|
|
18
|
+
|
|
19
|
+
`Query.upload(files)` sets the files of an `<input type="file">`, or of the input a `<label>` is for, and fires `input` and `change`, replacing any earlier selection. It refuses any other element, and several files for an input that is not `multiple`. Puppeteer, WebdriverIO and TestCafe take only paths, so there each `File` is written to a temporary directory first: its name and bytes arrive, and the browser infers its type from the extension.
|
|
20
|
+
|
|
21
|
+
`Query` gains two abstract members, so a driver outside this repo implements both to keep compiling; the conformance catalog pins all three changes.
|
|
22
|
+
|
|
23
|
+
`@harnessed-ts/eslint-plugin` supports ESLint 8.57 and legacy `.eslintrc`: the peer range is now `>=8.57`, `legacy-recommended` and `legacy-strict` name the rules under `@harnessed-ts/`, and the CJS build exposes `rules` and `configs` at the top level, where eslintrc reads them.
|
|
24
|
+
|
|
25
|
+
`npx @harnessed-ts/claude install` detects ember-test-selectors attributes (in `.gts`, `.gjs` and `.hbs` files too) and writes `testIdAttribute: 'data-test-*'`.
|
|
26
|
+
|
|
27
|
+
`@harnessed-ts/storybook` writes and finds its story-ready marker under a `data-test-*` config, where `StoryPage` waits for it.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [e324e94]
|
|
32
|
+
- @harnessed-ts/core@0.6.0
|
|
33
|
+
- @harnessed-ts/resolve@0.6.0
|
|
34
|
+
|
|
35
|
+
## 0.5.0
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- @harnessed-ts/core@0.5.0
|
|
40
|
+
- @harnessed-ts/resolve@0.5.0
|
|
41
|
+
|
|
42
|
+
## 0.4.0
|
|
43
|
+
|
|
44
|
+
### Minor Changes
|
|
45
|
+
|
|
46
|
+
- 1823546: `isVisible()`, `waitFor('visible')` and `waitFor('hidden')` on a target matching
|
|
47
|
+
several nodes now reject with the shared strict-mode violation, at once, under
|
|
48
|
+
every driver. The dom, Ember, Vitest browser mode and Cypress drivers answered
|
|
49
|
+
`false` from `isVisible()`, waited out the timeout in `waitFor('visible')`, and —
|
|
50
|
+
worse — resolved `waitFor('hidden')` at once, passing a wait for three rendered
|
|
51
|
+
nodes to disappear; Playwright's waits raised its own wording instead of the
|
|
52
|
+
shared one. An `nth()`
|
|
53
|
+
past the last match answers `false` from `isVisible()` and counts as hidden, as it
|
|
54
|
+
does under Playwright — Puppeteer and TestCafe used to reject it as an index out
|
|
55
|
+
of range.
|
|
56
|
+
|
|
57
|
+
Core exports `StrictModeViolation`, the class `strictViolation()` now returns, so a
|
|
58
|
+
driver can tell ambiguity apart from absence. It is the class a caller catches
|
|
59
|
+
under every driver: core also exports `reviveStrictViolation()`, which the
|
|
60
|
+
Puppeteer, WebdriverIO and TestCafe drivers apply to what the page throws, so
|
|
61
|
+
a violation raised in the page arrives as core's class, worded exactly as an
|
|
62
|
+
in-process driver words it. `instanceof StrictModeViolation` checks a brand
|
|
63
|
+
rather than the prototype, so it holds across two copies of core in one page —
|
|
64
|
+
Cypress bundles the support file and each spec separately.
|
|
65
|
+
|
|
66
|
+
`WaitState` now documents the rule it is held to: a state joins only when every
|
|
67
|
+
driver honours it with the same meaning, so a runner's own states — Playwright's
|
|
68
|
+
`attached` and `detached` — stay out of the shared interface.
|
|
69
|
+
|
|
70
|
+
- 9666a3d: New package `@harnessed-ts/testcafe`: a TestCafe driver. `testcafe(t)` builds the env; lookups run the shared resolver inside the page through TestCafe client functions, actions go through TestCafe, and actions inside a frame switch into each iframe and back. Pages can navigate, and the driver passes the full conformance catalog.
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies [9666a3d]
|
|
75
|
+
- Updated dependencies [9666a3d]
|
|
76
|
+
- Updated dependencies [9666a3d]
|
|
77
|
+
- Updated dependencies [9666a3d]
|
|
78
|
+
- Updated dependencies [1823546]
|
|
79
|
+
- @harnessed-ts/core@0.4.0
|
|
80
|
+
- @harnessed-ts/resolve@0.4.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joe Gaudet, Jay Seo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @harnessed-ts/testcafe
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TestCafe driver for `@harnessed-ts/core`. Lookups run the shared resolver
|
|
4
|
+
(`@harnessed-ts/resolve`) inside the page, so roles, labels, strictness, absence
|
|
5
|
+
and frames mean exactly what they mean under the Testing Library driver;
|
|
6
|
+
TestCafe performs the clicks and the typing.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { testcafe } from '@harnessed-ts/testcafe'
|
|
10
|
+
|
|
11
|
+
fixture('login').page('http://localhost:3000/login')
|
|
12
|
+
|
|
13
|
+
test('signs in', async t => {
|
|
14
|
+
const form = new LoginFormHarness(testcafe(t))
|
|
15
|
+
await form.fillIn({ email: 'ada@example.com', password: 'hopper' })
|
|
16
|
+
await form.submit()
|
|
17
|
+
await t.expect(await form.errorText()).eql(null)
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
No client scripts or hooks to set up: the driver installs the resolver in each
|
|
22
|
+
page the first time a harness touches it. Pages work too — `goto()` resolves a
|
|
23
|
+
relative path against the current page, or against `testcafe(t, { baseUrl })`.
|
|
24
|
+
|
|
25
|
+
There is no `/matchers` entry, because TestCafe asserts with `t.expect`. Await
|
|
26
|
+
the harness and assert on the value, or use `@harnessed-ts/chai`.
|
|
27
|
+
|
|
28
|
+
Full guide, the cross-driver guarantees, and the API: the
|
|
29
|
+
[harnessed README](https://github.com/joegaudet/harnessed#readme).
|
|
30
|
+
|
|
31
|
+
MIT © Joe Gaudet, Jay Seo
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-id.d.ts","sourceRoot":"","sources":["../src/driver-id.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,eAAe,aAAa,CAAA"}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { EnvConfig } from '@harnessed-ts/core';
|
|
2
|
+
import { TESTCAFE_DRIVER } from './driver-id';
|
|
3
|
+
import './testcafe-query';
|
|
4
|
+
export { TESTCAFE_DRIVER };
|
|
5
|
+
export interface TestCafeEnv extends EnvConfig {
|
|
6
|
+
readonly driver: typeof TESTCAFE_DRIVER;
|
|
7
|
+
/** The test's controller. Every action goes through it, so an env is per test. */
|
|
8
|
+
readonly t: TestController;
|
|
9
|
+
/**
|
|
10
|
+
* What a page's relative path resolves against in `goto()`. Without it, the
|
|
11
|
+
* page the test is on — which is the fixture's page when a test starts.
|
|
12
|
+
*/
|
|
13
|
+
readonly baseUrl?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TestCafeEnvOptions {
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Builds the env a harness is constructed with under TestCafe. `t` is the one
|
|
20
|
+
* the test function is handed — not the shared `t` exported by 'testcafe',
|
|
21
|
+
* which belongs to no one test.
|
|
22
|
+
*/
|
|
23
|
+
export declare function testcafe(t: TestController, options?: TestCafeEnvOptions): TestCafeEnv;
|
|
24
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG7C,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,CAAA;AAE1B,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,QAAQ,CAAC,MAAM,EAAE,OAAO,eAAe,CAAA;IACvC,kFAAkF;IAClF,QAAQ,CAAC,CAAC,EAAE,cAAc,CAAA;IAC1B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAKzF"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function messageOf(error: unknown): string;
|
|
2
|
+
/**
|
|
3
|
+
* TestCafe rejects with plain objects. The specs, the page package and any
|
|
4
|
+
* `catch` in a test expect an `Error` whose message is the cause — for an error
|
|
5
|
+
* thrown in the page that is the resolver's own wording, so a strict-mode
|
|
6
|
+
* violation reads the same here as under every other driver, and comes back as
|
|
7
|
+
* core's `StrictModeViolation`.
|
|
8
|
+
*
|
|
9
|
+
* `context` says what was being attempted, as a verb phrase: `act on testId(x)`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function toError(error: unknown, context?: string): Error;
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAiCA,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAkB/D"}
|