craftdriver 1.0.4 → 1.1.1
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 +20 -0
- package/README.md +1 -1
- package/dist/cli/snapshot.js +31 -4
- package/dist/cli/snapshot.js.map +1 -1
- package/dist/lib/browser.d.ts +28 -0
- package/dist/lib/browser.d.ts.map +1 -1
- package/dist/lib/browser.js +20 -1
- package/dist/lib/browser.js.map +1 -1
- package/dist/lib/by.d.ts +18 -0
- package/dist/lib/by.d.ts.map +1 -1
- package/dist/lib/by.js +141 -17
- package/dist/lib/by.js.map +1 -1
- package/dist/lib/chrome.d.ts +15 -3
- package/dist/lib/chrome.d.ts.map +1 -1
- package/dist/lib/chrome.js +4 -2
- package/dist/lib/chrome.js.map +1 -1
- package/dist/lib/driverManager.d.ts +31 -0
- package/dist/lib/driverManager.d.ts.map +1 -1
- package/dist/lib/driverManager.js +98 -7
- package/dist/lib/driverManager.js.map +1 -1
- package/dist/lib/firefox.d.ts +4 -3
- package/dist/lib/firefox.d.ts.map +1 -1
- package/dist/lib/firefox.js.map +1 -1
- package/dist/lib/locator.d.ts +28 -0
- package/dist/lib/locator.d.ts.map +1 -1
- package/dist/lib/locator.js +28 -0
- package/dist/lib/locator.js.map +1 -1
- package/docs/browser-api.md +5 -1
- package/docs/driver-configuration.md +103 -4
- package/docs/public/examples/a11y.html +44 -0
- package/docs/public/examples/clock.html +83 -0
- package/docs/public/examples/console-errors.html +344 -0
- package/docs/public/examples/dialogs.html +42 -0
- package/docs/public/examples/download.html +31 -0
- package/docs/public/examples/dynamic.html +131 -0
- package/docs/public/examples/emulate.html +127 -0
- package/docs/public/examples/evaluate.html +28 -0
- package/docs/public/examples/hover-select.html +295 -0
- package/docs/public/examples/iframe-child.html +51 -0
- package/docs/public/examples/iframes.html +35 -0
- package/docs/public/examples/keyboard.html +195 -0
- package/docs/public/examples/locator.html +131 -0
- package/docs/public/examples/login.html +116 -0
- package/docs/public/examples/mobile.html +270 -0
- package/docs/public/examples/mouse.html +505 -0
- package/docs/public/examples/network.html +293 -0
- package/docs/public/examples/popup-target.html +26 -0
- package/docs/public/examples/popup.html +50 -0
- package/docs/public/examples/screenshot.html +99 -0
- package/docs/public/examples/selectors.html +150 -0
- package/docs/public/examples/session.html +514 -0
- package/docs/public/examples/upload.html +36 -0
- package/docs/recipes/accessibility-gate.md +24 -40
- package/docs/recipes/console-error-gate.md +29 -38
- package/docs/recipes/file-upload-download.md +26 -43
- package/docs/recipes/find-elements.md +142 -0
- package/docs/recipes/login-once-reuse-session.md +24 -44
- package/docs/recipes/mobile-flow-with-network-and-logs.md +26 -41
- package/docs/recipes/mock-api-and-assert-network.md +22 -35
- package/docs/recipes/multi-user-contexts.md +32 -43
- package/docs/recipes/page-objects.md +52 -0
- package/docs/recipes/trace-failing-test.md +31 -44
- package/docs/recipes/virtual-clock-time-sensitive-ui.md +24 -40
- package/docs/recipes/vitest-browser-lifecycle.md +14 -11
- package/docs/recipes.md +20 -1
- package/docs/selectors.md +291 -229
- package/docs/zero-config-drivers.md +16 -4
- package/package.json +5 -1
|
@@ -24,15 +24,24 @@ CraftDriver checks for the driver in this order:
|
|
|
24
24
|
| ---- | ----------------------------------------------------------------------- |
|
|
25
25
|
| 1 | Explicit `ChromeService` / `FirefoxService` configuration |
|
|
26
26
|
| 2 | Environment variables such as `CHROMEDRIVER_PATH` or `GECKODRIVER_PATH` |
|
|
27
|
-
| 3 |
|
|
28
|
-
| 4 |
|
|
29
|
-
| 5 |
|
|
27
|
+
| 3 | Known CI-provided driver directories (e.g. GitHub Actions' `CHROMEWEBDRIVER` / `GECKOWEBDRIVER`) |
|
|
28
|
+
| 4 | Project-local binaries in `node_modules/.bin` |
|
|
29
|
+
| 5 | Binaries already available on `PATH` |
|
|
30
|
+
| 6 | Auto-resolved and cached driver matching the installed browser |
|
|
30
31
|
|
|
31
32
|
If a browser update leaves a cached driver stale, CraftDriver retries once with a refreshed driver instead of making you clear the cache manually.
|
|
32
33
|
|
|
33
34
|
## CI Friendly
|
|
34
35
|
|
|
35
|
-
The default setup works well on CI runners that already include Chrome or
|
|
36
|
+
The default setup works well on CI runners that already include Chrome or
|
|
37
|
+
Firefox. On **GitHub Actions** specifically, craftdriver auto-detects the
|
|
38
|
+
runner's own pre-installed, version-matched driver out of the box (via
|
|
39
|
+
`CHROMEWEBDRIVER` / `GECKOWEBDRIVER`) — no configuration needed, and it's
|
|
40
|
+
faster than the fallback probes since it skips version detection entirely (see
|
|
41
|
+
[Driver Configuration → CI platform detection](./driver-configuration.md#ci-platform-detection)).
|
|
42
|
+
|
|
43
|
+
For platforms without built-in detection, or to pin a driver other than the
|
|
44
|
+
runner's default, set the path manually:
|
|
36
45
|
|
|
37
46
|
```bash
|
|
38
47
|
CRAFTDRIVER_CHROMEDRIVER_PATH=/usr/bin/chromedriver npm test
|
|
@@ -48,5 +57,8 @@ Manual configuration is useful when:
|
|
|
48
57
|
- network access is blocked
|
|
49
58
|
- you need custom driver logging
|
|
50
59
|
- you want to avoid any version detection during launch
|
|
60
|
+
- you're launching a non-default Chrome/Chromium/Firefox build via
|
|
61
|
+
`browserPath` / `CRAFTDRIVER_CHROME_PATH` — see
|
|
62
|
+
[Driver Configuration → Browser Binary Configuration](./driver-configuration.md#browser-binary-configuration)
|
|
51
63
|
|
|
52
64
|
See [Driver Configuration](./driver-configuration.md) for the full reference.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "craftdriver",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Modern WebDriver automation library for NodeJS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,14 +17,18 @@
|
|
|
17
17
|
"test:firefox": "BROWSER_NAME=firefox HEADLESS=true vitest run --maxWorkers=2",
|
|
18
18
|
"test:chrome": "BROWSER_NAME=chrome vitest run",
|
|
19
19
|
"test:chromium": "BROWSER_NAME=chromium vitest run",
|
|
20
|
+
"test:recipes": "HEADLESS=true vitest run --config vitest.recipes.config.ts",
|
|
20
21
|
"bench": "HEADLESS=true vitest run --config vitest.perf.config.ts",
|
|
21
22
|
"bench:realapp": "HEADLESS=true vitest run --config vitest.perf.realapp.config.ts",
|
|
22
23
|
"clean": "rimraf dist",
|
|
23
24
|
"serve": "http-server ./examples -a 127.0.0.1 -p 8080 -c-1 --cors",
|
|
24
25
|
"examples:start": "npm run serve",
|
|
26
|
+
"docs:examples": "node scripts/copy-examples.mjs",
|
|
25
27
|
"docs:api": "node scripts/gen-api-reference.mjs",
|
|
26
28
|
"docs:api:check": "node scripts/gen-api-reference.mjs --check",
|
|
29
|
+
"predocs:dev": "npm run docs:examples",
|
|
27
30
|
"docs:dev": "vitepress dev docs",
|
|
31
|
+
"predocs:build": "npm run docs:examples",
|
|
28
32
|
"docs:build": "vitepress build docs",
|
|
29
33
|
"docs:preview": "vitepress preview docs",
|
|
30
34
|
"docs:check": "npm run docs:api:check && npm run docs:build",
|