-
Notifications
You must be signed in to change notification settings - Fork 528
Add shared Playwright title smoke test #57721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+342
−71
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
23779d2
Plan shared Playwright title smoke test
Copilot caa59ab
Add shared Playwright title smoke test
Copilot 00b592e
Restore pinned checkout action resolution
Copilot 54697af
Upgrade daily-multi-device-docs-tester checkout to v7
Copilot 5024e3d
Fix Playwright title test server unreachable from AWF sandbox
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| --- | ||
| network: | ||
| allowed: | ||
| - playwright | ||
| - local | ||
| - host.docker.internal | ||
| tools: | ||
| playwright: | ||
| bash: | ||
| - "cat /tmp/gh-aw/agent/playwright-title-test-expected.txt" | ||
| - "playwright-cli *" | ||
| steps: | ||
| - name: Start Playwright title test server | ||
| env: | ||
| PLAYWRIGHT_TITLE_TEST_PORT: "4173" | ||
| run: | | ||
| mkdir -p /tmp/gh-aw/agent | ||
| cat > "$RUNNER_TEMP/playwright-title-test-server.cjs" <<'EOF' | ||
| const crypto = require("node:crypto"); | ||
| const fs = require("node:fs"); | ||
| const http = require("node:http"); | ||
|
|
||
| const host = "0.0.0.0"; | ||
| const port = Number(process.env.PLAYWRIGHT_TITLE_TEST_PORT); | ||
| const title = `playwright-${crypto.randomBytes(24).toString("base64url")}`; | ||
|
|
||
| fs.writeFileSync( | ||
| "/tmp/gh-aw/agent/playwright-title-test-expected.txt", | ||
| `${title}\n`, | ||
| { mode: 0o600 }, | ||
| ); | ||
|
|
||
| http.createServer((request, response) => { | ||
| if (request.url === "/title.js") { | ||
| response.writeHead(200, { "Content-Type": "text/javascript; charset=utf-8" }); | ||
| response.end(`document.title = ${JSON.stringify(title)};`); | ||
| return; | ||
| } | ||
|
|
||
| response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }); | ||
| response.end("<!doctype html><html><head><script src=\"/title.js\"></script></head><body>Playwright title test</body></html>"); | ||
| }).listen(port, host); | ||
| EOF | ||
|
|
||
| nohup node "$RUNNER_TEMP/playwright-title-test-server.cjs" \ | ||
| > "$RUNNER_TEMP/playwright-title-test-server.log" 2>&1 & | ||
| echo "$!" > "$RUNNER_TEMP/playwright-title-test-server.pid" | ||
| curl --fail --silent --show-error --retry 10 --retry-connrefused \ | ||
| --retry-all-errors --retry-max-time 30 \ | ||
| "http://127.0.0.1:${PLAYWRIGHT_TITLE_TEST_PORT}/" > /dev/null | ||
| post-steps: | ||
| - name: Stop Playwright title test server | ||
| if: always() | ||
| run: | | ||
| if [ -f "$RUNNER_TEMP/playwright-title-test-server.pid" ]; then | ||
| kill "$(cat "$RUNNER_TEMP/playwright-title-test-server.pid")" 2>/dev/null || true | ||
| fi | ||
| --- | ||
|
|
||
| ## Playwright title validation | ||
|
|
||
| Use Playwright CLI to open `http://host.docker.internal:4173/` and read the page title after | ||
| JavaScript runs. Read the expected value from | ||
| `/tmp/gh-aw/agent/playwright-title-test-expected.txt`, compare the two values for | ||
| exact equality, and report whether the test passed. Do not use curl or another | ||
| HTTP client to discover the title. Always close the browser when finished. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot fix any instance of v6 and upgrade to v7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 54697af — updated the
pre-agent-stepscheckout indaily-multi-device-docs-tester.mdfromactions/checkout@v6.0.2toactions/checkout@v7and recompiled the lock file.