@harnessed-ts/puppeteer 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 +79 -0
- package/LICENSE +21 -0
- package/README.md +21 -2
- package/dist/driver-id.d.ts +3 -0
- package/dist/driver-id.d.ts.map +1 -0
- package/dist/env.d.ts +21 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/index.cjs +598 -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 +594 -0
- package/dist/index.js.map +1 -0
- package/dist/matchers.cjs +9 -0
- package/dist/matchers.cjs.map +1 -0
- package/dist/matchers.d.ts +9 -0
- package/dist/matchers.d.ts.map +1 -0
- package/dist/matchers.js +7 -0
- package/dist/matchers.js.map +1 -0
- package/dist/puppeteer-query.d.ts +80 -0
- package/dist/puppeteer-query.d.ts.map +1 -0
- package/dist/resolve.d.ts +80 -0
- package/dist/resolve.d.ts.map +1 -0
- package/package.json +77 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @harnessed-ts/puppeteer
|
|
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
|
+
- 9666a3d: New `@harnessed-ts/puppeteer` driver: `puppeteer(page, { baseURL })` builds the env, selectors resolve through the injected `@harnessed-ts/resolve`, actions go through Puppeteer's `ElementHandle`s, and `frame()` links are entered with `contentFrame()` — cross-origin frames included. It can navigate, and `@harnessed-ts/puppeteer/matchers` registers the matchers with Vitest.
|
|
47
|
+
- 1823546: `isVisible()`, `waitFor('visible')` and `waitFor('hidden')` on a target matching
|
|
48
|
+
several nodes now reject with the shared strict-mode violation, at once, under
|
|
49
|
+
every driver. The dom, Ember, Vitest browser mode and Cypress drivers answered
|
|
50
|
+
`false` from `isVisible()`, waited out the timeout in `waitFor('visible')`, and —
|
|
51
|
+
worse — resolved `waitFor('hidden')` at once, passing a wait for three rendered
|
|
52
|
+
nodes to disappear; Playwright's waits raised its own wording instead of the
|
|
53
|
+
shared one. An `nth()`
|
|
54
|
+
past the last match answers `false` from `isVisible()` and counts as hidden, as it
|
|
55
|
+
does under Playwright — Puppeteer and TestCafe used to reject it as an index out
|
|
56
|
+
of range.
|
|
57
|
+
|
|
58
|
+
Core exports `StrictModeViolation`, the class `strictViolation()` now returns, so a
|
|
59
|
+
driver can tell ambiguity apart from absence. It is the class a caller catches
|
|
60
|
+
under every driver: core also exports `reviveStrictViolation()`, which the
|
|
61
|
+
Puppeteer, WebdriverIO and TestCafe drivers apply to what the page throws, so
|
|
62
|
+
a violation raised in the page arrives as core's class, worded exactly as an
|
|
63
|
+
in-process driver words it. `instanceof StrictModeViolation` checks a brand
|
|
64
|
+
rather than the prototype, so it holds across two copies of core in one page —
|
|
65
|
+
Cypress bundles the support file and each spec separately.
|
|
66
|
+
|
|
67
|
+
`WaitState` now documents the rule it is held to: a state joins only when every
|
|
68
|
+
driver honours it with the same meaning, so a runner's own states — Playwright's
|
|
69
|
+
`attached` and `detached` — stay out of the shared interface.
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [9666a3d]
|
|
74
|
+
- Updated dependencies [9666a3d]
|
|
75
|
+
- Updated dependencies [9666a3d]
|
|
76
|
+
- Updated dependencies [9666a3d]
|
|
77
|
+
- Updated dependencies [1823546]
|
|
78
|
+
- @harnessed-ts/core@0.4.0
|
|
79
|
+
- @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,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @harnessed-ts/puppeteer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Puppeteer driver for `@harnessed-ts/core`. It injects the shared resolver into
|
|
4
|
+
the page, so selectors resolve exactly as they do under the other drivers, and
|
|
5
|
+
acts through `ElementHandle`s, so input is real browser input. Frames are entered
|
|
6
|
+
with `contentFrame()`, cross-origin ones included.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { puppeteer } from '@harnessed-ts/puppeteer'
|
|
10
|
+
import '@harnessed-ts/puppeteer/matchers' // Vitest; under Jest, expect.extend(harnessMatchers)
|
|
11
|
+
|
|
12
|
+
const page = await browser.newPage()
|
|
13
|
+
const login = new LoginPage(puppeteer(page, { baseURL: 'http://localhost:3000' }))
|
|
14
|
+
await login.goto()
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`baseURL` is what a page's relative `path` resolves against in `goto()`.
|
|
18
|
+
|
|
19
|
+
Full guide, the cross-driver guarantees, and the API: the
|
|
20
|
+
[harnessed README](https://github.com/joegaudet/harnessed#readme).
|
|
21
|
+
|
|
22
|
+
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,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,cAAc,CAAA"}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EnvConfig } from '@harnessed-ts/core';
|
|
2
|
+
import type { Page } from 'puppeteer';
|
|
3
|
+
import { PUPPETEER_DRIVER } from './driver-id';
|
|
4
|
+
import './puppeteer-query';
|
|
5
|
+
export { PUPPETEER_DRIVER };
|
|
6
|
+
export interface PuppeteerEnv extends EnvConfig {
|
|
7
|
+
readonly driver: typeof PUPPETEER_DRIVER;
|
|
8
|
+
readonly page: Page;
|
|
9
|
+
/**
|
|
10
|
+
* What a page's relative `path` resolves against in `goto()`. Puppeteer has no
|
|
11
|
+
* `baseURL` of its own, unlike Playwright's config. Without one, a relative
|
|
12
|
+
* path resolves against the page's current URL.
|
|
13
|
+
*/
|
|
14
|
+
readonly baseURL: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface PuppeteerEnvOptions {
|
|
17
|
+
baseURL?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Builds the env a harness is constructed with under Puppeteer. */
|
|
20
|
+
export declare function puppeteer(page: Page, options?: PuppeteerEnvOptions): PuppeteerEnv;
|
|
21
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAG9C,OAAO,mBAAmB,CAAA;AAE1B,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAE3B,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,QAAQ,CAAC,MAAM,EAAE,OAAO,gBAAgB,CAAA;IACxC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAErF"}
|