Skip to content

feat: add PW_SCRIPT_DIR support to persist test scripts - #35

Closed
alexanderbailey wants to merge 1 commit into
lackeyjb:mainfrom
alexanderbailey:feature/persist-test-scripts
Closed

feat: add PW_SCRIPT_DIR support to persist test scripts#35
alexanderbailey wants to merge 1 commit into
lackeyjb:mainfrom
alexanderbailey:feature/persist-test-scripts

Conversation

@alexanderbailey

Copy link
Copy Markdown

Summary

  • Adds PW_SCRIPT_DIR environment variable support to run.js — when set, executed scripts are automatically copied to that directory
  • Directory is created automatically if it doesn't exist; duplicate filenames get a timestamp suffix to avoid overwrites
  • Updates SKILL.md with a new "Persisting Test Scripts" section, workflow examples, and a tip reminding Claude to suggest the option when users ask to save/reuse tests

Test plan

  • Run a script without PW_SCRIPT_DIR set — confirm existing behaviour unchanged
  • Run a script with PW_SCRIPT_DIR=./playwright-tests — confirm script is copied and 💾 Script saved to: is printed
  • Run the same script again — confirm timestamp suffix is added to avoid overwrite
  • Run with inline code or stdin — confirm no save attempt is made
  • Set PW_SCRIPT_DIR to a non-existent path — confirm directory is created automatically

Closes #15

@lackeyjb lackeyjb added this to the v5.0.0 milestone Aug 11, 2026
@lackeyjb

Copy link
Copy Markdown
Owner

Thanks @alexanderbailey for the contribution. The idea from this PR is included in v5.0.0 in PR #47

@lackeyjb lackeyjb closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist Playwright Test Scripts

2 participants