Skip to content

Conversation

@sunker
Copy link
Contributor

@sunker sunker commented Jan 20, 2026

What this PR does / why we need it:

As part of its move toward multi-tenancy, Grafana’s existing feature toggle mechanism will be superseded by OpenFeature. This PR adds support for overriding OpenFeature (OFREP) flags in @grafana/plugin-e2e, enabling Grafana and plugin developers to reliably test plugins that depend on OpenFeature-based feature flags.

Each Playwright test runs in a separate browser context, allowing different OpenFeature flag states to be tested within a single end-to-end run without restarting the Grafana backend.

Fore more details, please refer to the design doc OpenFeature support in plugin-e2e Playwright tests.

OpenFeature flags can be defined globally and selectively overridden at the project level or even per test file.

Example usage:

test.use({                                                                           
  openFeature: {                                                                     
    flags: {                                                                         
      enableNewUI: true,              // boolean                                     
      themeColor: "blue",             // string                                      
      maxRetries: 3,                  // number                                      
      apiConfig: { tier: "premium" }, // object                                      
    },                                                                               
    latency: 200, // optional: simulate network latency                              
  },                                                                                 
});     

// if needed, one can retrieve flag values in tests
test('example', async ({ getBooleanOpenFeatureFlag }) => {
  const isEnabled = await getBooleanOpenFeatureFlag('enableNewUI');
  expect(isEnabled).toBe(true);
});

// legacy feature toggles (explicitly named)
test('legacy example', async ({ isLegacyFeatureToggleEnabled }) => {
  const isEnabled = await isLegacyFeatureToggleEnabled('oldToggle');
  expect(isEnabled).toBe(true);
});                 

Which issue(s) this PR fixes:

Fixes #2384

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/plugin-e2e@3.2.0-canary.2408.21361640222.0
# or 
yarn add @grafana/plugin-e2e@3.2.0-canary.2408.21361640222.0

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

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

✨ This PR can be merged and will trigger a new minor release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot moved this from 📬 Triage to 🔬 In review in Plugins Platform / Grafana Community Jan 20, 2026
@sunker sunker added minor Increment the minor version when merged release Create a release when this pr is merged labels Jan 21, 2026
@sunker sunker changed the title (wip) Plugin E2E: OpenFeature support Plugin E2E: OpenFeature support Jan 23, 2026
@sunker sunker marked this pull request as ready for review January 26, 2026 07:49
@sunker sunker requested review from a team as code owners January 26, 2026 07:49
Copy link
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

This PR adds OpenFeature (OFREP) support to @grafana/plugin-e2e, enabling developers to override OpenFeature-based feature flags in Playwright tests. As Grafana transitions toward multi-tenancy with OpenFeature replacing the legacy feature toggle mechanism, this change allows testing plugins that depend on OpenFeature flags without restarting the Grafana backend.

Changes:

  • Added openFeature configuration option supporting all OpenFeature value types (boolean, string, number, object) with optional latency simulation
  • Implemented OFREP API interception that merges custom flags with backend flags for both bulk and single flag evaluation endpoints
  • Introduced internal bootData fixture to consolidate boot data fetching and added namespace fixture for multi-tenancy support

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/plugin-e2e/src/types.ts Added FeatureFlagValue type, openFeature option to PluginOptions, namespace fixture to PluginFixture, and InternalFixtures type with updated documentation
packages/plugin-e2e/src/fixtures/openFeature.ts Implemented OFREP route interception handlers for bulk and single flag evaluation with latency simulation
packages/plugin-e2e/src/fixtures/bootData.ts Created internal fixture to fetch Grafana version and namespace from boot data
packages/plugin-e2e/src/fixtures/grafanaVersion.ts Refactored to use bootData fixture instead of directly creating a page
packages/plugin-e2e/src/fixtures/namespace.ts Added new fixture to provide namespace value with 'default' fallback
packages/plugin-e2e/src/fixtures/page.ts Integrated OpenFeature route setup before page navigation with version check
packages/plugin-e2e/src/selectors/versionedAPIs.ts Added OpenFeature OFREP endpoint patterns and path generators
packages/plugin-e2e/src/options.ts Added default configuration for openFeature option
packages/plugin-e2e/src/index.ts Wired up internal and public fixtures, added namespace to window type declaration
packages/plugin-e2e/tests/as-admin-user/openfeature/openFeature.spec.ts Test suite verifying OFREP interception and flag merging behavior
packages/plugin-e2e/tests/as-admin-user/openfeature/openFeature-single.spec.ts Test verifying single flag evaluation endpoint interception
packages/plugin-e2e/tests/as-admin-user/openfeature/openFeature-multi-type.spec.ts Test suite verifying all OpenFeature value types in both bulk and single evaluation
packages/plugin-e2e/tests/as-admin-user/openfeature/openFeature-latency.spec.ts Test verifying artificial latency application to OFREP responses
packages/plugin-e2e/tests/as-admin-user/openfeature/openFeature-compatibility.spec.ts Test verifying backward compatibility without OpenFeature configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@hugohaggmark hugohaggmark left a comment

Choose a reason for hiding this comment

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

Looks great 🚀 left a comment.

@github-actions
Copy link
Contributor

Playwright test results

Image Name Version Result Report
grafana-dev 12.4.0-21360641199
grafana-enterprise 12.3.1
grafana-enterprise 11.6.9
grafana-enterprise 10.4.19
grafana-enterprise 9.3.16
grafana-enterprise 8.5.27
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.

@sunker sunker requested a review from hugohaggmark January 27, 2026 12:08
@sunker sunker merged commit 779cb8e into main Jan 29, 2026
38 checks passed
@sunker sunker deleted the plugin-e2e/open-feature branch January 29, 2026 06:31
@github-project-automation github-project-automation bot moved this from 🔬 In review to 🚀 Shipped in Plugins Platform / Grafana Community Jan 29, 2026
@grafana-plugins-platform-bot
Copy link
Contributor

🚀 PR was released in @grafana/create-plugin@6.8.0, @grafana/plugin-e2e@3.2.0, website@5.4.0 🚀

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot added the released This issue/pull request has been released. label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged release Create a release when this pr is merged released This issue/pull request has been released.

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

Plugin E2E: Support new OpenFeature api

2 participants