Skip to main content

Get started

The create-plugin tool automatically scaffolds the basic setup for @grafana/plugin-e2e to help you easily get started with end-to-end testing in your plugin. This guide walks you through the basic usage of running Playwright tests with @grafana/plugin-e2e.

note

If you scaffolded a plugin with a version of create-plugin prior to 4.6.0, follow the migration guide for instruction on how to install and configure @grafana/plugin-e2e manually.

Before you begin​

You need to have the following:

Step 1: Start Grafana​

Start up the latest version of Grafana on your local machine like this:

npm run server

If you want to start a specific version of Grafana, you can do that by specifying the GRAFANA_VERSION environment variable. For example:

GRAFANA_VERSION=10.4.1 npm run server

Step 2: Run tests​

Open a new terminal and run the test script from within your local plugin development directory.

npx playwright test

Step 3: Run tests in CI​

The grafanaDependency property in the plugin.json file specifies what versions of Grafana the plugin is compatible with. As a best practice, run your Playwright end-to-end tests targeting all the supported versions. The GitHub workflow that can be included when scaffolding plugins with create-plugin ensures this is the case.

If you chose to not add a GitHub workflow when you scaffolded the plugin, as a best practice follow the instructions in the CI guide to run Playwright end-to-end tests targeting all versions of Grafana that your plugin supports.

What's next?​

Next we suggest you checkout the following guides: