fix install config

This commit is contained in:
Ildar Kamalov
2025-02-18 17:31:04 +03:00
parent 0a3346d911
commit 58faa7c537
5 changed files with 9 additions and 21 deletions

View File

@@ -42,7 +42,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 /tmp/AdGuard.temp.e2e.yaml`,
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

@@ -50,8 +50,9 @@ export const checkConfig = (values: any) => async (dispatch: any) => {
try { try {
const check = await apiClient.checkConfig(values); const check = await apiClient.checkConfig(values);
dispatch(checkConfigSuccess({ dispatch(checkConfigSuccess({
...values, web: { ...values.web, ...check.web },
...check, dns: { ...values.dns, ...check.dns },
static_ip: check.static_ip,
})); }));
} catch (error) { } catch (error) {
dispatch(addErrorToast({ error })); dispatch(addErrorToast({ error }));

View File

@@ -231,7 +231,7 @@ export const Settings = ({ handleSubmit, handleFix, validateForm, config, interf
[handleStaticIp], [handleStaticIp],
); );
const onSubmit = (data: any) => { const onSubmit = (data: SettingsFormValues) => {
validateForm(data); validateForm(data);
handleSubmit(data); handleSubmit(data);
}; };

View File

@@ -1,17 +1,8 @@
import { chromium, FullConfig } from '@playwright/test'; import { chromium, type FullConfig } from '@playwright/test';
import { existsSync, renameSync } from 'fs';
import { ADMIN_USERNAME, ADMIN_PASSWORD, PORT } from '../constants'; import { ADMIN_USERNAME, ADMIN_PASSWORD, PORT } from '../constants';
export const CONFIG_FILE = 'AdGuardHome.yaml';
export const TEMP_CONFIG_FILE = 'AdGuardHome.yaml.temp';
async function globalSetup(config: FullConfig) { async function globalSetup(config: FullConfig) {
// Backup existing config file if it exists
if (existsSync(CONFIG_FILE)) {
renameSync(CONFIG_FILE, TEMP_CONFIG_FILE);
}
const browser = await chromium.launch({ const browser = await chromium.launch({
slowMo: 100, slowMo: 100,
}); });

View File

@@ -1,16 +1,12 @@
import { existsSync, renameSync, unlinkSync } from 'fs'; import { existsSync, unlinkSync } from 'fs';
import { CONFIG_FILE, TEMP_CONFIG_FILE } from './globalSetup';
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)) {
unlinkSync(CONFIG_FILE); unlinkSync(CONFIG_FILE);
} }
// Restore the original config file if it exists
if (existsSync(TEMP_CONFIG_FILE)) {
renameSync(TEMP_CONFIG_FILE, CONFIG_FILE);
}
} }
export default globalTeardown; export default globalTeardown;