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: {
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',
cwd: '..',
reuseExistingServer: !process.env.CI,

View File

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

View File

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

View File

@@ -1,17 +1,8 @@
import { chromium, FullConfig } from '@playwright/test';
import { existsSync, renameSync } from 'fs';
import { chromium, type FullConfig } from '@playwright/test';
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) {
// Backup existing config file if it exists
if (existsSync(CONFIG_FILE)) {
renameSync(CONFIG_FILE, TEMP_CONFIG_FILE);
}
const browser = await chromium.launch({
slowMo: 100,
});

View File

@@ -1,16 +1,12 @@
import { existsSync, renameSync, unlinkSync } from 'fs';
import { CONFIG_FILE, TEMP_CONFIG_FILE } from './globalSetup';
import { existsSync, unlinkSync } from 'fs';
export const CONFIG_FILE = '/tmp/AdGuard.temp.e2e.yaml';
async function globalTeardown() {
// Remove the test config file
if (existsSync(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;