@designcrowd/fe-shared-lib 1.8.4-edge-fallback-0 → 1.8.4-edge-fallback-2
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/CLAUDE.md +12 -4
- package/package.json +1 -1
- package/scripts/publish-uat.sh +120 -0
- package/.claude/scheduled_tasks.lock +0 -1
- package/.claude/settings.local.json +0 -54
- package/.claude/skills/playwright-cli/SKILL.md +0 -278
- package/.claude/skills/playwright-cli/references/request-mocking.md +0 -87
- package/.claude/skills/playwright-cli/references/running-code.md +0 -232
- package/.claude/skills/playwright-cli/references/session-management.md +0 -169
- package/.claude/skills/playwright-cli/references/storage-state.md +0 -275
- package/.claude/skills/playwright-cli/references/test-generation.md +0 -88
- package/.claude/skills/playwright-cli/references/tracing.md +0 -139
- package/.claude/skills/playwright-cli/references/video-recording.md +0 -43
- package/.playwright-cli/page-2026-04-27T23-43-18-200Z.yml +0 -68
- package/.playwright-cli/page-2026-04-28T01-20-32-525Z.yml +0 -451
- package/.playwright-cli/page-2026-05-05T01-37-40-892Z.yml +0 -68
- package/.playwright-cli/page-2026-05-05T01-37-44-367Z.yml +0 -448
- package/.playwright-cli/page-2026-05-05T01-37-54-274Z.yml +0 -445
- package/.playwright-cli/page-2026-05-05T01-38-02-746Z.yml +0 -448
- package/.playwright-cli/page-2026-05-05T01-38-11-519Z.yml +0 -68
- package/.playwright-cli/page-2026-05-05T01-38-30-060Z.yml +0 -440
- package/.playwright-cli/page-2026-05-05T01-38-42-137Z.yml +0 -68
- package/.playwright-cli/page-2026-05-05T01-38-45-269Z.yml +0 -445
- package/.playwright-cli/page-2026-05-05T01-43-09-147Z.yml +0 -68
- package/.playwright-cli/page-2026-05-05T01-43-14-323Z.yml +0 -448
- package/.playwright-cli/page-2026-05-05T01-43-31-765Z.png +0 -0
- package/.playwright-cli/page-2026-05-05T01-43-41-236Z.yml +0 -445
- package/.playwright-cli/page-2026-05-05T01-43-45-996Z.png +0 -0
- package/.playwright-cli/page-2026-05-05T01-43-55-336Z.yml +0 -448
- package/.playwright-cli/page-2026-05-05T01-43-59-714Z.png +0 -0
- package/.playwright-cli/page-2026-05-05T01-44-09-967Z.yml +0 -445
- package/.playwright-cli/page-2026-05-05T01-44-11-884Z.yml +0 -68
- package/.playwright-cli/page-2026-05-05T01-44-18-229Z.yml +0 -440
- package/.playwright-cli/page-2026-05-05T01-44-54-928Z.png +0 -0
- package/.playwright-cli/page-2026-05-05T01-45-20-437Z.yml +0 -0
- package/.playwright-cli/page-2026-05-05T01-45-23-521Z.yml +0 -438
- package/.playwright-cli/page-2026-05-05T01-45-39-082Z.yml +0 -438
- package/.playwright-cli/page-2026-05-05T01-45-55-158Z.yml +0 -435
- package/.playwright-cli/page-2026-05-05T01-46-09-528Z.png +0 -0
- package/force-unsupported-hidden.png +0 -0
- package/force-unsupported-with-button.png +0 -0
package/CLAUDE.md
CHANGED
|
@@ -123,7 +123,15 @@ npm link @designcrowd/fe-shared-lib # in consumer project
|
|
|
123
123
|
|
|
124
124
|
## Publishing (UAT)
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
Use `scripts/publish-uat.sh <suffix>` to publish a UAT build for testing in a consumer (e.g. BrandCrowd.Net). The script handles the version bump, bundle-translation, secret scanning of the tarball, and the commit. Examples:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
./scripts/publish-uat.sh edge-fallback-0
|
|
130
|
+
./scripts/publish-uat.sh edge-fallback-1 # next iteration
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
It refuses to run on `master`/`main`, refuses if the version is already published, aborts on dangerous filenames or token-shaped strings inside the tarball, and only commits the bump after the registry confirms upload.
|
|
134
|
+
|
|
135
|
+
The npm publish token is read from `~/.config/designcrowd/npm-publish-token` (mode 600). Override with `NPM_PUBLISH_TOKEN_FILE` if it lives elsewhere. The token file is **not** stored anywhere in the repo.
|
|
136
|
+
|
|
137
|
+
The legacy `docker build . --build-arg NPM_TOKEN=...` flow still works but is brittle — prefer the script.
|
package/package.json
CHANGED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# publish-uat.sh — publish a UAT-suffixed version of @designcrowd/fe-shared-lib
|
|
4
|
+
#
|
|
5
|
+
# Usage: ./scripts/publish-uat.sh <suffix>
|
|
6
|
+
# Example: ./scripts/publish-uat.sh edge-fallback-2
|
|
7
|
+
#
|
|
8
|
+
# Reads the npm publish token from $NPM_PUBLISH_TOKEN_FILE
|
|
9
|
+
# (default ~/.config/designcrowd/npm-publish-token, mode 600).
|
|
10
|
+
# The token is never written into the repo.
|
|
11
|
+
#
|
|
12
|
+
# Workflow:
|
|
13
|
+
# 1. Validate branch (refuse master) and suffix.
|
|
14
|
+
# 2. Compute new version = <base>-<suffix>, refuse if already published.
|
|
15
|
+
# 3. Bump package.json, run bundle-translation.
|
|
16
|
+
# 4. npm pack — produces a tarball.
|
|
17
|
+
# 5. Secret scan: dangerous filenames + token-shaped strings + the
|
|
18
|
+
# literal token bytes from the token file (if it leaked into the
|
|
19
|
+
# tree somehow, this catches it).
|
|
20
|
+
# 6. npm publish <tarball> via a temp .npmrc in /tmp (mode 600,
|
|
21
|
+
# removed on exit).
|
|
22
|
+
# 7. git add + commit the version bump.
|
|
23
|
+
#
|
|
24
|
+
# Anything in steps 4-6 that fails leaves the working tree dirty so you
|
|
25
|
+
# can investigate. The commit only lands after the registry confirms
|
|
26
|
+
# the upload.
|
|
27
|
+
|
|
28
|
+
set -euo pipefail
|
|
29
|
+
|
|
30
|
+
PKG="@designcrowd/fe-shared-lib"
|
|
31
|
+
TOKEN_FILE="${NPM_PUBLISH_TOKEN_FILE:-$HOME/.config/designcrowd/npm-publish-token}"
|
|
32
|
+
|
|
33
|
+
abort() { echo "ABORT: $*" >&2; exit 1; }
|
|
34
|
+
|
|
35
|
+
# --- args ---
|
|
36
|
+
SUFFIX="${1:-}"
|
|
37
|
+
[[ -z "$SUFFIX" ]] && abort "usage: $0 <suffix> e.g. $0 edge-fallback-2"
|
|
38
|
+
[[ "$SUFFIX" =~ ^[A-Za-z0-9._-]+$ ]] || abort "suffix must be [A-Za-z0-9._-]+"
|
|
39
|
+
|
|
40
|
+
# --- repo state ---
|
|
41
|
+
cd "$(git rev-parse --show-toplevel)"
|
|
42
|
+
BRANCH=$(git symbolic-ref --short HEAD)
|
|
43
|
+
[[ "$BRANCH" == "master" || "$BRANCH" == "main" ]] && abort "refusing to publish from $BRANCH"
|
|
44
|
+
|
|
45
|
+
# --- token ---
|
|
46
|
+
[[ -f "$TOKEN_FILE" ]] || abort "no token at $TOKEN_FILE (set NPM_PUBLISH_TOKEN_FILE to override)"
|
|
47
|
+
TOKEN=$(tr -d '[:space:]' < "$TOKEN_FILE")
|
|
48
|
+
[[ -n "$TOKEN" ]] || abort "token file is empty: $TOKEN_FILE"
|
|
49
|
+
|
|
50
|
+
# --- compute version ---
|
|
51
|
+
BASE=$(node -p "require('./package.json').version.replace(/-.*/, '')")
|
|
52
|
+
NEW="$BASE-$SUFFIX"
|
|
53
|
+
|
|
54
|
+
if npm view "$PKG@$NEW" version >/dev/null 2>&1; then
|
|
55
|
+
abort "$PKG@$NEW already published — pick a new suffix"
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
echo "==> publishing $PKG@$NEW from branch $BRANCH"
|
|
59
|
+
|
|
60
|
+
# --- bump + bundle ---
|
|
61
|
+
node -e "const fs=require('fs');const p=require('./package.json');p.version='$NEW';fs.writeFileSync('./package.json', JSON.stringify(p, null, 2)+'\n');"
|
|
62
|
+
echo "==> running bundle-translation"
|
|
63
|
+
npm run --silent bundle-translation >/dev/null
|
|
64
|
+
|
|
65
|
+
# --- pack ---
|
|
66
|
+
echo "==> packing"
|
|
67
|
+
TARBALL=$(npm pack --silent)
|
|
68
|
+
[[ -f "$TARBALL" ]] || abort "npm pack did not produce a tarball"
|
|
69
|
+
|
|
70
|
+
# Always clean up temp artifacts on exit
|
|
71
|
+
SCAN_DIR=$(mktemp -d)
|
|
72
|
+
TMP_NPMRC=$(mktemp /tmp/fe-shared-lib-publish.XXXXXX.npmrc)
|
|
73
|
+
chmod 600 "$TMP_NPMRC"
|
|
74
|
+
cleanup() { rm -rf "$SCAN_DIR"; rm -f "$TMP_NPMRC" "$TARBALL"; }
|
|
75
|
+
trap cleanup EXIT
|
|
76
|
+
|
|
77
|
+
# --- secret scan: filenames ---
|
|
78
|
+
echo "==> scanning $TARBALL"
|
|
79
|
+
DANGEROUS_PATHS='(^|/)(\.env(\..+)?|\.npmrc|\.npm-publish-token|id_rsa.*|id_ed25519.*|.*\.pem|.*\.key|.*token.*|.*secret.*|.*credential.*)$|(^|/)\.(aws|ssh|gnupg)/'
|
|
80
|
+
if BAD=$(tar tzf "$TARBALL" | grep -E -i "$DANGEROUS_PATHS" || true); [[ -n "$BAD" ]]; then
|
|
81
|
+
echo "$BAD" >&2
|
|
82
|
+
abort "dangerous filenames in tarball"
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# --- secret scan: contents ---
|
|
86
|
+
tar xzf "$TARBALL" -C "$SCAN_DIR"
|
|
87
|
+
|
|
88
|
+
# Token-shaped patterns. Tightened so the literal '${NPM_TOKEN}' template
|
|
89
|
+
# in the tracked npmrc file doesn't trip the check.
|
|
90
|
+
SECRET_PATTERNS='(npm_[A-Za-z0-9]{30,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|gh[pousr]_[A-Za-z0-9]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|sk_live_[A-Za-z0-9]{20,}|-----BEGIN [A-Z ]*PRIVATE KEY-----)'
|
|
91
|
+
if HITS=$(grep -REn -I -E "$SECRET_PATTERNS" "$SCAN_DIR" 2>/dev/null || true); [[ -n "$HITS" ]]; then
|
|
92
|
+
echo "$HITS" >&2
|
|
93
|
+
abort "secret-shaped string in tarball"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# Belt-and-braces: the token's own bytes. If our publish token ever
|
|
97
|
+
# lands in a tracked file by accident, this catches it regardless of
|
|
98
|
+
# pattern-matching.
|
|
99
|
+
if grep -RFq "$TOKEN" "$SCAN_DIR" 2>/dev/null; then
|
|
100
|
+
abort "publish token bytes appear in tarball — DO NOT publish"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
FILES=$(tar tzf "$TARBALL" | wc -l | tr -d ' ')
|
|
104
|
+
SIZE=$(du -h "$TARBALL" | cut -f1)
|
|
105
|
+
echo "==> scan clean. $FILES files, $SIZE"
|
|
106
|
+
|
|
107
|
+
# --- publish ---
|
|
108
|
+
printf '//registry.npmjs.org/:_authToken=%s\n' "$TOKEN" > "$TMP_NPMRC"
|
|
109
|
+
echo "==> publishing"
|
|
110
|
+
npm publish "$TARBALL" --userconfig "$TMP_NPMRC"
|
|
111
|
+
|
|
112
|
+
# --- commit bump ---
|
|
113
|
+
git add -- package.json
|
|
114
|
+
git add -- src/bundles 2>/dev/null || true
|
|
115
|
+
git commit -m "bump version to $NEW" >/dev/null
|
|
116
|
+
echo
|
|
117
|
+
echo "Published $PKG@$NEW (commit $(git rev-parse --short HEAD))"
|
|
118
|
+
echo
|
|
119
|
+
echo "Install in BrandCrowd.Net:"
|
|
120
|
+
echo " npm i $PKG@$NEW"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"sessionId":"33dfc84f-253d-421e-b0c6-adbf8fc2c94d","pid":84069,"procStart":"339429","acquiredAt":1777334296981}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {},
|
|
3
|
-
"permissions": {
|
|
4
|
-
"allow": [
|
|
5
|
-
"Bash(npm outdated:*)",
|
|
6
|
-
"Bash(npm install:*)",
|
|
7
|
-
"Bash(npx npm-check-updates)",
|
|
8
|
-
"Bash(npm audit:*)",
|
|
9
|
-
"Skill(superpowers:writing-plans)",
|
|
10
|
-
"Bash(cat:*)",
|
|
11
|
-
"Bash(mkdir:*)",
|
|
12
|
-
"Skill(superpowers:subagent-driven-development)",
|
|
13
|
-
"Bash(echo:*)",
|
|
14
|
-
"Bash(ping:*)",
|
|
15
|
-
"Bash(docker system:*)",
|
|
16
|
-
"Bash(docker buildx du:*)",
|
|
17
|
-
"Bash(npm view:*)",
|
|
18
|
-
"Bash(~/.npmrc)",
|
|
19
|
-
"Bash(npm run bundle-translation:*)",
|
|
20
|
-
"mcp__plugin_context7_context7__resolve-library-id",
|
|
21
|
-
"Bash(node:*)",
|
|
22
|
-
"Bash(npm:*)",
|
|
23
|
-
"Bash(find:*)",
|
|
24
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib log --oneline --all)",
|
|
25
|
-
"Bash(wc:*)",
|
|
26
|
-
"mcp__plugin_context7_context7__query-docs",
|
|
27
|
-
"Skill(superpowers:test-driven-development)",
|
|
28
|
-
"Bash(git rev-parse:*)",
|
|
29
|
-
"Bash(npx tsc:*)",
|
|
30
|
-
"Bash(git add:*)",
|
|
31
|
-
"Bash(git commit:*)",
|
|
32
|
-
"Skill(superpowers:using-superpowers)",
|
|
33
|
-
"WebSearch",
|
|
34
|
-
"Bash(git checkout:*)",
|
|
35
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib status)",
|
|
36
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib diff package.json)",
|
|
37
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib log --oneline -5)",
|
|
38
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib diff vite.config.ts)",
|
|
39
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib add package.json package-lock.json vite.config.ts)",
|
|
40
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib commit -m \"$\\(cat <<''EOF''\nchore: upgrade vite 6→7, vue 3.5.15→3.5.26, storybook 9→10\n\n- Update vite to ^7.3.1\n- Update @vitejs/plugin-vue to ^6.0.3 \\(required for Vite 7\\)\n- Update vite-plugin-vue-devtools to ^7.7.2\n- Update vue to ^3.5.26\n- Remove vite-plugin-eslint \\(unmaintained, incompatible with Vite 7\\)\n- Update storybook to 10.2.1 \\(required for Vite 7 compatibility\\)\n- Update @storybook/vue3, @storybook/vue3-vite to 10.2.1\n- Update @storybook/addon-a11y, @storybook/addon-links, @storybook/addon-themes to 10.2.1\n- Update eslint-plugin-storybook to 10.2.1 \\(required for Storybook 10\\)\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
|
|
41
|
-
"Bash(git -C /home/zknowles/repos/fe-shared-lib log --oneline -3)",
|
|
42
|
-
"Bash(git show:*)",
|
|
43
|
-
"Bash(git stash:*)",
|
|
44
|
-
"Bash(chmod:*)",
|
|
45
|
-
"Bash(~/.claude/statusline.sh)",
|
|
46
|
-
"Bash(ls:*)",
|
|
47
|
-
"Bash(for v in 1.5.20-dts-upgrades 1.5.20-dts-upgrades-2 1.5.21 1.5.20-ast-icons 1.5.20-ast-icons-1 1.5.21-BestLogoIcons-3 1.5.22)",
|
|
48
|
-
"Bash(do)",
|
|
49
|
-
"Bash(done)",
|
|
50
|
-
"Bash(cp \"/home/zknowles/.claude/plugins/cache/designcrowd-plugins/experimental/0.19.0/docs/growth-it-runs-on-local-team-2026-04-09-thread.md\" \"/home/zknowles/repos/fe-shared-lib/docs/voice-to-text-discussion.md\")",
|
|
51
|
-
"Bash(cp -r \"/home/zknowles/.claude/plugins/cache/designcrowd-plugins/experimental/0.19.0/docs/growth-it-runs-on-local-team-2026-04-09-thread-attachments\" \"/home/zknowles/repos/fe-shared-lib/docs/voice-to-text-discussion-attachments\")"
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: playwright-cli
|
|
3
|
-
description: Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
|
|
4
|
-
allowed-tools: Bash(playwright-cli:*)
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Browser Automation with playwright-cli
|
|
8
|
-
|
|
9
|
-
## Quick start
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# open new browser
|
|
13
|
-
playwright-cli open
|
|
14
|
-
# navigate to a page
|
|
15
|
-
playwright-cli goto https://playwright.dev
|
|
16
|
-
# interact with the page using refs from the snapshot
|
|
17
|
-
playwright-cli click e15
|
|
18
|
-
playwright-cli type "page.click"
|
|
19
|
-
playwright-cli press Enter
|
|
20
|
-
# take a screenshot (rarely used, as snapshot is more common)
|
|
21
|
-
playwright-cli screenshot
|
|
22
|
-
# close the browser
|
|
23
|
-
playwright-cli close
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Commands
|
|
27
|
-
|
|
28
|
-
### Core
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
playwright-cli open
|
|
32
|
-
# open and navigate right away
|
|
33
|
-
playwright-cli open https://example.com/
|
|
34
|
-
playwright-cli goto https://playwright.dev
|
|
35
|
-
playwright-cli type "search query"
|
|
36
|
-
playwright-cli click e3
|
|
37
|
-
playwright-cli dblclick e7
|
|
38
|
-
playwright-cli fill e5 "user@example.com"
|
|
39
|
-
playwright-cli drag e2 e8
|
|
40
|
-
playwright-cli hover e4
|
|
41
|
-
playwright-cli select e9 "option-value"
|
|
42
|
-
playwright-cli upload ./document.pdf
|
|
43
|
-
playwright-cli check e12
|
|
44
|
-
playwright-cli uncheck e12
|
|
45
|
-
playwright-cli snapshot
|
|
46
|
-
playwright-cli snapshot --filename=after-click.yaml
|
|
47
|
-
playwright-cli eval "document.title"
|
|
48
|
-
playwright-cli eval "el => el.textContent" e5
|
|
49
|
-
playwright-cli dialog-accept
|
|
50
|
-
playwright-cli dialog-accept "confirmation text"
|
|
51
|
-
playwright-cli dialog-dismiss
|
|
52
|
-
playwright-cli resize 1920 1080
|
|
53
|
-
playwright-cli close
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Navigation
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
playwright-cli go-back
|
|
60
|
-
playwright-cli go-forward
|
|
61
|
-
playwright-cli reload
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Keyboard
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
playwright-cli press Enter
|
|
68
|
-
playwright-cli press ArrowDown
|
|
69
|
-
playwright-cli keydown Shift
|
|
70
|
-
playwright-cli keyup Shift
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Mouse
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
playwright-cli mousemove 150 300
|
|
77
|
-
playwright-cli mousedown
|
|
78
|
-
playwright-cli mousedown right
|
|
79
|
-
playwright-cli mouseup
|
|
80
|
-
playwright-cli mouseup right
|
|
81
|
-
playwright-cli mousewheel 0 100
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Save as
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
playwright-cli screenshot
|
|
88
|
-
playwright-cli screenshot e5
|
|
89
|
-
playwright-cli screenshot --filename=page.png
|
|
90
|
-
playwright-cli pdf --filename=page.pdf
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Tabs
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
playwright-cli tab-list
|
|
97
|
-
playwright-cli tab-new
|
|
98
|
-
playwright-cli tab-new https://example.com/page
|
|
99
|
-
playwright-cli tab-close
|
|
100
|
-
playwright-cli tab-close 2
|
|
101
|
-
playwright-cli tab-select 0
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Storage
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
playwright-cli state-save
|
|
108
|
-
playwright-cli state-save auth.json
|
|
109
|
-
playwright-cli state-load auth.json
|
|
110
|
-
|
|
111
|
-
# Cookies
|
|
112
|
-
playwright-cli cookie-list
|
|
113
|
-
playwright-cli cookie-list --domain=example.com
|
|
114
|
-
playwright-cli cookie-get session_id
|
|
115
|
-
playwright-cli cookie-set session_id abc123
|
|
116
|
-
playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
|
|
117
|
-
playwright-cli cookie-delete session_id
|
|
118
|
-
playwright-cli cookie-clear
|
|
119
|
-
|
|
120
|
-
# LocalStorage
|
|
121
|
-
playwright-cli localstorage-list
|
|
122
|
-
playwright-cli localstorage-get theme
|
|
123
|
-
playwright-cli localstorage-set theme dark
|
|
124
|
-
playwright-cli localstorage-delete theme
|
|
125
|
-
playwright-cli localstorage-clear
|
|
126
|
-
|
|
127
|
-
# SessionStorage
|
|
128
|
-
playwright-cli sessionstorage-list
|
|
129
|
-
playwright-cli sessionstorage-get step
|
|
130
|
-
playwright-cli sessionstorage-set step 3
|
|
131
|
-
playwright-cli sessionstorage-delete step
|
|
132
|
-
playwright-cli sessionstorage-clear
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Network
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
playwright-cli route "**/*.jpg" --status=404
|
|
139
|
-
playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
|
|
140
|
-
playwright-cli route-list
|
|
141
|
-
playwright-cli unroute "**/*.jpg"
|
|
142
|
-
playwright-cli unroute
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### DevTools
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
playwright-cli console
|
|
149
|
-
playwright-cli console warning
|
|
150
|
-
playwright-cli network
|
|
151
|
-
playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
|
|
152
|
-
playwright-cli tracing-start
|
|
153
|
-
playwright-cli tracing-stop
|
|
154
|
-
playwright-cli video-start
|
|
155
|
-
playwright-cli video-stop video.webm
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Open parameters
|
|
159
|
-
```bash
|
|
160
|
-
# Use specific browser when creating session
|
|
161
|
-
playwright-cli open --browser=chrome
|
|
162
|
-
playwright-cli open --browser=firefox
|
|
163
|
-
playwright-cli open --browser=webkit
|
|
164
|
-
playwright-cli open --browser=msedge
|
|
165
|
-
# Connect to browser via extension
|
|
166
|
-
playwright-cli open --extension
|
|
167
|
-
|
|
168
|
-
# Use persistent profile (by default profile is in-memory)
|
|
169
|
-
playwright-cli open --persistent
|
|
170
|
-
# Use persistent profile with custom directory
|
|
171
|
-
playwright-cli open --profile=/path/to/profile
|
|
172
|
-
|
|
173
|
-
# Start with config file
|
|
174
|
-
playwright-cli open --config=my-config.json
|
|
175
|
-
|
|
176
|
-
# Close the browser
|
|
177
|
-
playwright-cli close
|
|
178
|
-
# Delete user data for the default session
|
|
179
|
-
playwright-cli delete-data
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## Snapshots
|
|
183
|
-
|
|
184
|
-
After each command, playwright-cli provides a snapshot of the current browser state.
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
> playwright-cli goto https://example.com
|
|
188
|
-
### Page
|
|
189
|
-
- Page URL: https://example.com/
|
|
190
|
-
- Page Title: Example Domain
|
|
191
|
-
### Snapshot
|
|
192
|
-
[Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
You can also take a snapshot on demand using `playwright-cli snapshot` command.
|
|
196
|
-
|
|
197
|
-
If `--filename` is not provided, a new snapshot file is created with a timestamp. Default to automatic file naming, use `--filename=` when artifact is a part of the workflow result.
|
|
198
|
-
|
|
199
|
-
## Browser Sessions
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
# create new browser session named "mysession" with persistent profile
|
|
203
|
-
playwright-cli -s=mysession open example.com --persistent
|
|
204
|
-
# same with manually specified profile directory (use when requested explicitly)
|
|
205
|
-
playwright-cli -s=mysession open example.com --profile=/path/to/profile
|
|
206
|
-
playwright-cli -s=mysession click e6
|
|
207
|
-
playwright-cli -s=mysession close # stop a named browser
|
|
208
|
-
playwright-cli -s=mysession delete-data # delete user data for persistent session
|
|
209
|
-
|
|
210
|
-
playwright-cli list
|
|
211
|
-
# Close all browsers
|
|
212
|
-
playwright-cli close-all
|
|
213
|
-
# Forcefully kill all browser processes
|
|
214
|
-
playwright-cli kill-all
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Local installation
|
|
218
|
-
|
|
219
|
-
In some cases user might want to install playwright-cli locally. If running globally available `playwright-cli` binary fails, use `npx playwright-cli` to run the commands. For example:
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
npx playwright-cli open https://example.com
|
|
223
|
-
npx playwright-cli click e1
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## Example: Form submission
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
playwright-cli open https://example.com/form
|
|
230
|
-
playwright-cli snapshot
|
|
231
|
-
|
|
232
|
-
playwright-cli fill e1 "user@example.com"
|
|
233
|
-
playwright-cli fill e2 "password123"
|
|
234
|
-
playwright-cli click e3
|
|
235
|
-
playwright-cli snapshot
|
|
236
|
-
playwright-cli close
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
## Example: Multi-tab workflow
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
playwright-cli open https://example.com
|
|
243
|
-
playwright-cli tab-new https://example.com/other
|
|
244
|
-
playwright-cli tab-list
|
|
245
|
-
playwright-cli tab-select 0
|
|
246
|
-
playwright-cli snapshot
|
|
247
|
-
playwright-cli close
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## Example: Debugging with DevTools
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
playwright-cli open https://example.com
|
|
254
|
-
playwright-cli click e4
|
|
255
|
-
playwright-cli fill e7 "test"
|
|
256
|
-
playwright-cli console
|
|
257
|
-
playwright-cli network
|
|
258
|
-
playwright-cli close
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
```bash
|
|
262
|
-
playwright-cli open https://example.com
|
|
263
|
-
playwright-cli tracing-start
|
|
264
|
-
playwright-cli click e4
|
|
265
|
-
playwright-cli fill e7 "test"
|
|
266
|
-
playwright-cli tracing-stop
|
|
267
|
-
playwright-cli close
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Specific tasks
|
|
271
|
-
|
|
272
|
-
* **Request mocking** [references/request-mocking.md](references/request-mocking.md)
|
|
273
|
-
* **Running Playwright code** [references/running-code.md](references/running-code.md)
|
|
274
|
-
* **Browser session management** [references/session-management.md](references/session-management.md)
|
|
275
|
-
* **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
|
|
276
|
-
* **Test generation** [references/test-generation.md](references/test-generation.md)
|
|
277
|
-
* **Tracing** [references/tracing.md](references/tracing.md)
|
|
278
|
-
* **Video recording** [references/video-recording.md](references/video-recording.md)
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# Request Mocking
|
|
2
|
-
|
|
3
|
-
Intercept, mock, modify, and block network requests.
|
|
4
|
-
|
|
5
|
-
## CLI Route Commands
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Mock with custom status
|
|
9
|
-
playwright-cli route "**/*.jpg" --status=404
|
|
10
|
-
|
|
11
|
-
# Mock with JSON body
|
|
12
|
-
playwright-cli route "**/api/users" --body='[{"id":1,"name":"Alice"}]' --content-type=application/json
|
|
13
|
-
|
|
14
|
-
# Mock with custom headers
|
|
15
|
-
playwright-cli route "**/api/data" --body='{"ok":true}' --header="X-Custom: value"
|
|
16
|
-
|
|
17
|
-
# Remove headers from requests
|
|
18
|
-
playwright-cli route "**/*" --remove-header=cookie,authorization
|
|
19
|
-
|
|
20
|
-
# List active routes
|
|
21
|
-
playwright-cli route-list
|
|
22
|
-
|
|
23
|
-
# Remove a route or all routes
|
|
24
|
-
playwright-cli unroute "**/*.jpg"
|
|
25
|
-
playwright-cli unroute
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## URL Patterns
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
**/api/users - Exact path match
|
|
32
|
-
**/api/*/details - Wildcard in path
|
|
33
|
-
**/*.{png,jpg,jpeg} - Match file extensions
|
|
34
|
-
**/search?q=* - Match query parameters
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Advanced Mocking with run-code
|
|
38
|
-
|
|
39
|
-
For conditional responses, request body inspection, response modification, or delays:
|
|
40
|
-
|
|
41
|
-
### Conditional Response Based on Request
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
playwright-cli run-code "async page => {
|
|
45
|
-
await page.route('**/api/login', route => {
|
|
46
|
-
const body = route.request().postDataJSON();
|
|
47
|
-
if (body.username === 'admin') {
|
|
48
|
-
route.fulfill({ body: JSON.stringify({ token: 'mock-token' }) });
|
|
49
|
-
} else {
|
|
50
|
-
route.fulfill({ status: 401, body: JSON.stringify({ error: 'Invalid' }) });
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}"
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Modify Real Response
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
playwright-cli run-code "async page => {
|
|
60
|
-
await page.route('**/api/user', async route => {
|
|
61
|
-
const response = await route.fetch();
|
|
62
|
-
const json = await response.json();
|
|
63
|
-
json.isPremium = true;
|
|
64
|
-
await route.fulfill({ response, json });
|
|
65
|
-
});
|
|
66
|
-
}"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Simulate Network Failures
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
playwright-cli run-code "async page => {
|
|
73
|
-
await page.route('**/api/offline', route => route.abort('internetdisconnected'));
|
|
74
|
-
}"
|
|
75
|
-
# Options: connectionrefused, timedout, connectionreset, internetdisconnected
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Delayed Response
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
playwright-cli run-code "async page => {
|
|
82
|
-
await page.route('**/api/slow', async route => {
|
|
83
|
-
await new Promise(r => setTimeout(r, 3000));
|
|
84
|
-
route.fulfill({ body: JSON.stringify({ data: 'loaded' }) });
|
|
85
|
-
});
|
|
86
|
-
}"
|
|
87
|
-
```
|