summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOliver <oliver@mohlin.dev>2025-07-22 15:03:35 +0200
committerDavid Lönnhager <david.l@mullvad.net>2025-07-23 09:41:54 +0200
commitc3fe098f19452c9f0dae39b33459010d3d4d4779 (patch)
tree21f558cdc7121fa41fb304612bede3ba72ba4955
parent9733457e8abb9c2433fc8199bfe188ab8d86f428 (diff)
downloadmullvadvpn-c3fe098f19452c9f0dae39b33459010d3d4d4779.tar.xz
mullvadvpn-c3fe098f19452c9f0dae39b33459010d3d4d4779.zip
Move tests where filter is applied from filter view to separate block
-rw-r--r--desktop/packages/mullvad-vpn/test/e2e/mocked/select-location/select-location.spec.ts142
1 files changed, 72 insertions, 70 deletions
diff --git a/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location/select-location.spec.ts b/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location/select-location.spec.ts
index 4065f08b74..3f4e00af03 100644
--- a/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location/select-location.spec.ts
+++ b/desktop/packages/mullvad-vpn/test/e2e/mocked/select-location/select-location.spec.ts
@@ -121,100 +121,102 @@ test.describe('Select location', () => {
});
test.describe('Filter', () => {
- test.beforeEach(async () => {
- await helpers.resetView();
- await helpers.resetProviders();
- await helpers.resetOwnership();
- });
+ test.describe('Applied from filter view', () => {
+ test.beforeEach(async () => {
+ await helpers.resetView();
+ await helpers.resetProviders();
+ await helpers.resetOwnership();
+ });
- test.describe('Filter by provider', () => {
- test('Should deselect all providers when clicking all providers checkbox', async () => {
- await routes.filter.expandProviders();
- await routes.filter.checkAllProvidersCheckbox();
- expect(await helpers.areAllCheckboxesChecked()).toBe(false);
+ test.describe('Filter by provider', () => {
+ test('Should deselect all providers when clicking all providers checkbox', async () => {
+ await routes.filter.expandProviders();
+ await routes.filter.checkAllProvidersCheckbox();
+ expect(await helpers.areAllCheckboxesChecked()).toBe(false);
- await routes.filter.checkAllProvidersCheckbox();
- expect(await helpers.areAllCheckboxesChecked()).toBe(true);
- });
+ await routes.filter.checkAllProvidersCheckbox();
+ expect(await helpers.areAllCheckboxesChecked()).toBe(true);
+ });
- test('Should apply filter when selecting provider', async () => {
- await routes.filter.expandProviders();
- await routes.filter.checkAllProvidersCheckbox();
- expect(await helpers.areAllCheckboxesChecked()).toBe(false);
+ test('Should apply filter when selecting provider', async () => {
+ await routes.filter.expandProviders();
+ await routes.filter.checkAllProvidersCheckbox();
+ expect(await helpers.areAllCheckboxesChecked()).toBe(false);
- // Select one provider
- const provider = relayList.countries[0].cities[0].relays[0].provider;
- await routes.filter.checkProviderCheckbox(provider);
+ // Select one provider
+ const provider = relayList.countries[0].cities[0].relays[0].provider;
+ await routes.filter.checkProviderCheckbox(provider);
- await helpers.updateMockRelayFilter({
- providers: [provider],
- });
+ await helpers.updateMockRelayFilter({
+ providers: [provider],
+ });
- await routes.filter.applyFilter();
- await util.waitForRoute(RoutePath.selectLocation);
- const providerFilterChip = routes.selectLocation.getFilterChip('Providers: 1');
- await expect(providerFilterChip).toBeVisible();
+ await routes.filter.applyFilter();
+ await util.waitForRoute(RoutePath.selectLocation);
+ const providerFilterChip = routes.selectLocation.getFilterChip('Providers: 1');
+ await expect(providerFilterChip).toBeVisible();
- const locatedRelays = helpers.locateRelaysByProvider(relayList, provider);
- const relays = locatedRelays.map((locatedRelay) => locatedRelay.relay);
- const relayNames = relays.map((relay) => relay.hostname);
+ const locatedRelays = helpers.locateRelaysByProvider(relayList, provider);
+ const relays = locatedRelays.map((locatedRelay) => locatedRelay.relay);
+ const relayNames = relays.map((relay) => relay.hostname);
- // Expand all accordions
- await helpers.expandLocatedRelays(locatedRelays);
+ // Expand all accordions
+ await helpers.expandLocatedRelays(locatedRelays);
- const buttons = routes.selectLocation.getRelaysMatching(relayNames);
+ const buttons = routes.selectLocation.getRelaysMatching(relayNames);
- // Expect all filtered relays to have a button
- await expect(buttons).toHaveCount(relays.length);
+ // Expect all filtered relays to have a button
+ await expect(buttons).toHaveCount(relays.length);
- // Clear filter
- await providerFilterChip.click();
+ // Clear filter
+ await providerFilterChip.click();
- // Get all relays and expand accordions
- const allLocatedRelays = helpers.locateRelaysByProvider(relayList);
- await helpers.expandLocatedRelays(allLocatedRelays);
+ // Get all relays and expand accordions
+ const allLocatedRelays = helpers.locateRelaysByProvider(relayList);
+ await helpers.expandLocatedRelays(allLocatedRelays);
- // Should not have same length as all relays
- await expect(buttons).not.toHaveCount(allLocatedRelays.length);
+ // Should not have same length as all relays
+ await expect(buttons).not.toHaveCount(allLocatedRelays.length);
+ });
});
- });
- test.describe('Filter by ownership', () => {
- test('Should apply filter when selecting ownership', async () => {
- // Select rented only
- await routes.filter.expandOwnership();
- await routes.filter.selectOwnershipOption('Rented only');
- await helpers.updateMockRelayFilter({
- ownership: Ownership.rented,
- });
+ test.describe('Filter by ownership', () => {
+ test('Should apply filter when selecting ownership', async () => {
+ // Select rented only
+ await routes.filter.expandOwnership();
+ await routes.filter.selectOwnershipOption('Rented only');
+ await helpers.updateMockRelayFilter({
+ ownership: Ownership.rented,
+ });
- await routes.filter.applyFilter();
- await util.waitForRoute(RoutePath.selectLocation);
+ await routes.filter.applyFilter();
+ await util.waitForRoute(RoutePath.selectLocation);
- const ownerFilterChip = routes.selectLocation.getFilterChip('Rented');
- await expect(ownerFilterChip).toBeVisible();
+ const ownerFilterChip = routes.selectLocation.getFilterChip('Rented');
+ await expect(ownerFilterChip).toBeVisible();
- const locatedRelays = helpers.locateRelaysByOwner(relayList, false);
- const relays = locatedRelays.map((locatedRelay) => locatedRelay.relay);
- const relayNames = relays.map((relay) => relay.hostname);
+ const locatedRelays = helpers.locateRelaysByOwner(relayList, false);
+ const relays = locatedRelays.map((locatedRelay) => locatedRelay.relay);
+ const relayNames = relays.map((relay) => relay.hostname);
- // Expand all accordions
- await helpers.expandLocatedRelays(locatedRelays);
+ // Expand all accordions
+ await helpers.expandLocatedRelays(locatedRelays);
- const buttons = routes.selectLocation.getRelaysMatching(relayNames);
+ const buttons = routes.selectLocation.getRelaysMatching(relayNames);
- // Expect all filtered relays to have a button
- await expect(buttons).toHaveCount(relays.length);
+ // Expect all filtered relays to have a button
+ await expect(buttons).toHaveCount(relays.length);
- // Clear filter
- await ownerFilterChip.click();
+ // Clear filter
+ await ownerFilterChip.click();
- // Get all relays and expand accordions
- const allLocatedRelays = helpers.locateRelaysByOwner(relayList);
- await helpers.expandLocatedRelays(allLocatedRelays);
+ // Get all relays and expand accordions
+ const allLocatedRelays = helpers.locateRelaysByOwner(relayList);
+ await helpers.expandLocatedRelays(allLocatedRelays);
- // Should not have same length as all relays
- await expect(buttons).not.toHaveCount(allLocatedRelays.length);
+ // Should not have same length as all relays
+ await expect(buttons).not.toHaveCount(allLocatedRelays.length);
+ });
});
});
});