test(dashboards): stop waiting for streamed PromQL responses to finish

#16126 dropped the event-stream guard from applyAndWaitForPromQLQuery that
#15735 added, so on alpha1 the helper again hangs to the 5-minute test timeout
when the query_range stream never reports finished. Restore the guard, and make
promqlSampleValues re-fetch the range instead of reading the browser's body,
which an aborted stream does not keep.
This commit is contained in:
Vamsi Karthik R
2026-11-04 09:55:52 +05:30
parent ce1bf3127b
commit ee75868c58
@@ -363,7 +363,10 @@ export default class DashboardactionPage {
);
await this.applyDashboardBtn();
const response = await promqlResponse;
await response.finished();
// A streamed (text/event-stream) response may never report finished; waitForChartToRender covers completion.
if (!(await response.headerValue("content-type"))?.includes("text/event-stream")) {
await response.finished();
}
await this.waitForChartToRender();
return response;
}
@@ -384,9 +387,10 @@ export default class DashboardactionPage {
);
}
/** Sorted sample values of every series in a finished PromQL query_range event-stream response. */
/** Sorted sample values of every series in a PromQL query_range event-stream response. */
async promqlSampleValues(response) {
return (await response.text())
// The browser can abort the stream after the last event and keep no body, so fetch the same absolute range again.
return (await (await this.page.request.get(response.url())).text())
.split("\n")
.filter((line) => line.startsWith("data: "))
.map((line) => {