Skip to content

feat(plugin-e2e): fetch e2e-selectors from Grafana at runtime - #2819

Draft
sunker wants to merge 2 commits into
mainfrom
runtime-e2e-selectors
Draft

feat(plugin-e2e): fetch e2e-selectors from Grafana at runtime#2819
sunker wants to merge 2 commits into
mainfrom
runtime-e2e-selectors

Conversation

@sunker

@sunker sunker commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds a runtime path to the selectors fixture: it fetches the data-only /public/e2e-selectors.json from the Grafana under test and reconstructs the template descriptors into selectors locally (no eval), falling back to the bundled @grafana/e2e-selectors when the file isn't served. This keeps selectors in sync with the Grafana under test without the nightly npm dist-tag.

While we validate the approach, the runtime path is behind a PLUGIN_E2E_RUNTIME_SELECTORS toggle. It defaults to off, so consumers keep using the bundled selectors, and it's enabled only in this repo's Playwright workflows so we can dogfood it before making it the default.

Pairs with the grafana/grafana side that serves the file.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Reconstruction only substitutes named {param} placeholders, it never executes fetched content. Unit tests cover reconstruct and the fixture (toggle off uses bundled with no fetch, quiet 404 fallback, loud fallback on failures, per-version cache).

The selectors fixture fetches the data-only /public/e2e-selectors.json from the Grafana under test, reconstructs the template descriptors into functions locally (no eval) and resolves them. When the instance does not serve the file it falls back to the bundled @grafana/e2e-selectors (quiet on 404, warns on other failures).
@grafana-catalog-project-bot grafana-catalog-project-bot Bot moved this from 📬 Triage to 🧑‍💻 In development in Grafana Catalog Team Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🧑‍💻 In development

Development

Successfully merging this pull request may close these issues.

1 participant