E2E Plugin Testing via Cypress

I’m looking for support in using the included Cypress library for a Grafana dashboard plugin for e2e testing. I want to be able to develop an integration test harness for the plugin and write up tests that run the plugin on my local development Grafana server.

I have setup the plugin with a new cypress.config.ts file in the plugin’s root directory and configured the specPattern: “cypress/e2e/**/*.cy.{js,jsx,ts,tsx}”

The issue I’m encountering is when I try to run the tests via yarn, I get an error:

$ yarn exec grafana-e2e run -C cypress.config.ts 
yarn exec v1.22.21
Can't run because no spec files were found.

We searched for specs inside of this folder:

  > /Users/<my user>/dev/grafana-plugins/myplugin/cypress/integration

The directory in my project exists as cypress/e2e. I have a single spec.cy.ts in there, with a couple of other folders 1-getting-started and 2-advanced-examples in there as well, populated when I ran Cypress directly the first time I ran yarn exec cypress open and chose e2e.

Here is my cypress.config.ts file, nothing too unusual:

import { defineConfig } from 'cypress'

export default defineConfig({
  e2e: {
    // We've imported your old cypress plugins here.
    // You may want to clean this up later by importing these.
    setupNodeEvents(on, config) {
      return require('./cypress/plugins/index.js')(on, config)
    },
    // local grafana login page
    baseUrl: "http://localhost:3000",
    specPattern: "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}",
  },
})

I am running Node v19.8.1 configured via nvm and and Yarn 1.22.21. Tests are being run through VS Code on my MacBook Pro, although I’m just using the terminal (zsh) at the moment.

@esanchez grafana-e2e is dated and is being replaced with plugin-e2e as I understand: plugin-tools/packages/plugin-e2e at main · grafana/plugin-tools · GitHub

It’s based on Playwright and we are waiting for the stable version to try it out and starting to use it.

@mikhailvolkov Good to hear it! Is there an ETA for the stable version?

@esanchez I would recommend to follow the GitHub repository.

It’s getting closer to v1, when we will start testing for our projects: Releases · grafana/plugin-tools · GitHub