diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-10-07 11:29:31 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-10-18 12:04:19 +0200 |
| commit | 227098cec09eecd09427bca8f838fa828b6cabf2 (patch) | |
| tree | 85ff3d7da16a369e44f0407e48e041fd1132aa64 /gui | |
| parent | 660b55b00121e2412a2fcc61f94088317525a8e1 (diff) | |
| download | mullvadvpn-227098cec09eecd09427bca8f838fa828b6cabf2.tar.xz mullvadvpn-227098cec09eecd09427bca8f838fa828b6cabf2.zip | |
Use 'os.homedir' instead of HOME environment variable
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/test/e2e/installed/state-dependent/settings.spec.ts | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gui/test/e2e/installed/state-dependent/settings.spec.ts b/gui/test/e2e/installed/state-dependent/settings.spec.ts index e3cd634b7c..4575594803 100644 --- a/gui/test/e2e/installed/state-dependent/settings.spec.ts +++ b/gui/test/e2e/installed/state-dependent/settings.spec.ts @@ -1,14 +1,17 @@ import path from 'path'; +import os from 'os'; import { execSync } from 'child_process'; import { expect, Page, test } from '@playwright/test'; import { startInstalledApp } from '../installed-utils'; import { fileExists, TestUtils } from '../../utils'; -if (process.env.HOME === undefined) { - throw new Error('$HOME not set'); +function getAutoStartPath() { + return path.join(os.homedir(), '.config', 'autostart', 'mullvad-vpn.desktop'); } -const AUTOSTART_PATH = path.join(process.env.HOME, '.config', 'autostart', 'mullvad-vpn.desktop'); +function autoStartPathExists() { + return fileExists(getAutoStartPath()); +} let page: Page; let util: TestUtils; @@ -53,14 +56,18 @@ test.describe('VPN Settings', () => { const initialCliState = execSync('mullvad auto-connect get').toString().trim(); expect(initialCliState).toMatch(/off$/); await expect(launchOnStartupToggle).toHaveAttribute('aria-checked', 'false') - expect(fileExists(AUTOSTART_PATH)).toBeFalsy(); + if (process.platform === 'linux') { + expect(autoStartPathExists()).toBeFalsy(); + } // Toggle launch on start-up await launchOnStartupToggle.click(); // Verify the setting was applied correctly await expect(launchOnStartupToggle).toHaveAttribute('aria-checked', 'true') - expect(fileExists(AUTOSTART_PATH)).toBeTruthy(); + if (process.platform === 'linux') { + expect(autoStartPathExists()).toBeTruthy(); + } const newCliState = execSync('mullvad auto-connect get').toString().trim(); expect(newCliState).toMatch(/on$/); |
