Skip to content

Add Playwright Chromium path verification tooling#1795

Merged
yingbull merged 3 commits into
fix/legacy-test-workflow-fixfrom
copilot/sub-pr-1792-another-one
Jan 18, 2026
Merged

Add Playwright Chromium path verification tooling#1795
yingbull merged 3 commits into
fix/legacy-test-workflow-fixfrom
copilot/sub-pr-1792-another-one

Conversation

Copilot AI commented Jan 18, 2026

Copy link
Copy Markdown

Reviewer questioned whether .mcp.json Chromium path aligned with Playwright 1.56.0. Investigation confirmed current path is correct (revision 1194, not 1200+), but tooling was needed to prevent future misalignment.

Added verification infrastructure:

  • .devcontainer/PLAYWRIGHT_SETUP.md: Documents Chromium path structure, version-to-revision mapping, and verification steps
  • .devcontainer/scripts/verify-playwright-path.sh: Automated checker that validates Dockerfile Playwright version matches .mcp.json executable path
  • .devcontainer/README.md: Quick reference section for running verification

Verification script capabilities:

# Inside devcontainer
/workspace/.devcontainer/scripts/verify-playwright-path.sh

# Output:
# ✅ Playwright version in Dockerfile: 1.56.0
# ✅ Latest installed Chromium revision: 1194
# ✅ Chromium executable found at: /root/.cache/ms-playwright/chromium-1194/chrome-linux/chrome
# ✅ Configuration is correct!

Script uses numeric sorting for reliable revision comparison and suggests jq-based fixes for path mismatches.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Summary by cubic

Updated the legacy CI test workflow and devcontainer so Playwright tests run reliably in CI and locally. Addresses feedback in #1792 and adds docs and a verify script for the MCP Chromium path.

  • Bug Fixes
    • Standardized Playwright install and runtime dependencies across CI and the devcontainer.
    • Simplified the workflow to use consistent test commands and headless execution.

Written for commit a817a20. Summary will update on new commits.

@coderabbitai

coderabbitai Bot commented Jan 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits January 18, 2026 06:12
Co-authored-by: yingbull <8680161+yingbull@users.noreply.github.com>
…ation

Co-authored-by: yingbull <8680161+yingbull@users.noreply.github.com>

Copilot AI commented Jan 18, 2026

Copy link
Copy Markdown
Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • playwright.dev
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update workflow fixes and devcontainer adjustments for Playwright Add Playwright Chromium path verification tooling Jan 18, 2026
Copilot AI requested a review from yingbull January 18, 2026 06:15
@yingbull yingbull marked this pull request as ready for review January 18, 2026 06:15
Copilot AI review requested due to automatic review settings January 18, 2026 06:15
@yingbull yingbull merged commit 4257d85 into fix/legacy-test-workflow-fix Jan 18, 2026
8 of 10 checks passed
@yingbull yingbull deleted the copilot/sub-pr-1792-another-one branch January 18, 2026 06:16

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds verification tooling to ensure the Playwright Chromium executable path in .mcp.json stays aligned with the Playwright version installed in the devcontainer. This addresses feedback from #1792 about potential version misalignment.

Changes:

  • Added automated verification script that validates Dockerfile Playwright version matches .mcp.json executable path
  • Created comprehensive documentation for Playwright configuration, version-to-revision mapping, and troubleshooting steps
  • Added quick reference section to devcontainer README with verification instructions

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
.devcontainer/scripts/verify-playwright-path.sh Bash script that extracts Playwright version from Dockerfile, finds installed Chromium revision, and validates against .mcp.json configuration
.devcontainer/PLAYWRIGHT_SETUP.md Detailed documentation on Chromium path structure, manual verification steps, and version-to-revision mapping table
.devcontainer/README.md Quick reference section for running the verification script with links to detailed documentation

fi

# Extract the current executable path from .mcp.json
CURRENT_PATH=$(grep -oP '"--executable-path",\s*"\K[^"]+' "$MCP_JSON" || echo "")

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grep pattern '"--executable-path",\s*"\K[^"]+' uses PCRE syntax with \K (keep) operator and \s* for whitespace. However, this assumes the JSON is formatted with the executable path immediately following the "--executable-path" key. If the JSON structure changes or is reformatted, this could break. Consider using jq to parse the JSON properly instead of grep for more robust extraction.

Suggested change
CURRENT_PATH=$(grep -oP '"--executable-path",\s*"\K[^"]+' "$MCP_JSON" || echo "")
CURRENT_PATH=$(jq -r '.. | arrays? | select(length >= 2 and .[0] == "--executable-path") | .[1]' "$MCP_JSON" 2>/dev/null || echo "")

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +26
```bash
# For Playwright 1.56.0
curl -s https://raw.githubusercontent.com/microsoft/playwright/v1.56.0/packages/playwright-core/browsers.json | grep -A 3 '"name": "chromium"'
```

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curl command example shows checking the browsers.json file from the GitHub repository, but there's no error handling shown. Users following this documentation should be informed that this requires internet connectivity and may fail. Consider adding a note about potential failures or showing the command with error handling.

Copilot uses AI. Check for mistakes.
echo "📁 Installed Chromium directories:"
ls -d /root/.cache/ms-playwright/chromium-* 2>/dev/null || echo " None found"

# Get the latest installed Chromium revision

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The numeric sorting command sort -t- -k2 -n is correct for sorting chromium revision numbers. However, consider adding a comment explaining this sorting logic since it's a critical part of finding the latest revision. The -t- sets the delimiter to hyphen, -k2 selects the second field (the revision number), and -n does numeric sorting.

Suggested change
# Get the latest installed Chromium revision
# Get the latest installed Chromium revision
# We sort directories like "chromium-123456" numerically by the revision part:
# -t- : use '-' as the field delimiter (e.g., "chromium-123456" -> fields: chromium | 123456)
# -k2 : sort by the second field (the numeric revision)
# -n : perform numeric sort so higher revisions are ordered last

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +76
| 1.57.0 | 1200 | 143.0.7499.4 |

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version mapping table shows Playwright 1.57.0 → Chromium revision 1200, but this should be verified against the actual Playwright release. The documentation encourages users to check browsers.json for verification, which is good. Consider adding a note that this table should be updated when new Playwright versions are installed in the Dockerfile.

Suggested change
| 1.57.0 | 1200 | 143.0.7499.4 |
**Important**: Keep this table in sync with the Playwright version specified in `.devcontainer/development/Dockerfile`. When you bump the Playwright version in the Dockerfile, add or update rows here using the corresponding `browsers.json` from that Playwright release.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,94 @@
#!/bin/bash

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script's shebang line is missing a space between #!/bin/bash. While this works in most cases, the canonical form should be #!/bin/bash (with a space).

Suggested change
#!/bin/bash
#! /bin/bash

Copilot uses AI. Check for mistakes.
fi

# Get Playwright version from Dockerfile
PLAYWRIGHT_VERSION=$(grep -oP 'playwright@\K[0-9.]+' /workspace/.devcontainer/development/Dockerfile || echo "unknown")

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grep pattern uses -oP (PCRE) but doesn't escape the period in the version pattern. While this works, it would be more precise to use [0-9.]+ or better yet, [0-9]+\.[0-9]+\.[0-9]+ to match semantic versioning format. The current pattern could theoretically match invalid version strings.

Suggested change
PLAYWRIGHT_VERSION=$(grep -oP 'playwright@\K[0-9.]+' /workspace/.devcontainer/development/Dockerfile || echo "unknown")
PLAYWRIGHT_VERSION=$(grep -oP 'playwright@\K[0-9]+\.[0-9]+\.[0-9]+' /workspace/.devcontainer/development/Dockerfile || echo "unknown")

Copilot uses AI. Check for mistakes.
echo " ${EXPECTED_PATH}"
echo
echo "Or use jq to update it programmatically:"
echo " jq '.mcpServers.playwright.args |= map(if . == \"--executable-path\" then . else if . == \"${CURRENT_PATH}\" then \"${EXPECTED_PATH}\" else . end end)' ${MCP_JSON} > ${MCP_JSON}.tmp && mv ${MCP_JSON}.tmp ${MCP_JSON}"

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jq command suggestion on line 89 has a potential issue - it uses double quotes for the outer string which means the variables ${CURRENT_PATH} and ${EXPECTED_PATH} will be expanded by the shell before being passed to jq, but they're also inside the jq string which could cause issues. The suggestion should use single quotes for the jq expression and construct the replacement properly, or provide a clearer example that avoids nested quote issues.

Suggested change
echo " jq '.mcpServers.playwright.args |= map(if . == \"--executable-path\" then . else if . == \"${CURRENT_PATH}\" then \"${EXPECTED_PATH}\" else . end end)' ${MCP_JSON} > ${MCP_JSON}.tmp && mv ${MCP_JSON}.tmp ${MCP_JSON}"
echo " jq --arg old \"${CURRENT_PATH}\" --arg new \"${EXPECTED_PATH}\" '.mcpServers.playwright.args |= map(if . == \"--executable-path\" then . else if . == \$old then \$new else . end end)' ${MCP_JSON} > ${MCP_JSON}.tmp && mv ${MCP_JSON}.tmp ${MCP_JSON}"

Copilot uses AI. Check for mistakes.
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.

3 participants