
Product
Unify Your Security Stack with Socket Basics
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
@grafana/plugin-e2e
Advanced tools
end-to-end test Grafana plugins with ease.
Links
@grafana/plugin-e2e
is designed specifically for Grafana plugin developers. It extends Playwright test capabilities with fixtures, models, and expect matchers, enabling comprehensive end-to-end testing of Grafana plugins across multiple versions of Grafana. This package simplifies the testing process, ensuring your plugin is robust and compatible with various Grafana environments.
Checkout our Get started
guide for detailed instructions on how to install, configure, write tests and run your end-to-end tests in CI.
Please refer to the Playwright documentation for instruction on how to install. @grafana/plugin-e2e
extends Playwright APIs, so you need to have Playwright/test
with a minimum version of 1.41.2 installed as a dev dependency in the package.json file of your plugin.
Open the Playwright config file that was generated when Playwright was installed and paste the following configuration.
import { dirname } from 'path';
import { defineConfig, devices } from '@playwright/test';
import type { PluginOptions } from '@grafana/plugin-e2e';
const pluginE2eAuth = `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`;
export default defineConfig<PluginOptions>({
testDir: './tests', // change this to the directory that was chosen when installing Playwright
reporter: 'html',
use: {
baseURL: process.env.GRAFANA_URL || 'http://localhost:3000',
},
projects: [
{
name: 'auth',
testDir: pluginE2eAuth,
testMatch: [/.*\.js/],
},
{
name: 'run-tests',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['auth'],
},
],
});
Here's a basic example of how to write an end-to-end test using @grafana/plugin-e2e
:
import { test, expect } from '@grafana/plugin-e2e';
test('data query should return values 10 and 20', async ({ panelEditPage, readProvisionedDataSource }) => {
const ds = await readProvisionedDataSource({ fileName: 'datasources.yml' });
await panelEditPage.datasource.set(ds.name);
await panelEditPage.setVisualization('Table');
await expect(panelEditPage.refreshPanel()).toBeOK();
await expect(panelEditPage.panel.data).toContainText(['10', '20']);
});
To run your tests, use the following command:
npx playwright test
We welcome contributions to @grafana/plugin-e2e. If you're interested in contributing, please read our contributing guidelines.
@grafana/plugin-e2e
wouldn't be possible without Playwright test. Many thanks to Microsoft and all the people contributing to this amazing tool!
FAQs
end-to-end test Grafana plugins with ease.
The npm package @grafana/plugin-e2e receives a total of 47,637 weekly downloads. As such, @grafana/plugin-e2e popularity was classified as popular.
We found that @grafana/plugin-e2e demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Product
Socket is launching experimental protection for the Hugging Face ecosystem, scanning for malware and malicious payload injections inside model files to prevent silent AI supply chain attacks.
Research
/Security News
The Socket Threat Research Team uncovered a coordinated campaign that floods the Chrome Web Store with 131 rebranded clones of a WhatsApp Web automation extension to spam Brazilian users.