diff --git a/ios/Configurations/UITests.xcconfig.template b/ios/Configurations/UITests.xcconfig.template index c2a0fe821b9e..e39224eedfe0 100644 --- a/ios/Configurations/UITests.xcconfig.template +++ b/ios/Configurations/UITests.xcconfig.template @@ -7,8 +7,6 @@ IOS_DEVICE_PIN_CODE = TEST_DEVICE_IDENTIFIER_UUID = // Mullvad accounts used by UI tests -NO_TIME_ACCOUNT_NUMBER[config=Debug] = -NO_TIME_ACCOUNT_NUMBER[config=Staging] = HAS_TIME_ACCOUNT_NUMBER[config=Debug] = HAS_TIME_ACCOUNT_NUMBER[config=Staging] = FIVE_WIREGUARD_KEYS_ACCOUNT_NUMBER = diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index 7879654647b1..8c30ea0abd64 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -637,7 +637,6 @@ 8556EB562B9B0AC500D26DD4 /* RevokedDevicePage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8556EB552B9B0AC500D26DD4 /* RevokedDevicePage.swift */; }; 855D9F5B2B63E56B00D7C64D /* ProblemReportPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 855D9F5A2B63E56B00D7C64D /* ProblemReportPage.swift */; }; 8587A05D2B84D43100152938 /* ChangeLogAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8587A05C2B84D43100152938 /* ChangeLogAlert.swift */; }; - 8590896C2B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 859089682B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift */; }; 8590896F2B61763B003AF5F5 /* LoggedOutUITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8590896B2B61763B003AF5F5 /* LoggedOutUITestCase.swift */; }; 85A42B862BB1D627007BABF7 /* XCUIElement+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A42B852BB1D627007BABF7 /* XCUIElement+Extensions.swift */; }; 85B267612B849ADB0098E3CD /* mullvad-api.h in Headers */ = {isa = PBXBuildFile; fileRef = 85B267602B849ADB0098E3CD /* mullvad-api.h */; }; @@ -1896,7 +1895,6 @@ 8556EB552B9B0AC500D26DD4 /* RevokedDevicePage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RevokedDevicePage.swift; sourceTree = ""; }; 855D9F5A2B63E56B00D7C64D /* ProblemReportPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProblemReportPage.swift; sourceTree = ""; }; 8587A05C2B84D43100152938 /* ChangeLogAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeLogAlert.swift; sourceTree = ""; }; - 859089682B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoggedInWithoutTimeUITestCase.swift; sourceTree = ""; }; 859089692B61763B003AF5F5 /* LoggedInWithTimeUITestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoggedInWithTimeUITestCase.swift; sourceTree = ""; }; 8590896A2B61763B003AF5F5 /* BaseUITestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseUITestCase.swift; sourceTree = ""; }; 8590896B2B61763B003AF5F5 /* LoggedOutUITestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoggedOutUITestCase.swift; sourceTree = ""; }; @@ -3603,7 +3601,6 @@ isa = PBXGroup; children = ( 8590896A2B61763B003AF5F5 /* BaseUITestCase.swift */, - 859089682B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift */, 859089692B61763B003AF5F5 /* LoggedInWithTimeUITestCase.swift */, 8590896B2B61763B003AF5F5 /* LoggedOutUITestCase.swift */, 8518F6372B60157E009EB113 /* LoggedInWithoutTimeUITestCase.swift */, @@ -5638,7 +5635,6 @@ 852969362B4E9724007EAD4C /* AccessbilityIdentifier.swift in Sources */, 85E3BDE52B70E18C00FA71FD /* Networking.swift in Sources */, 85C7A2E92B89024B00035D5A /* SettingsTests.swift in Sources */, - 8590896C2B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift in Sources */, 8590896F2B61763B003AF5F5 /* LoggedOutUITestCase.swift in Sources */, 85557B202B5FBBD700795FE1 /* AccountPage.swift in Sources */, 852969352B4E9270007EAD4C /* LoginPage.swift in Sources */, diff --git a/ios/MullvadVPNUITests/AccountTests.swift b/ios/MullvadVPNUITests/AccountTests.swift index f78235360154..c2047881e73b 100644 --- a/ios/MullvadVPNUITests/AccountTests.swift +++ b/ios/MullvadVPNUITests/AccountTests.swift @@ -58,7 +58,7 @@ class AccountTests: LoggedOutUITestCase { func testLogin() throws { LoginPage(app) .tapAccountNumberTextField() - .enterText(self.noTimeAccountNumber) + .enterText(self.hasTimeAccountNumber) .tapAccountNumberSubmitButton() .verifySuccessIconShown() .verifyDeviceLabelShown() diff --git a/ios/MullvadVPNUITests/RelayTests.swift b/ios/MullvadVPNUITests/RelayTests.swift index d0f8ea20375a..ae6d1ebf785a 100644 --- a/ios/MullvadVPNUITests/RelayTests.swift +++ b/ios/MullvadVPNUITests/RelayTests.swift @@ -27,6 +27,22 @@ class RelayTests: LoggedInWithTimeUITestCase { } func testAdBlockingViaDNS() throws { + // Undo enabling block ads in teardown + addTeardownBlock { + HeaderBar(self.app) + .tapSettingsButton() + + SettingsPage(self.app) + .tapVPNSettingsCell() + + VPNSettingsPage(self.app) + .tapDNSSettingsCell() + + DNSSettingsPage(self.app) + .tapDNSContentBlockersHeaderExpandButton() + .tapBlockAdsSwitch() + } + HeaderBar(app) .tapSettingsButton() @@ -44,7 +60,7 @@ class RelayTests: LoggedInWithTimeUITestCase { TunnelControlPage(app) .tapSecureConnectionButton() - allowAddVPNConfigurations() // Allow adding VPN configurations iOS permission + allowAddVPNConfigurationsIfAsked() // Allow adding VPN configurations iOS permission TunnelControlPage(app) .waitForSecureConnectionLabel() @@ -77,6 +93,18 @@ class RelayTests: LoggedInWithTimeUITestCase { } func testWireGuardOverTCPManually() throws { + addTeardownBlock({ + HeaderBar(self.app) + .tapSettingsButton() + + SettingsPage(self.app) + .tapVPNSettingsCell() + + VPNSettingsPage(self.app) + .tapWireGuardObfuscationExpandButton() + .tapWireGuardObfuscationOffCell() + }) + HeaderBar(app) .tapSettingsButton() @@ -155,6 +183,7 @@ class RelayTests: LoggedInWithTimeUITestCase { .enterText("4001") .dismissKeyboard() .swipeDownToDismissModal() + .swipeDownToDismissModal() // After editing text field the table is first responder for the first swipe so we need to swipe twice to swipe the modal TunnelControlPage(app) .tapSecureConnectionButton() @@ -205,7 +234,7 @@ class RelayTests: LoggedInWithTimeUITestCase { TunnelControlPage(app) .tapSecureConnectionButton() - allowAddVPNConfigurations() + allowAddVPNConfigurationsIfAsked() HeaderBar(app) .tapSettingsButton() diff --git a/ios/MullvadVPNUITests/Test base classes/BaseUITestCase.swift b/ios/MullvadVPNUITests/Test base classes/BaseUITestCase.swift index 11b0cf6ee5f0..bfaa60a145ab 100644 --- a/ios/MullvadVPNUITests/Test base classes/BaseUITestCase.swift +++ b/ios/MullvadVPNUITests/Test base classes/BaseUITestCase.swift @@ -17,8 +17,6 @@ class BaseUITestCase: XCTestCase { // swiftlint:disable force_cast let displayName = Bundle(for: BaseUITestCase.self) .infoDictionary?["DisplayName"] as! String - let noTimeAccountNumber = Bundle(for: BaseUITestCase.self) - .infoDictionary?["NoTimeAccountNumber"] as! String let hasTimeAccountNumber = Bundle(for: BaseUITestCase.self) .infoDictionary?["HasTimeAccountNumber"] as! String let fiveWireGuardKeysAccountNumber = Bundle(for: BaseUITestCase.self) diff --git a/ios/MullvadVPNUITests/Test base classes/LoggedInWithoutTimeUITestCase.swift b/ios/MullvadVPNUITests/Test base classes/LoggedInWithoutTimeUITestCase.swift deleted file mode 100644 index 8c40c4e76abe..000000000000 --- a/ios/MullvadVPNUITests/Test base classes/LoggedInWithoutTimeUITestCase.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// LoggedInWithoutTimeUITestCase.swift -// MullvadVPNUITests -// -// Created by Niklas Berglund on 2024-01-23. -// Copyright © 2024 Mullvad VPN AB. All rights reserved. -// - -import Foundation - -/// Base class for tests that should start from a state of being logged on to an account without time left -class LoggedInWithoutTimeUITestCase: BaseUITestCase { - override func setUp() { - super.setUp() - - agreeToTermsOfServiceIfShown() - dismissChangeLogIfShown() - logoutIfLoggedIn() - - login(accountNumber: noTimeAccountNumber) - - // Relaunch app so that tests start from a deterministic state - app.terminate() - app.launch() - } -}