use const for test config file

This commit is contained in:
Ildar Kamalov
2025-02-18 17:40:41 +03:00
parent 58faa7c537
commit 26b0eddaca
3 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from '@playwright/test';
import path from 'path'; import path from 'path';
import { CONFIG_FILE_PATH } from './tests/constants';
/** /**
* See https://playwright.dev/docs/test-configuration. * See https://playwright.dev/docs/test-configuration.
@@ -42,7 +43,7 @@ export default defineConfig({
webServer: { webServer: {
stdout: process.env.CI ? 'pipe' : 'ignore', stdout: process.env.CI ? 'pipe' : 'ignore',
command: `${!process.env.CI ? 'sudo ' : ''}./AdGuardHome --local-frontend -v -c /tmp/AdGuard.temp.e2e.yaml`, command: `${!process.env.CI ? 'sudo ' : ''}./AdGuardHome --local-frontend -v -c ${CONFIG_FILE_PATH}`,
url: 'http://127.0.0.1:3000', url: 'http://127.0.0.1:3000',
cwd: '..', cwd: '..',
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,

View File

@@ -1,3 +1,4 @@
export const ADMIN_USERNAME = 'admin'; export const ADMIN_USERNAME = 'admin';
export const ADMIN_PASSWORD = 'superpassword'; export const ADMIN_PASSWORD = 'superpassword';
export const PORT = 3000; export const PORT = 3000;
export const CONFIG_FILE_PATH = '/tmp/AdGuard.e2e.yaml';

View File

@@ -1,11 +1,10 @@
import { existsSync, unlinkSync } from 'fs'; import { existsSync, unlinkSync } from 'fs';
import { CONFIG_FILE_PATH } from '../constants';
export const CONFIG_FILE = '/tmp/AdGuard.temp.e2e.yaml';
async function globalTeardown() { async function globalTeardown() {
// Remove the test config file // Remove the test config file
if (existsSync(CONFIG_FILE)) { if (existsSync(CONFIG_FILE_PATH)) {
unlinkSync(CONFIG_FILE); unlinkSync(CONFIG_FILE_PATH);
} }
} }