Skip to content

Plugin E2E: Add missing components to the components fixture#2621

Open
mckn wants to merge 1 commit intomainfrom
mckn/add-missing-components
Open

Plugin E2E: Add missing components to the components fixture#2621
mckn wants to merge 1 commit intomainfrom
mckn/add-missing-components

Conversation

@mckn
Copy link
Copy Markdown
Collaborator

@mckn mckn commented May 8, 2026

What this PR does / why we need it:

Follow-up to #2583. Adds six more Grafana UI components to the components fixture: Select, MultiSelect, Switch, RadioGroup, UnitPicker, and ColorPicker. Each component gets a static getContainer() method for version-conditional container resolution and a within(root) method for DOM scoping, matching the pattern established by dataSourcePicker and timeRangePicker.

Uses CSS/structural fallback selectors that work across all supported Grafana versions (8.5+). Once grafana/grafana#124120 merges and @grafana/e2e-selectors is updated, a follow-up will add data-testid container selectors for Grafana >= 13.1.0. The six component classes are also now exported from the package public API.

Which issue(s) this PR fixes:

Follows up on #2583 and depends on grafana/grafana#124120 for stable container selectors.

Special notes for your reviewer:

  • switch is used as a property name on the Components class. It's a JS reserved word but valid as a property name in ES6+ class definitions.
  • The fallback CSS selectors (e.g. [class*="-grafana-select-value-container"]) rely on Grafana's Emotion-generated class naming convention and will be replaced by stable data-testid selectors in a follow-up.
  • MultiSelect test is deferred — no provisioned panel currently uses a multi-select option.

…and ColorPicker to components fixture

Extends the components fixture introduced in #2583 with six additional
Grafana UI components. Each component gets a static getContainer() for
version-conditional container resolution and a within(root) method for
DOM scoping. Uses CSS/structural fallback selectors for all Grafana
versions; data-testid selectors will be added once grafana/grafana#124120
merges and @grafana/e2e-selectors is updated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 8, 2026 07:27
@mckn mckn requested a review from a team as a code owner May 8, 2026 07:27
@mckn mckn requested a review from leventebalogh May 8, 2026 07:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

❌ This PR cannot be merged until the following issues are addressed:

  • This PR is missing one of the following labels: patch, minor, major, no-changelog.
  • Optionally if using a patch, minor or major label also add the release label if you would like this PR to trigger npm package publishing.
🏷️ More info about which labels to use
  • If the changes only affect the docs website, documentation, or this repository's tooling add the no-changelog label.
  • If there are changes to any of the npm packages src files please choose from one of the following labels:
    • 🐛 if this PR fixes a bug add the patch label
    • 🚀 if this PR includes an enhancement add the minor label
    • 💥 if this PR includes a breaking change add the major label
  • Optionally, if you would like this PR to publish new versions of packages when it is merged add the release label.

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 8, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Marcus Andersson seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 8, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Marcus Andersson seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@grafana-plugins-platform-bot grafana-plugins-platform-bot Bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds additional Grafana UI component wrappers to the components fixture in @grafana/plugin-e2e so tests can interact with common controls (Select, MultiSelect, Switch, RadioGroup, UnitPicker, ColorPicker) on arbitrary pages, using within(root) scoping similar to existing dataSourcePicker and timeRangePicker.

Changes:

  • Add getContainer() + within(root) support for six component models (Select, MultiSelect, Switch, RadioGroup, UnitPicker, ColorPicker).
  • Extend Components fixture to expose these components and export them from the package public API.
  • Add e2e coverage for the new fixture entries (except MultiSelect, per PR notes).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/plugin-e2e/tests/as-admin-user/components/components.spec.ts Adds e2e tests validating new components.*.within(...) helpers.
packages/plugin-e2e/src/models/components/UnitPicker.ts Adds getContainer() + within() for UnitPicker scoping.
packages/plugin-e2e/src/models/components/Switch.ts Adds version-conditional getContainer() + within() for Switch scoping.
packages/plugin-e2e/src/models/components/Select.ts Adds getContainer() + within() for Select scoping.
packages/plugin-e2e/src/models/components/RadioGroup.ts Adds version-conditional getContainer() + within() for RadioGroup scoping.
packages/plugin-e2e/src/models/components/MultiSelect.ts Adds getContainer() + within() for MultiSelect scoping.
packages/plugin-e2e/src/models/components/ColorPicker.ts Adds getContainer() + within() for ColorPicker scoping.
packages/plugin-e2e/src/models/Components.ts Adds new component instances to the components fixture.
packages/plugin-e2e/src/index.ts Exports the new component classes from the public API.

Comment on lines +15 to +17
return base.locator(
'[class*="-grafana-select-value-container"]:not([class*="-grafana-select-value-container-multi"])'
);
}

within(root: Locator): MultiSelect {
return new MultiSelect(this.ctx, MultiSelect.getContainer(this.ctx, root));
Comment on lines +17 to +19
within(root: Locator): MultiSelect {
return new MultiSelect(this.ctx, MultiSelect.getContainer(this.ctx, root));
}
Comment on lines +13 to 24
static getContainer(ctx: PluginTestCtx, root?: Locator): Locator {
const base = root ?? ctx.page;
return base.locator('[data-testid*="colorswatch"]');
}

within(root: Locator): ColorPicker {
return new ColorPicker(this.ctx, ColorPicker.getContainer(this.ctx, root));
}

async selectOption(rgbOrHex: string, options?: SelectOptionsType): Promise<void> {
await this.element.getByRole('button').click(options);
await this.getCustomTab().click(options);
Comment on lines 29 to +46
readonly dataSourcePicker: DataSourcePicker;
readonly timeRangePicker: TimeRange;
readonly select: Select;
readonly multiSelect: MultiSelect;
readonly switch: Switch;
readonly radioGroup: RadioGroup;
readonly unitPicker: UnitPicker;
readonly colorPicker: ColorPicker;

constructor(ctx: PluginTestCtx) {
this.dataSourcePicker = new DataSourcePicker(ctx);
this.timeRangePicker = new TimeRange(ctx);
this.select = new Select(ctx, Select.getContainer(ctx));
this.multiSelect = new MultiSelect(ctx, MultiSelect.getContainer(ctx));
this.switch = new Switch(ctx, Switch.getContainer(ctx));
this.radioGroup = new RadioGroup(ctx, RadioGroup.getContainer(ctx));
this.unitPicker = new UnitPicker(ctx, UnitPicker.getContainer(ctx));
this.colorPicker = new ColorPicker(ctx, ColorPicker.getContainer(ctx));
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Playwright test results

Image Name Version Result Report
grafana-enterprise nightly View report
grafana-enterprise dev-preview-react19 View report
grafana-enterprise 13.0.1 View report
grafana-enterprise 12.1.10 View report
grafana-enterprise 11.0.11 View report
grafana-enterprise 9.3.16 View report
grafana-enterprise 8.5.27 View report
Troubleshooting

404 when clicking on View report

By default, the deploy-report-pages Action deploys reports to the gh-pages branch. However, you need to take an extra step to ensure that GitHub Pages can build and serve the site from this branch. To do so:

  1. Go to the Settings tab of your repository.
  2. In the left-hand sidebar, click on Pages.
  3. Under Source, select Deploy from a branch, then choose the gh-pages branch.

This action needs to be completed manually in order for your GitHub Pages site to be built and accessible from the gh-pages branch. Once configured, GitHub will automatically build and serve the site whenever new reports are deployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔬 In review

Development

Successfully merging this pull request may close these issues.

2 participants