E2E: Add performance monitoring E2E test (#109417)

* initial workflow

* add bench reporter

* add pr trigger

* update workflow

* actually add the test

* debug

.....

* more debug

* this it???

* Debugging GHA workflow

https

newline

tree

cache node modules

try bench again

fix path

* Add RequestsRecorder and tweak GHA workflow

* More debugging GHA workflow

cache

cache key

try renaming path

specify env var correctly

* Run tests on both envs, wait for requests to finish

fix status

cat stats

cat stats

* prefix metric names

* cleanup

* cleanup gha

* codeowners

* make gen-jsonnet

* quote things

* Add host_type label for categorising the various hosts

* rename pw_boot_time_seconds to pw_test_run_time_seconds

* change prefix

* codeowners, gha name

* remove node-modules caching

* fix codeowners
This commit is contained in:
Josh Hunt
2025-08-20 19:36:54 +00:00
committed by GitHub
parent 7c2945bb54
commit fbca70747c
10 changed files with 549 additions and 166 deletions
+61 -165
View File
@@ -1,4 +1,4 @@
import { defineConfig, devices } from '@playwright/test';
import { defineConfig, devices, PlaywrightTestConfig, Project } from '@playwright/test';
import path, { dirname } from 'path';
import { PluginOptions } from '@grafana/plugin-e2e';
@@ -7,6 +7,19 @@ const testDirRoot = 'e2e-playwright';
const pluginDirRoot = path.join(testDirRoot, 'plugin-e2e');
const DEFAULT_URL = 'http://localhost:3001';
function withAuth(project: Project): Project {
project.dependencies ??= [];
project.use ??= {};
project.dependencies = project.dependencies.concat('authenticate');
project.use = {
...project.use,
storageState: `playwright/.auth/${process.env.GRAFANA_ADMIN_USER || 'admin'}.json`,
};
return project;
}
export default defineConfig<PluginOptions>({
fullyParallel: true,
/* Retry on CI only */
@@ -20,6 +33,7 @@ export default defineConfig<PluginOptions>({
timeout: 10_000,
},
use: {
...devices['Desktop Chrome'],
baseURL: process.env.GRAFANA_URL ?? DEFAULT_URL,
trace: 'retain-on-failure',
httpCredentials: {
@@ -59,15 +73,10 @@ export default defineConfig<PluginOptions>({
},
},
// Run all tests in parallel using user with admin role
{
withAuth({
name: 'admin',
testDir: path.join(pluginDirRoot, '/plugin-e2e-api-tests/as-admin-user'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
}),
// Run all tests in parallel using user with viewer role
{
name: 'viewer',
@@ -78,210 +87,97 @@ export default defineConfig<PluginOptions>({
},
dependencies: ['createUserAndAuthenticate'],
},
{
withAuth({
name: 'elasticsearch',
testDir: path.join(pluginDirRoot, '/elasticsearch'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'mysql',
testDir: path.join(pluginDirRoot, '/mysql'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'mssql',
testDir: path.join(pluginDirRoot, '/mssql'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'extensions-test-app',
testDir: path.join(testDirRoot, '/test-plugins/grafana-extensionstest-app'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'grafana-e2etest-datasource',
testDir: path.join(testDirRoot, '/test-plugins/grafana-test-datasource'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'cloudwatch',
testDir: path.join(pluginDirRoot, '/cloudwatch'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'azuremonitor',
testDir: path.join(pluginDirRoot, '/azuremonitor'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'cloudmonitoring',
testDir: path.join(pluginDirRoot, '/cloudmonitoring'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'graphite',
testDir: path.join(pluginDirRoot, '/graphite'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'influxdb',
testDir: path.join(pluginDirRoot, '/influxdb'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'opentsdb',
testDir: path.join(pluginDirRoot, '/opentsdb'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'jaeger',
testDir: path.join(pluginDirRoot, '/jaeger'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'grafana-postgresql-datasource',
testDir: path.join(pluginDirRoot, '/grafana-postgresql-datasource'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'canvas',
testDir: path.join(testDirRoot, '/canvas'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'zipkin',
testDir: path.join(pluginDirRoot, '/zipkin'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
}),
{
name: 'unauthenticated',
testDir: path.join(testDirRoot, '/unauthenticated'),
use: {
...devices['Desktop Chrome'],
},
},
{
withAuth({
name: 'various',
testDir: path.join(testDirRoot, '/various-suite'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'panels',
testDir: path.join(testDirRoot, '/panels-suite'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'smoke',
testDir: path.join(testDirRoot, '/smoke-tests-suite'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'dashboards',
testDir: path.join(testDirRoot, '/dashboards-suite'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'loki',
testDir: path.join(testDirRoot, '/loki'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'cloud-plugins',
testDir: path.join(testDirRoot, '/cloud-plugins-suite'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
{
}),
withAuth({
name: 'dashboard-new-layouts',
testDir: path.join(testDirRoot, '/dashboard-new-layouts'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
}),
],
});