2024-02-23 05:39:30 -06:00
|
|
|
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
import path, { dirname } from 'path';
|
|
|
|
|
|
|
|
import { PluginOptions } from '@grafana/plugin-e2e';
|
|
|
|
|
2024-03-19 17:07:48 -05:00
|
|
|
const testDirRoot = 'e2e/plugin-e2e/';
|
2024-02-23 05:39:30 -06:00
|
|
|
|
|
|
|
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}`,
|
2024-03-12 07:48:32 -05:00
|
|
|
trace: 'retain-on-failure',
|
2024-02-23 05:39:30 -06:00
|
|
|
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',
|
2024-03-19 17:07:48 -05:00
|
|
|
testDir: path.join(testDirRoot, '/plugin-e2e-api-tests/as-admin-user'),
|
2024-02-23 05:39:30 -06:00
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/admin.json',
|
|
|
|
},
|
|
|
|
dependencies: ['authenticate'],
|
|
|
|
},
|
|
|
|
// Run all tests in parallel using user with viewer role
|
|
|
|
{
|
|
|
|
name: 'viewer',
|
2024-03-19 17:07:48 -05:00
|
|
|
testDir: path.join(testDirRoot, '/plugin-e2e-api-tests/as-viewer-user'),
|
2024-02-23 05:39:30 -06:00
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/viewer.json',
|
|
|
|
},
|
|
|
|
dependencies: ['createUserAndAuthenticate'],
|
|
|
|
},
|
2024-10-21 15:13:40 -05:00
|
|
|
{
|
|
|
|
name: 'elasticsearch',
|
|
|
|
testDir: path.join(testDirRoot, '/elasticsearch'),
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/admin.json',
|
|
|
|
},
|
|
|
|
dependencies: ['authenticate'],
|
|
|
|
},
|
2024-03-19 17:07:48 -05:00
|
|
|
{
|
|
|
|
name: 'mysql',
|
|
|
|
testDir: path.join(testDirRoot, '/mysql'),
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/admin.json',
|
|
|
|
},
|
|
|
|
dependencies: ['authenticate'],
|
|
|
|
},
|
2024-10-21 04:36:18 -05:00
|
|
|
{
|
|
|
|
name: 'mssql',
|
|
|
|
testDir: path.join(testDirRoot, '/mssql'),
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/admin.json',
|
|
|
|
},
|
|
|
|
dependencies: ['authenticate'],
|
|
|
|
},
|
2024-08-26 09:01:32 -05:00
|
|
|
{
|
|
|
|
name: 'extensions-test-app',
|
|
|
|
testDir: 'e2e/test-plugins/grafana-extensionstest-app',
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/admin.json',
|
|
|
|
},
|
|
|
|
dependencies: ['authenticate'],
|
|
|
|
},
|
2024-11-01 02:25:27 -05:00
|
|
|
{
|
|
|
|
name: 'grafana-e2etest-datasource',
|
|
|
|
testDir: 'e2e/test-plugins/grafana-test-datasource',
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/admin.json',
|
|
|
|
},
|
|
|
|
dependencies: ['authenticate'],
|
|
|
|
},
|
2024-10-21 15:13:22 -05:00
|
|
|
{
|
|
|
|
name: 'cloudwatch',
|
|
|
|
testDir: path.join(testDirRoot, '/cloudwatch'),
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
storageState: 'playwright/.auth/admin.json',
|
|
|
|
},
|
|
|
|
dependencies: ['authenticate'],
|
|
|
|
},
|
2024-02-23 05:39:30 -06:00
|
|
|
],
|
|
|
|
});
|