summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOliver <oliver@mohlin.dev>2025-09-11 07:58:50 +0200
committerTobias Järvelöv <tobias.jarvelov@mullvad.net>2025-09-22 12:35:44 +0200
commitee7b617a4a1253322d47e63b6b6fc95de959e7c7 (patch)
treeb95067705abea5d6b101faae0264be55a7c92d7a
parent9e3bed3c3f101f4f04671ecd8c5141d57817528d (diff)
downloadmullvadvpn-ee7b617a4a1253322d47e63b6b6fc95de959e7c7.tar.xz
mullvadvpn-ee7b617a4a1253322d47e63b6b6fc95de959e7c7.zip
Move feature indicators tests into describe block
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/mocked/feature-indicators/feature-indicators.spec.ts156
1 files changed, 81 insertions, 75 deletions
diff --git a/desktop/packages/mullvad-vpn/test/e2e/mocked/feature-indicators/feature-indicators.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/mocked/feature-indicators/feature-indicators.spec.ts
index cb7bfc82dd..9043fedff5 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/mocked/feature-indicators/feature-indicators.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/mocked/feature-indicators/feature-indicators.spec.ts
@@ -31,97 +31,103 @@ const mockConnectedLocation: ILocation = { ...mockDisconnectedLocation, mullvadE
let page: Page;
let util: MockedTestUtils;
-test.beforeAll(async () => {
- ({ page, util } = await startMockedApp());
- await util.waitForRoute(RoutePath.main);
-});
-
-test.afterAll(async () => {
- await page.close();
-});
+test.describe('Feature indicators', () => {
+ test.beforeAll(async () => {
+ ({ page, util } = await startMockedApp());
+ await util.waitForRoute(RoutePath.main);
+ });
-test('App should show no feature indicators', async () => {
- await util.ipc.tunnel[''].notify({
- state: 'connected',
- details: { endpoint, location: mockConnectedLocation },
- featureIndicators: undefined,
+ test.afterAll(async () => {
+ await page.close();
});
- await expectConnected(page);
- await expectFeatureIndicators(page, []);
+ test('App should show no feature indicators', async () => {
+ await util.ipc.tunnel[''].notify({
+ state: 'connected',
+ details: { endpoint, location: mockConnectedLocation },
+ featureIndicators: undefined,
+ });
- const ellipsis = page.getByText(/^\d more.../);
- await expect(ellipsis).not.toBeVisible();
+ await expectConnected(page);
+ await expectFeatureIndicators(page, []);
- await page.getByTestId('connection-panel-chevron').click();
- await expect(ellipsis).not.toBeVisible();
+ const ellipsis = page.getByText(/^\d more.../);
+ await expect(ellipsis).not.toBeVisible();
- await expectFeatureIndicators(page, []);
- await page.getByTestId('connection-panel-chevron').click();
-});
+ await page.getByTestId('connection-panel-chevron').click();
+ await expect(ellipsis).not.toBeVisible();
-test('App should show feature indicators', async () => {
- await util.ipc.tunnel[''].notify({
- state: 'connected',
- details: { endpoint, location: mockConnectedLocation },
- featureIndicators: [
- FeatureIndicator.daita,
- FeatureIndicator.udp2tcp,
- FeatureIndicator.customMssFix,
- FeatureIndicator.customMtu,
- FeatureIndicator.lanSharing,
- FeatureIndicator.serverIpOverride,
- FeatureIndicator.customDns,
- FeatureIndicator.lockdownMode,
- FeatureIndicator.quantumResistance,
- FeatureIndicator.multihop,
- ],
+ await expectFeatureIndicators(page, []);
+ await page.getByTestId('connection-panel-chevron').click();
});
- // Make sure panel is collapsed before checking indicator visibility.
- const ellipsis = page.getByText(/^\d more.../);
- await expect(ellipsis).toBeVisible();
+ test('App should show feature indicators', async () => {
+ await util.ipc.tunnel[''].notify({
+ state: 'connected',
+ details: { endpoint, location: mockConnectedLocation },
+ featureIndicators: [
+ FeatureIndicator.daita,
+ FeatureIndicator.udp2tcp,
+ FeatureIndicator.customMssFix,
+ FeatureIndicator.customMtu,
+ FeatureIndicator.lanSharing,
+ FeatureIndicator.serverIpOverride,
+ FeatureIndicator.customDns,
+ FeatureIndicator.lockdownMode,
+ FeatureIndicator.quantumResistance,
+ FeatureIndicator.multihop,
+ ],
+ });
- await expectConnected(page);
- await expectFeatureIndicators(page, ['DAITA', 'Quantum resistance'], false);
- await expectHiddenFeatureIndicator(page, 'Mssfix');
+ // Make sure panel is collapsed before checking indicator visibility.
+ const ellipsis = page.getByText(/^\d more.../);
+ await expect(ellipsis).toBeVisible();
- await page.getByTestId('connection-panel-chevron').click();
- await expect(ellipsis).not.toBeVisible();
+ await expectConnected(page);
+ await expectFeatureIndicators(page, ['DAITA', 'Quantum resistance'], false);
+ await expectHiddenFeatureIndicator(page, 'Mssfix');
- await expectFeatureIndicators(page, [
- 'DAITA',
- 'Quantum resistance',
- 'Mssfix',
- 'MTU',
- 'Obfuscation',
- 'Local network sharing',
- 'Lockdown mode',
- 'Multihop',
- 'Custom DNS',
- 'Server IP override',
- ]);
-});
+ await page.getByTestId('connection-panel-chevron').click();
+ await expect(ellipsis).not.toBeVisible();
-async function expectHiddenFeatureIndicator(page: Page, hiddenIndicator: string) {
- const indicators = page.getByTestId('feature-indicator');
- const indicator = indicators.getByText(hiddenIndicator, { exact: true });
+ await expectFeatureIndicators(page, [
+ 'DAITA',
+ 'Quantum resistance',
+ 'Mssfix',
+ 'MTU',
+ 'Obfuscation',
+ 'Local network sharing',
+ 'Lockdown mode',
+ 'Multihop',
+ 'Custom DNS',
+ 'Server IP override',
+ ]);
+ });
- // Make sure at least one is visible to not run the "not visible" check before they become
- // visible.
- await expect(indicators.first()).toBeVisible();
+ async function expectHiddenFeatureIndicator(page: Page, hiddenIndicator: string) {
+ const indicators = page.getByTestId('feature-indicator');
+ const indicator = indicators.getByText(hiddenIndicator, { exact: true });
- await expect(indicator).toHaveCount(1);
- await expect(indicator).not.toBeVisible();
-}
+ // Make sure at least one is visible to not run the "not visible" check before they become
+ // visible.
+ await expect(indicators.first()).toBeVisible();
-async function expectFeatureIndicators(page: Page, expectedIndicators: Array<string>, only = true) {
- const indicators = page.getByTestId('feature-indicator');
- if (only) {
- await expect(indicators).toHaveCount(expectedIndicators.length);
+ await expect(indicator).toHaveCount(1);
+ await expect(indicator).not.toBeVisible();
}
- for (const indicator of expectedIndicators) {
- await expect(indicators.getByText(indicator, { exact: true })).toBeVisible();
+ async function expectFeatureIndicators(
+ page: Page,
+ expectedIndicators: Array<string>,
+ only = true,
+ ) {
+ const indicators = page.getByTestId('feature-indicator');
+ if (only) {
+ await expect(indicators).toHaveCount(expectedIndicators.length);
+ }
+
+ for (const indicator of expectedIndicators) {
+ await expect(indicators.getByText(indicator, { exact: true })).toBeVisible();
+ }
}
-}
+});