Skip to content

fix(plugin-e2e): handle table-based preview of values in toDisplayPreviews#2760

Merged
tolzhabayev merged 4 commits into
mainfrom
fix/to-display-previews-table-variant
Jul 8, 2026
Merged

fix(plugin-e2e): handle table-based preview of values in toDisplayPreviews#2760
tolzhabayev merged 4 commits into
mainfrom
fix/to-display-previews-table-variant

Conversation

@tolzhabayev

Copy link
Copy Markdown
Collaborator

Since Grafana 13.1.0 the multiPropsVariables behavior is always on (toggle removed in grafana/grafana#126905). Any variable query result with a data frame field not named value or text now carries that field as an option property, and the variable editor previews the options in a table instead of the label list. That's every SQL-style variable query, so toDisplayPreviews times out waiting for the previewOfValuesOption locator, which never appears. Reported by the AWS datasources squad after their plugin-e2e variable tests started failing on 13.1.0.

The matcher now waits for either presentation and, when the table is shown, asserts against its text column, which holds the same display text the labels used to show. Older Grafana versions still render the labels and keep the old code path.

The new test mocks a variable query response with a humidity field. It renders as labels on older versions and as the table on 13.1+, and it fails on 13.1.0 without this fix. Verified locally against grafana-enterprise 11.4.0 and 13.1.0.

@tolzhabayev tolzhabayev self-assigned this Jul 8, 2026
@grafana-catalog-project-bot grafana-catalog-project-bot Bot moved this from 📬 Triage to 🧑‍💻 In development in Grafana Catalog Team Jul 8, 2026
@tolzhabayev tolzhabayev requested a review from leventebalogh July 8, 2026 09:50
@tolzhabayev tolzhabayev marked this pull request as ready for review July 8, 2026 10:48
@tolzhabayev tolzhabayev requested a review from a team as a code owner July 8, 2026 10:48
@tolzhabayev tolzhabayev requested review from oshirohugo and wbrowne July 8, 2026 10:48
leventebalogh
leventebalogh previously approved these changes Jul 8, 2026

@leventebalogh leventebalogh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

variableEditPage.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption
)
).toContainText(previewTexts, options);
await expect(previewLabels.first().or(previewTable).first()).toBeVisible({ timeout: options?.timeout });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one .first() could be enough here?

Suggested change
await expect(previewLabels.first().or(previewTable).first()).toBeVisible({ timeout: options?.timeout });
await expect(previewLabels.or(previewTable).first()).toBeVisible({ timeout: options?.timeout });

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, applied.

@github-project-automation github-project-automation Bot moved this from 🧑‍💻 In development to 🔬 In review in Grafana Catalog Team Jul 8, 2026
@tolzhabayev tolzhabayev merged commit 47a8c34 into main Jul 8, 2026
38 checks passed
@tolzhabayev tolzhabayev deleted the fix/to-display-previews-table-variant branch July 8, 2026 12:32
@github-project-automation github-project-automation Bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

2 participants