use const for test config file
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled

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 path from 'path';
import { CONFIG_FILE_PATH } from './tests/constants';
/**
* See https://playwright.dev/docs/test-configuration.
@ -42,7 +43,7 @@ export default defineConfig({
webServer: {
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',
cwd: '..',
reuseExistingServer: !process.env.CI,

View File

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

View File

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