Skip to content

Fix CI playwright install, selector injection in A11yParser, and close() race condition - #225

Merged
sroussey merged 2 commits into
browserfrom
copilot/sub-pr-223-again
Feb 22, 2026
Merged

Fix CI playwright install, selector injection in A11yParser, and close() race condition#225
sroussey merged 2 commits into
browserfrom
copilot/sub-pr-223-again

Conversation

Copilot AI commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Playwright Integration tests were failing in CI due to missing browser binary, plus two code-quality issues flagged in review.

Changes

  • CI (test.yml): Add bunx playwright install chromium --with-deps before running tests — was the root cause of all 12 Playwright/Workflow Integration test failures.

  • A11yParser.ts: Replace document.querySelector(\label[for="${id}"]`)withgetElementsByTagName+htmlFor` property comparison to eliminate CSS selector injection risk from unsanitized element IDs.

    // Before — ID with special chars (e.g. `my.id`) breaks the selector
    const label = document.querySelector(`label[for="${htmlElement.id}"]`);
    
    // After — safe direct property comparison
    const labels = document.getElementsByTagName("label");
    for (let i = 0; i < labels.length; i++) {
      if ((labels[i] as HTMLLabelElement).htmlFor === htmlElement.id) { ... }
    }
  • PlaywrightContext.ts: Fix close() so references are cleared before the async close races the timeout — capturing contextRef locally prevents any code path from operating on a null/freed context while a close is still in-flight.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: sroussey <127349+sroussey@users.noreply.github.com>
Copilot AI changed the title [WIP] Add @workglow/browser package for browser automation Fix CI playwright install, selector injection in A11yParser, and close() race condition Feb 22, 2026
Copilot AI requested a review from sroussey February 22, 2026 01:42
@sroussey
sroussey marked this pull request as ready for review February 22, 2026 02:20
@sroussey
sroussey merged commit 0e01c42 into browser Feb 22, 2026
1 of 2 checks passed
@sroussey
sroussey deleted the copilot/sub-pr-223-again branch February 25, 2026 22:05
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.

2 participants