feat(plugin-e2e): expose response body from waitForQueryDataResponse - #2854
Open
adamyeats wants to merge 2 commits into
Open
feat(plugin-e2e): expose response body from waitForQueryDataResponse#2854adamyeats wants to merge 2 commits into
adamyeats wants to merge 2 commits into
Conversation
sunker
self-requested a review
August 27, 2026 08:18
Contributor
Author
|
@sunker Good call! Added some docs for this 👍 |
adamyeats
marked this pull request as ready for review
August 27, 2026 12:50
adamyeats
requested review from
Ukochka,
ashharrison90,
jackw,
toddtreece and
xnyo
and removed request for
a team
August 27, 2026 12:50
adamyeats
force-pushed
the
adamyeats/expose-query-response-body
branch
from
August 27, 2026 12:51
750dc90 to
977ed36
Compare
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:
GrafanaPage.waitForQueryDataResponseonly ever hands the caller a raw PlaywrightResponse— itscbpredicate is(request: Response) => boolean | Promise<boolean>, with no way to filter or assert on the response body without a separate.json()call. Reading the body after the response has resolved is unreliable in practice (the CDP buffer isn't guaranteed to still be live), so plugin authors end up re-implementing "parse the body inside the predicate, stash it in a closure" by hand — that's exactly whatgrafana/clickhouse-datasourcedid, and where this suggestion came from (review feedback on clickhouse-datasource#2122, no existing upstream issue to link).This PR adds a new, purely additive
waitForQueryDataResponseWithBodymethod alongside the existingwaitForQueryDataResponse, on the sharedGrafanaPagebase class so every page model (ExplorePage,DashboardPage,PanelEditPage,AlertRuleEditPage) gets it for free. It returns{ response, body }, and its predicate receives the parsed body so callers can filter by response contents (e.g. a specific refId's frames) rather than only status/url. Tagged@alphafollowing the precedent ofDashboardPage.waitForPanelsQueriesToComplete, since the exact return shape may want to evolve.The existing
waitForQueryDataResponseis untouched — nothing about this is a breaking change.Which issue(s) this PR fixes:
None filed — this came directly out of review feedback on an external plugin's PR (see above). Happy to file one first if preferred.
Special notes for your reviewer:
grafana-enterprise:11.4.0vianpm run server+npx playwright test: the two new tests pass, and the full existingqueryEditor.integration.spec.ts/queryEditor.spec.tssuites pass unchanged.--workers=1(all passed, both with and without this change). No test that exercisesGrafanaPage/waitForQueryDataResponseregressed.waitForQueryDataResponseWithBodyto mirrorclickhouse-datasource's own local helper, for continuity with the code this is generalising from. Open to a different name if you'd prefer something else.