Playwright: Gate server start up with GRAFANA_URL env var (#108302)
* refactor so server is created unless GRAFANA_URL is provided * update documentation * don't swallow errors from the server process
This commit is contained in:
+10
-1
@@ -5,6 +5,7 @@ import { PluginOptions } from '@grafana/plugin-e2e';
|
||||
|
||||
const testDirRoot = 'e2e-playwright';
|
||||
const pluginDirRoot = path.join(testDirRoot, 'plugin-e2e');
|
||||
const DEFAULT_URL = 'http://localhost:3001';
|
||||
|
||||
export default defineConfig<PluginOptions>({
|
||||
fullyParallel: true,
|
||||
@@ -16,7 +17,7 @@ export default defineConfig<PluginOptions>({
|
||||
['html'], // pretty
|
||||
],
|
||||
use: {
|
||||
baseURL: `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 3000}`,
|
||||
baseURL: process.env.GRAFANA_URL ?? DEFAULT_URL,
|
||||
trace: 'retain-on-failure',
|
||||
httpCredentials: {
|
||||
username: 'admin',
|
||||
@@ -26,6 +27,14 @@ export default defineConfig<PluginOptions>({
|
||||
permissions: ['clipboard-read', 'clipboard-write'],
|
||||
provisioningRootDir: path.join(process.cwd(), process.env.PROV_DIR ?? 'conf/provisioning'),
|
||||
},
|
||||
...(!process.env.GRAFANA_URL && {
|
||||
webServer: {
|
||||
command: 'yarn e2e:plugin:build && ./e2e-playwright/start-server',
|
||||
url: DEFAULT_URL,
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
},
|
||||
}),
|
||||
projects: [
|
||||
// Login to Grafana with admin user and store the cookie on disk for use in other tests
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user