@quitecode/chromium-automaton 0.1.0-beta.1 → 0.1.0-beta.5

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 CHANGED
@@ -1,118 +1,53 @@
1
1
  # Chromium Automaton
2
2
 
3
- [![ci](https://github.com/quitecode9-lab/chromium-automation/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/quitecode9-lab/chromium-automation/actions/workflows/ci.yml)
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
4
 
5
- Chromium Automaton is a lightweight, Chromium-only browser automation library built directly on the Chrome DevTools Protocol (CDP). It offers a Playwright-style API without bundling any runner, fixtures, or reporting.
6
-
7
- ## What it is
8
- - A small CDP client with a focused API for Chromium automation
9
- - A CLI for downloading and caching Chromium snapshots
10
- - Runner-agnostic assertions you can plug into any test setup
11
-
12
- ## What it is not
13
- - Not a framework, runner, or test harness
14
- - Not multi-browser (Chromium only)
15
- - Not a report generator (no built-in reporting)
16
-
17
- ## Install
5
+ ## Quick start
18
6
 
19
7
  ```bash
20
8
  npm install @quitecode/chromium-automaton
9
+ npx chromium-automaton download # downloads a pinned Chromium build
21
10
  ```
22
11
 
23
- ## Download Chromium
24
-
25
- ```bash
26
- npx chromium-automaton download
27
- npx chromium-automaton download --latest
28
- ```
29
-
30
- ## Usage
31
-
32
12
  ```ts
13
+ // quick.js
33
14
  import { chromium, expect } from "@quitecode/chromium-automaton";
34
15
 
35
16
  const browser = await chromium.launch({ headless: true });
36
17
  const page = await browser.newPage();
37
18
 
38
- await page.goto("https://example.com", { waitUntil: "load" });
39
- await page.click("h1");
40
- const screenshotBase64 = await page.screenshotBase64();
41
-
19
+ await page.goto("https://example.com");
42
20
  await expect(page).element("h1").toHaveText(/Example Domain/);
43
21
 
44
22
  await browser.close();
45
23
  ```
46
24
 
47
- ## Documentation Site
48
-
49
- Docs are built with VitePress and published to GitHub Pages:
50
- https://quitecode9-lab.github.io/chromium-automation/
51
-
52
- ## Architecture
53
-
54
- ```mermaid
55
- graph LR
56
- CLI[CLI: chromium-automaton download] --> Downloader[Downloader]
57
- Downloader --> Cache[Chromium Cache]
58
- User[User Code] --> API[chromium.launch]
59
- API --> Manager[ChromiumManager]
60
- Manager --> Chromium[Chromium Process]
61
- Manager --> Conn[CDP Connection]
62
- Conn --> Browser[Browser]
63
- Browser --> Page[Page]
64
- Page --> Frame[Frame]
65
- Page --> Locator[Locator]
66
- Page --> Expect[expect]
67
- ```
68
-
69
- ## Locators
70
-
71
- ```ts
72
- const locator = page.locator("#login", { pierceShadowDom: true });
73
- await locator.click();
74
- await locator.type("admin");
75
- ```
76
-
77
- ## Frames
78
-
79
- ```ts
80
- const frame = page.frame({ urlIncludes: "embedded" });
81
- if (frame) {
82
- await frame.click("button.submit");
83
- }
84
- ```
85
-
86
- ## Shadow DOM
87
-
88
- ```ts
89
- await page.click("button.action", { pierceShadowDom: true });
90
- const text = await page.evaluate(() => document.title);
25
+ Run it:
26
+ ```bash
27
+ node quick.js
91
28
  ```
92
29
 
93
- ## Assertions
94
-
95
- ```ts
96
- await expect(page).element(".ready").toExist();
97
- await expect(page).element(".hidden").not.toBeVisible();
98
- await expect(page).element("h1").toHaveText("Example Domain");
99
- ```
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 chromium-automaton download` (or `--latest`) fetches Chromium into a local cache.
100
36
 
101
- ## Environment configuration
102
- - `CHROMIUM_AUTOMATON_CACHE_DIR`: override cache root
103
- - `CHROMIUM_AUTOMATON_REVISION`: override pinned revision
104
- - `CHROMIUM_AUTOMATON_EXECUTABLE_PATH`: bypass download and use this executable
105
- - `CHROMIUM_AUTOMATON_LOG_LEVEL`: error, warn, info, debug, trace
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`)
106
45
 
107
- Default cache root:
108
- - Linux and macOS: `~/.cache/chromium-automaton`
109
- - Windows: `%LOCALAPPDATA%\chromium-automaton`
46
+ ## Docs
47
+ Full guide and API reference: https://quitecode9-lab.github.io/chromium-automation/ (built from `docs/` via VitePress). Start at `docs/guide/intro.md` or `docs/guide/api/`.
110
48
 
111
- ## Limitations
112
- - Chromium only (no Chrome, Firefox, WebKit)
113
- - XPath selectors do not pierce shadow DOM
114
- - `evaluate(string)` is unsafe if the string includes untrusted input
115
- - Only http/https are allowed in `goto` unless `allowFileUrl` is true
49
+ ## Demo app
50
+ `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.
116
51
 
117
- ## ESM
118
- This package is ESM-only. Use `import` syntax in Node 18+.
52
+ ## License
53
+ MIT
@@ -1 +1 @@
1
- export { E as ExpectSelectorOptions, e as expect } from '../expect-CBZIoH1D.js';
1
+ export { E as ElementExpectation, c as ExpectFrame, d as ExpectSelectorOptions, e as expect } from '../expect-DTg-IWd-.js';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  expect
3
- } from "../chunk-ADOXZ36A.js";
3
+ } from "../chunk-E3D6NMS7.js";
4
4
  export {
5
5
  expect
6
6
  };