mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 06:42:04 +08:00

* WIP * Update yarn.lock * Align uuid dependency * Add e2e test and update * Update cue version * Fix lint * Update snapshot test * Fix test that was importing from coupled module * Fix lint * Update public/app/plugins/datasource/loki/package.json Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com> --------- Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
201 lines
5.6 KiB
TypeScript
201 lines
5.6 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
import path, { dirname } from 'path';
|
|
|
|
import { PluginOptions } from '@grafana/plugin-e2e';
|
|
|
|
const testDirRoot = 'e2e/plugin-e2e/';
|
|
|
|
export default defineConfig<PluginOptions>({
|
|
fullyParallel: true,
|
|
/* Retry on CI only */
|
|
retries: process.env.CI ? 2 : 0,
|
|
/* Opt out of parallel tests on CI. */
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: 'html',
|
|
use: {
|
|
baseURL: `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 3000}`,
|
|
trace: 'retain-on-failure',
|
|
httpCredentials: {
|
|
username: 'admin',
|
|
password: 'admin',
|
|
},
|
|
provisioningRootDir: path.join(process.cwd(), process.env.PROV_DIR ?? 'conf/provisioning'),
|
|
},
|
|
projects: [
|
|
// Login to Grafana with admin user and store the cookie on disk for use in other tests
|
|
{
|
|
name: 'authenticate',
|
|
testDir: `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`,
|
|
testMatch: [/.*\.js/],
|
|
},
|
|
// Login to Grafana with new user with viewer role and store the cookie on disk for use in other tests
|
|
{
|
|
name: 'createUserAndAuthenticate',
|
|
testDir: `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`,
|
|
testMatch: [/.*\.js/],
|
|
use: {
|
|
user: {
|
|
user: 'viewer',
|
|
password: 'password',
|
|
role: 'Viewer',
|
|
},
|
|
},
|
|
},
|
|
// Run all tests in parallel using user with admin role
|
|
{
|
|
name: 'admin',
|
|
testDir: path.join(testDirRoot, '/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',
|
|
testDir: path.join(testDirRoot, '/plugin-e2e-api-tests/as-viewer-user'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/viewer.json',
|
|
},
|
|
dependencies: ['createUserAndAuthenticate'],
|
|
},
|
|
{
|
|
name: 'elasticsearch',
|
|
testDir: path.join(testDirRoot, '/elasticsearch'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'mysql',
|
|
testDir: path.join(testDirRoot, '/mysql'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'mssql',
|
|
testDir: path.join(testDirRoot, '/mssql'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'extensions-test-app',
|
|
testDir: 'e2e/test-plugins/grafana-extensionstest-app',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'grafana-e2etest-datasource',
|
|
testDir: 'e2e/test-plugins/grafana-test-datasource',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'cloudwatch',
|
|
testDir: path.join(testDirRoot, '/cloudwatch'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'azuremonitor',
|
|
testDir: path.join(testDirRoot, '/azuremonitor'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'cloudmonitoring',
|
|
testDir: path.join(testDirRoot, '/cloudmonitoring'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'graphite',
|
|
testDir: path.join(testDirRoot, '/graphite'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'influxdb',
|
|
testDir: path.join(testDirRoot, '/influxdb'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'opentsdb',
|
|
testDir: path.join(testDirRoot, '/opentsdb'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'jaeger',
|
|
testDir: path.join(testDirRoot, '/jaeger'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'grafana-postgresql-datasource',
|
|
testDir: path.join(testDirRoot, '/grafana-postgresql-datasource'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'zipkin',
|
|
testDir: path.join(testDirRoot, '/zipkin'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
{
|
|
name: 'loki',
|
|
testDir: path.join(testDirRoot, '/loki'),
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['authenticate'],
|
|
},
|
|
],
|
|
});
|