Skip to content

feat: add plugin-directory support for playwright#683

Closed
oshirohugo wants to merge 5 commits into
mainfrom
use-plugin-directory-on-playwrite
Closed

feat: add plugin-directory support for playwright#683
oshirohugo wants to merge 5 commits into
mainfrom
use-plugin-directory-on-playwrite

Conversation

@oshirohugo
Copy link
Copy Markdown
Contributor

@oshirohugo oshirohugo commented Apr 22, 2026

Summary

When a plugin lives in a subdirectory (e.g. monorepos using plugin-directory), the Playwright workflow failed to resolve the correct Grafana versions to test against. The e2e-version action always looked for src/plugin.json at the repo root, ignoring plugin-directory. The only workaround was to manually duplicate the Grafana version range via run-playwright-with-grafana-dependency, which is easy to forget and gets stale.

This PR eliminates the workaround by automatically reading grafanaDependency from the plugin's own src/plugin.json (inside plugin-directory) when neither an explicit grafana-dependency input nor a root-level src/plugin.json applies.

A secondary bug was also fixed: the "Install Playwright Browsers" step was missing working-directory, causing npx to run from the repo root (where no node_modules exists in a monorepo layout), which silently installed a different playwright version globally and downloaded the wrong Chromium revision.

Closes #553.

Changes

  • playwright.yml — auto-read grafanaDependency from plugin-directory/src/plugin.json
    Added a Read Grafana dependency from plugin.json step that runs when plugin-directory != '.' and no explicit grafana-dependency is provided. It reads grafanaDependency from ${plugin-directory}/src/plugin.json using jq and passes it as a fallback to the e2e-version action. This makes the workflow self-contained for monorepo plugins without requiring any manual input.

  • playwright.yml — fix missing working-directory on browser install step
    The Install Playwright Browsers step lacked working-directory: ${{ inputs.plugin-directory }}. When the plugin is in a subdirectory, npx ran from the repo root (no local node_modules), fell back to downloading the latest playwright from the registry, and installed the wrong Chromium revision — causing all E2E test jobs to fail with "Executable doesn't exist". Added the missing working-directory to match every other npm step in the job.

Tests

@oshirohugo oshirohugo self-assigned this Apr 22, 2026
@grafana-plugins-platform-bot grafana-plugins-platform-bot Bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Apr 22, 2026
@oshirohugo oshirohugo marked this pull request as ready for review April 24, 2026 17:49
@oshirohugo oshirohugo requested review from a team as code owners April 24, 2026 17:49
@sunker
Copy link
Copy Markdown
Contributor

sunker commented Apr 27, 2026

Hi Hugo, I just came across this PR. I actually opened another PR last week that tackles the same issue but with a slightly different approach: #696. One advantage of that approach is that it keeps the plugin-action and plugin-ci-workflows APIs in sync.

It’s still a draft for now, as I’m waiting on the SLO team to assist with testing.

@oshirohugo
Copy link
Copy Markdown
Contributor Author

@sunker tks for letting me know Erick. I will close this PR then :D.

@oshirohugo
Copy link
Copy Markdown
Contributor Author

Closing this PR in favor of #696

@oshirohugo oshirohugo closed this Apr 27, 2026
@github-project-automation github-project-automation Bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Improve support for Playwright tests when using plugin-directory input

2 participants