Skip to content

Commit

Permalink
use const for test config file
Browse files Browse the repository at this point in the history
  • Loading branch information
IldarKamalov committed Feb 18, 2025
1 parent 58faa7c commit 26b0edd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion client/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions client/tests/constants.ts
Original file line number Diff line number Diff line change
@@ -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';
7 changes: 3 additions & 4 deletions client/tests/e2e/globalTeardown.ts
Original file line number Diff line number Diff line change
@@ -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);
}
}

Expand Down

0 comments on commit 26b0edd

Please sign in to comment.