@toolstackhq/cdpwright 1.0.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/README.md +62 -0
- package/dist/assert/expect.d.ts +1 -0
- package/dist/assert/expect.js +7 -0
- package/dist/assert/expect.js.map +1 -0
- package/dist/chunk-6BPF3IEU.js +1572 -0
- package/dist/chunk-6BPF3IEU.js.map +1 -0
- package/dist/cli.js +2161 -0
- package/dist/cli.js.map +1 -0
- package/dist/expect-CY70zJc0.d.ts +318 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +878 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# cdpwright
|
|
2
|
+
|
|
3
|
+
Chromium-only automation built on the Chrome DevTools Protocol (CDP). A lightweight, Playwright-style API with `Browser`, `Context`, `Page`, `Frame`, and `Locator` primitives—no test runner included.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @toolstackhq/cdpwright
|
|
9
|
+
npx cpw download # downloads a pinned Chromium build
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
// quick.js
|
|
14
|
+
import { chromium, expect } from "@toolstackhq/cdpwright";
|
|
15
|
+
|
|
16
|
+
const browser = await chromium.launch({ headless: true });
|
|
17
|
+
const page = await browser.newPage();
|
|
18
|
+
|
|
19
|
+
await page.goto("https://example.com");
|
|
20
|
+
await expect(page).element("h1").toHaveText(/Example Domain/);
|
|
21
|
+
|
|
22
|
+
await browser.close();
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run it:
|
|
26
|
+
```bash
|
|
27
|
+
node quick.js
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Core ideas
|
|
31
|
+
- CDP-only: no WebDriver, no playwright-core dependency.
|
|
32
|
+
- Small surface: pages/frames/locators, plus built-in expect matchers.
|
|
33
|
+
- Selector routing: CSS by default; XPath if the selector starts with `/`, `./`, `.//`, `..`, or `(/`. Shadow DOM via `>>>` (e.g., `host >>> button`).
|
|
34
|
+
- Contexts: `browser.newContext()` gives incognito-style isolation without launching a new browser.
|
|
35
|
+
- Downloads: `npx cpw download` (or `--latest`) fetches Chromium into a local cache.
|
|
36
|
+
|
|
37
|
+
## Key APIs
|
|
38
|
+
- `chromium.launch(options)` → `Browser`
|
|
39
|
+
- `browser.newContext()` → isolated `BrowserContext`
|
|
40
|
+
- `browser.newPage()` / `context.newPage()` → `Page`
|
|
41
|
+
- `page.goto(url, { waitUntil: "load" | "domcontentloaded" })`
|
|
42
|
+
- Actions: `click`, `dblclick`, `type`, `typeSecure`, `fillInput`, `selectOption`, `setFileInput`
|
|
43
|
+
- Queries: `query`, `queryAll`, `queryXPath`, `queryAllXPath`, `locator`
|
|
44
|
+
- Assertions: `expect(page).element("selector").toBeVisible()` (see `docs/guide/assertions.md`)
|
|
45
|
+
|
|
46
|
+
## Architecture at a glance (render-friendly)
|
|
47
|
+
```
|
|
48
|
+
CLI (cpw download) -> Downloader -> Chromium cache
|
|
49
|
+
|
|
50
|
+
User code -> chromium.launch -> ChromiumManager -> Chromium process
|
|
51
|
+
Chromium process -> CDP connection -> Browser -> Page -> Frame
|
|
52
|
+
Page -> Locator / expect
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Docs
|
|
56
|
+
Full guide and API reference: https://toolstackhq.github.io/cdpwright/ (built from `docs/` via VitePress). Start at `docs/guide/intro.md` or `docs/guide/api/`.
|
|
57
|
+
|
|
58
|
+
## Demo app
|
|
59
|
+
`index.html` is a local, data-driven visa-style wizard used to stress-test automation flows (no server required). Open it directly via `file://` to exercise navigation, conditionals, overlays, Shadow DOM, uploads, and receipts.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { E as ElementExpectation, c as ExpectFrame, d as ExpectSelectorOptions, e as expect } from '../expect-CY70zJc0.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|