From a9ed96e87f3d2d69eaad3c7137b1fbe32d8f133b Mon Sep 17 00:00:00 2001 From: Michael Potter Date: Wed, 10 Jun 2026 08:26:13 -0400 Subject: [PATCH 1/3] chore: adding feature request workflow --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6bcf66e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + pull_request: + branches: + - main + +jobs: + build: + name: Build & Test + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Install Dependencies + run: yarn setup + + - name: Build + run: yarn build + + - name: Test + run: yarn test From 5f82ef928a9dc904222b7c946394f7ec9ee16caa Mon Sep 17 00:00:00 2001 From: Michael Potter Date: Wed, 10 Jun 2026 08:34:01 -0400 Subject: [PATCH 2/3] fix: devtools open fix --- .changeset/fix-devtools-launch-option.md | 5 +++++ src/browser.ts | 9 ++++++--- src/login.ts | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .changeset/fix-devtools-launch-option.md diff --git a/.changeset/fix-devtools-launch-option.md b/.changeset/fix-devtools-launch-option.md new file mode 100644 index 0000000..09d8bf4 --- /dev/null +++ b/.changeset/fix-devtools-launch-option.md @@ -0,0 +1,5 @@ +--- +"@heymp/scratchpad": patch +--- + +Fix devtools launch option for newer versions of Playwright by using --auto-open-devtools-for-tabs arg instead of the removed devtools property on LaunchOptions. diff --git a/src/browser.ts b/src/browser.ts index 389bb9b..1334c2a 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -28,10 +28,13 @@ function readFile(...args: Parameters) { export async function browser(processor: Processor) { // Get session login session // Launch the browser + const args: string[] = []; + if (processor.opts.bypassCSP) args.push('--disable-web-security'); + if (processor.opts.devtools) args.push('--auto-open-devtools-for-tabs'); + const browser = await playwright['chromium'].launch({ - headless: !!processor.opts.headless, - devtools: !!processor.opts.devtools, - args: processor.opts.bypassCSP ? ['--disable-web-security'] : [], + headless: processor.opts.devtools ? false : !!processor.opts.headless, + args, }); const sessionPath = formatSessionPath(processor.opts.sessionPath); const context = await browser.newContext({ diff --git a/src/login.ts b/src/login.ts index 8985bc1..98c23e5 100644 --- a/src/login.ts +++ b/src/login.ts @@ -10,7 +10,7 @@ util.inspect.defaultOptions.depth = null; export async function login(config: Config) { const browser = await playwright['chromium'].launch({ headless: false, - devtools: !!config.devtools + args: config.devtools ? ['--auto-open-devtools-for-tabs'] : [], }); const context = await browser.newContext(); const page = await context.newPage(); From ab85a6c204c9e927193f28cc983baf3a78dc583b Mon Sep 17 00:00:00 2001 From: Michael Potter Date: Wed, 10 Jun 2026 08:44:57 -0400 Subject: [PATCH 3/3] fix: yarn test error --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c86bf36..6c40319 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "preinstall": "echo 'Do not run yarn install directly. Use: yarn setup' && exit 1", "build": "tsc", "build:watch": "tsc -w", - "test": "yarn build && node --test src/**/*.test.js", + "test": "yarn build && node --test src/*.test.js", "release": "yarn changeset publish" }, "devDependencies": {