Fix Playwright plugin-row locator strict-mode collisions in Playground e2e specs#30
Closed
Copilot wants to merge 2 commits into
Closed
Fix Playwright plugin-row locator strict-mode collisions in Playground e2e specs#30Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix failing Playwright e2e tests for CI job 75264109601
Fix Playwright plugin-row locator strict-mode collisions in Playground e2e specs
May 10, 2026
dknauss
approved these changes
May 10, 2026
Owner
|
Fix applied directly to main in 91ac37d. Thanks Copilot. |
dknauss
added a commit
that referenced
this pull request
May 10, 2026
Version bump: - bibliography-builder.php, block.json, package.json, readme.txt → 1.4.0 - CHANGELOG.md and readme.txt changelog updated for 1.4.0 i18n: - msgmerge all 19 PO files against updated POT; +30 new fuzzy strings per locale (BAC checks, BibLaTeX export, reorder controls, PHP errors) E2E: - Fix getPluginRow() in playground.spec.js and numeric-reorder.spec.js: use data-plugin + :not(.plugin-update-tr) to avoid strict-mode violations when WordPress renders a plugin update notice row alongside the plugin row. Closes Copilot PR #30. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CI
playwright-playgroundwas failing becauseensurePluginActivated()used a broad locator that matched both the plugin row and WordPress’s plugin update notice row (tr.plugin-update-tr), triggering Playwright strict-mode errors in two specs.Scope
tests/e2e/playground.spec.jstests/e2e/numeric-reorder.spec.jsLocator precision fix
Pluginstable lookup.Assertion hardening
ensurePluginActivated():await expect(pluginRow).toHaveCount(1);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:
api.wordpress.org/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-wasm-jspi /home/REDACTED/.npm/_npx/3b7824ec561ce8ed/node_modules/.bin/wp-playground-cli server --auto-mount --login --port=9400(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Update the failing Playwright e2e tests in the repository
dknauss/borges-bibliography-builderto fix the CI failure from job 75264109601 in workflow run 25642047183.Context:
.github/workflows/ci.ymlin theplaywright-playgroundjob.1947b525637e814e17f975bc9c80ec22a3fc2e99.tests/e2e/playground.spec.jstests/e2e/numeric-reorder.spec.jsObserved failure:
ensurePluginActivated().getPluginRow(page)matches both the actual plugin row and a WordPress plugin update notice row (tr.plugin-update-tr), causingexpect(locator).toBeVisible()to fail because the locator resolves to 2 elements.Required fix:
.plugin-update-tr.Suggested implementation:
Optional hardening if appropriate:
await expect(pluginRow).toHaveCount(1);beforetoBeVisible()if it improves test clarity and stability without making the tests brittle.Please create a pull request with the test fixes only.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The failure is in the shared Playwright helper that finds the plugin row on Plugins → Installed Plugins.
Root cause
Both failing specs use
getPluginRow():tests/e2e/playground.spec.jstests/e2e/numeric-reorder.spec.jsThe current locator combines:
In CI, WordPress renders two matching rows for the plugin:
tr.plugin-update-tr ...)The logs show the strict mode violation came from that combined locator resolving to both rows.
Fix
Make
getPluginRow()target only the real plugin row and exclude the update row fallback.Suggested patch
Apply this in both files:
Why this works
data-plugin="borges-bibliography-builder/bibliography-builder.php"uniquely identifies the plugin.:not(.plugin-update-tr)filters out the update notice row that is breaking strict mode.hasText: 'Bibliography'), which is too loose.Concrete edits
tests/e2e/playground.spec.jsReplace lines 4–15 with:
tests/e2e/numeric-reorder.spec.jsReplace lines 4–15 with:
Optional hardening
If you want to be extra defensive, also assert a single match before using it:
Relevant failure locations
tests/e2e/playground.spec.js#L25tests/e2e/numeric-reorder.spec.js#L24Job definition reference
This failure occurred in the Playwright job defined in:
.github/workflows/ci.yml](https://github.com/dknauss/borges-bibliography-builder/blob/1947b52563...This pull request was created from Copilot chat.