Skip to content

Fix/test playwright#223

Merged
mishautkin merged 45 commits into
mainfrom
fix/test-playwright
May 12, 2026
Merged

Fix/test playwright#223
mishautkin merged 45 commits into
mainfrom
fix/test-playwright

Conversation

@mishautkin
Copy link
Copy Markdown
Contributor

@mishautkin mishautkin commented Feb 17, 2026

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Feature.

What is the current behavior? (You can also link to an open issue here)

  • All npm and Playwright operations run from the repository root, forcing cd workarounds for projects in subdirectories.
  • PRE_SCRIPT has no access to GitHub CLI authentication, preventing artifact downloads from previous jobs.
  • Test execution only supports a single SCRIPT_NAME npm script, with no way to run Playwright directly with grep or project filters.

What is the new behavior (if this is a feature change)?

  • Adds optional WORK_DIR input (defaults to .) — applies to npm install, Playwright install, PRE_SCRIPT, and test execution. In case of several qa projects (e.g. support of legacy UI on PCP) it would allow to use another palywright project.
  • Exposes GH_TOKEN in PRE_SCRIPT step for GitHub CLI usage (e.g. gh run download).
  • Adds PLAYWRIGHT_GREP, PLAYWRIGHT_GREP_INVERT, PLAYWRIGHT_PROJECT inputs — passes --project, --grep, --grep-invert flags to Playwright when using grep mode.
  • SCRIPT_NAME is now optional, used only when PLAYWRIGHT_GREP is not set.
  • Move .env.ci creation to a separate step because PRE_SCRIPT might require access to env vars (e.g. for VIP authentication).
  • Add ability to report test results to Xray or TestRail

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No.

Comment thread .github/workflows/test-playwright.yml Outdated
Comment thread .github/workflows/test-playwright.yml Outdated
Comment thread .github/workflows/test-playwright.yml Outdated
Comment thread .github/workflows/test-playwright.yml
Comment thread .github/workflows/test-playwright.yml Outdated
@mishautkin mishautkin marked this pull request as ready for review February 25, 2026 10:44
@mishautkin mishautkin requested a review from a team as a code owner February 25, 2026 10:44
mishautkin and others added 14 commits February 25, 2026 12:04
Update how `.env.ci` is created

Replace `echo "${{ secrets.ENV_FILE_DATA }}"` with `printenv` to
avoid bash interpreting special characters ($, `, !) in secret values.

The double-quoted echo caused `$` characters in passwords and tokens
to be treated as variable references, silently truncating values in
the resulting .env.ci file.

Signed-off-by: Misha Utkin <80261935+mishautkin@users.noreply.github.com>
@mishautkin mishautkin requested review from Biont and Chrico April 21, 2026 14:56
@mishautkin
Copy link
Copy Markdown
Contributor Author

@Biont @Chrico please check my last commit. I'd like to have ability to import test results from CI if needed

@Biont
Copy link
Copy Markdown
Member

Biont commented Apr 22, 2026

please check my last commit. I'd like to have ability to import test results from CI if needed

Acknowledged. This is a reasonable and useful addition in my eyes.

@Biont
Copy link
Copy Markdown
Member

Biont commented Apr 24, 2026

Suggestion

  • Rename ARTIFACT_NAME to PLAYWRIGHT_REPORT_ARTIFACT
  • Use ARTFACT_NAME input to automatically download the specified payload into the test dir.

This approach should work for websites and plugins alike: The workflow sets up the environment and test subject for you. How to test is wired up in PRE_SCRIPT

mishautkin and others added 2 commits May 5, 2026 17:49
…act-inputs

Rename ARTIFACT_ inputs in test-playwright.yml
mishautkin and others added 7 commits May 8, 2026 14:11
Parse WP_HOME from .wp-env.json and add the hostname to /etc/hosts
when it is not localhost. This ensures the CI runner resolves the
custom domain to 127.0.0.1 so Playwright requests reach the local
wp-env container instead of the real DNS target.
Replace `npm -g i @wordpress/env && wp-env start` with
`npx wp-env start` to ensure the same version is used for both
`start` and `run` commands. The global install could resolve a
different version than the local devDependency, producing a
different state directory hash and causing `wp-env run` to fail
with "docker-compose.yml: no such file or directory".
Add npx prefix to wp-env commands to match the local
devDependency, consistent with the boot step change that
removed the global wp-env install.
@mishautkin mishautkin requested a review from dottxado May 11, 2026 14:04
@mishautkin
Copy link
Copy Markdown
Contributor Author

mishautkin commented May 11, 2026

The WORK_DIR according to this comment has been removed by #246 and the comment is now resolved. I think it was the last one.

I did CI runs with latest changes on several involved projects.

@Biont @Chrico @dottxado Let's finally close this PR 🥳

Copy link
Copy Markdown
Contributor

@dottxado dottxado left a comment

Choose a reason for hiding this comment

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

Thanks for this huge work 💪 I loved that you added a good collection of examples!
I have found only two minor issues in the documentation, but nothing that prevents me from approving 💪

Comment thread docs/test-playwright.md Outdated
Comment thread docs/test-playwright.md
@mishautkin mishautkin merged commit b15d6b2 into main May 12, 2026
3 checks passed
@mishautkin mishautkin deleted the fix/test-playwright branch May 12, 2026 09:03
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.

4 participants