feat(plugin-e2e): fetch e2e-selectors from Grafana at runtime - #2819
Draft
sunker wants to merge 4 commits into
Draft
feat(plugin-e2e): fetch e2e-selectors from Grafana at runtime#2819sunker wants to merge 4 commits into
sunker wants to merge 4 commits into
Conversation
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).
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.
What this PR does / why we need it:
Adds a runtime path to the
selectorsfixture: it derives the e2e-selectors file URL from the frontend asset path in bootData (so it resolves to the origin in single-binary and the CDN in multi-tenant), fetches the data-only JSON from the Grafana under test, and reconstructs the template descriptors into selectors locally (no eval), falling back to the bundled@grafana/e2e-selectorswhen 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_SELECTORStoggle. 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 emits the file as a build asset.
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
reconstructand the fixture (toggle off uses bundled with no fetch, quiet 404 fallback, loud fallback on failures, per-version cache).