Skip to content

Commit b74b165

Browse files
committed
Merge branch 'test-problem-reports-ios-439'
2 parents 6ddaf84 + 2abc5ed commit b74b165

10 files changed

+102
-10
lines changed

ios/Configurations/UITests.xcconfig.template

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ IOS_DEVICE_PIN_CODE =
77
TEST_DEVICE_IDENTIFIER_UUID =
88

99
// Mullvad accounts used by UI tests
10-
NO_TIME_ACCOUNT_NUMBER =
11-
HAS_TIME_ACCOUNT_NUMBER =
10+
NO_TIME_ACCOUNT_NUMBER[config=Debug] =
11+
NO_TIME_ACCOUNT_NUMBER[config=Staging] =
12+
HAS_TIME_ACCOUNT_NUMBER[config=Debug] =
13+
HAS_TIME_ACCOUNT_NUMBER[config=Staging] =
1214
FIVE_WIREGUARD_KEYS_ACCOUNT_NUMBER =
1315

1416
// Ad serving domain used when testing ad blocking. Note that we are assuming there's an HTTP server running on the host.

ios/MullvadVPN.xcodeproj/project.pbxproj

+32-1
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@
602602
852969362B4E9724007EAD4C /* AccessbilityIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0B311D2B303A0D004B12E0 /* AccessbilityIdentifier.swift */; };
603603
8529693A2B4F0238007EAD4C /* TermsOfServicePage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 852969392B4F0238007EAD4C /* TermsOfServicePage.swift */; };
604604
8529693C2B4F0257007EAD4C /* Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8529693B2B4F0257007EAD4C /* Alert.swift */; };
605+
8532E6872B8CCED600ACECD1 /* ProblemReportSubmittedPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8532E6862B8CCED600ACECD1 /* ProblemReportSubmittedPage.swift */; };
605606
85557B0E2B591B2600795FE1 /* FirewallAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85557B0D2B591B2600795FE1 /* FirewallAPIClient.swift */; };
606607
85557B102B59215F00795FE1 /* FirewallRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85557B0F2B59215F00795FE1 /* FirewallRule.swift */; };
607608
85557B122B594FC900795FE1 /* ConnectivityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85557B112B594FC900795FE1 /* ConnectivityTests.swift */; };
@@ -612,6 +613,7 @@
612613
855D9F5B2B63E56B00D7C64D /* ProblemReportPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 855D9F5A2B63E56B00D7C64D /* ProblemReportPage.swift */; };
613614
8590896C2B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 859089682B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift */; };
614615
8590896F2B61763B003AF5F5 /* LoggedOutUITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8590896B2B61763B003AF5F5 /* LoggedOutUITestCase.swift */; };
616+
85C7A2E92B89024B00035D5A /* SettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C7A2E82B89024B00035D5A /* SettingsTests.swift */; };
615617
85D2B0B12B6BD32400DF9DA7 /* BaseUITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8590896A2B61763B003AF5F5 /* BaseUITestCase.swift */; };
616618
85E3BDE52B70E18C00FA71FD /* Networking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85E3BDE42B70E18C00FA71FD /* Networking.swift */; };
617619
A900E9B82ACC5C2B00C95F67 /* AccountsProxy+Stubs.swift in Sources */ = {isa = PBXBuildFile; fileRef = A900E9B72ACC5C2B00C95F67 /* AccountsProxy+Stubs.swift */; };
@@ -1825,6 +1827,7 @@
18251827
852969382B4ED818007EAD4C /* UITests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = UITests.xcconfig; sourceTree = "<group>"; };
18261828
852969392B4F0238007EAD4C /* TermsOfServicePage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfServicePage.swift; sourceTree = "<group>"; };
18271829
8529693B2B4F0257007EAD4C /* Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Alert.swift; sourceTree = "<group>"; };
1830+
8532E6862B8CCED600ACECD1 /* ProblemReportSubmittedPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProblemReportSubmittedPage.swift; sourceTree = "<group>"; };
18281831
85557B0D2B591B2600795FE1 /* FirewallAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirewallAPIClient.swift; sourceTree = "<group>"; };
18291832
85557B0F2B59215F00795FE1 /* FirewallRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirewallRule.swift; sourceTree = "<group>"; };
18301833
85557B112B594FC900795FE1 /* ConnectivityTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectivityTests.swift; sourceTree = "<group>"; };
@@ -1837,6 +1840,7 @@
18371840
859089692B61763B003AF5F5 /* LoggedInWithTimeUITestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoggedInWithTimeUITestCase.swift; sourceTree = "<group>"; };
18381841
8590896A2B61763B003AF5F5 /* BaseUITestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseUITestCase.swift; sourceTree = "<group>"; };
18391842
8590896B2B61763B003AF5F5 /* LoggedOutUITestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoggedOutUITestCase.swift; sourceTree = "<group>"; };
1843+
85C7A2E82B89024B00035D5A /* SettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTests.swift; sourceTree = "<group>"; };
18401844
85E3BDE42B70E18C00FA71FD /* Networking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Networking.swift; sourceTree = "<group>"; };
18411845
A900E9B72ACC5C2B00C95F67 /* AccountsProxy+Stubs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AccountsProxy+Stubs.swift"; sourceTree = "<group>"; };
18421846
A900E9B92ACC5D0600C95F67 /* RESTRequestExecutor+Stubs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RESTRequestExecutor+Stubs.swift"; sourceTree = "<group>"; };
@@ -3513,6 +3517,7 @@
35133517
850201DA2B503D7700EF8C96 /* RelayTests.swift */,
35143518
8518F6392B601910009EB113 /* Test base classes */,
35153519
85557B152B5ABBBE00795FE1 /* XCUIElementQuery+Extensions.swift */,
3520+
85C7A2E82B89024B00035D5A /* SettingsTests.swift */,
35163521
);
35173522
path = MullvadVPNUITests;
35183523
sourceTree = "<group>";
@@ -3526,6 +3531,7 @@
35263531
852969342B4E9270007EAD4C /* LoginPage.swift */,
35273532
852969322B4E9232007EAD4C /* Page.swift */,
35283533
855D9F5A2B63E56B00D7C64D /* ProblemReportPage.swift */,
3534+
8532E6862B8CCED600ACECD1 /* ProblemReportSubmittedPage.swift */,
35293535
850201DC2B503D8C00EF8C96 /* SelectLocationPage.swift */,
35303536
850201E22B51A93C00EF8C96 /* SettingsPage.swift */,
35313537
852969392B4F0238007EAD4C /* TermsOfServicePage.swift */,
@@ -5480,6 +5486,7 @@
54805486
85557B142B5983CF00795FE1 /* MullvadAPIWrapper.swift in Sources */,
54815487
852969362B4E9724007EAD4C /* AccessbilityIdentifier.swift in Sources */,
54825488
85E3BDE52B70E18C00FA71FD /* Networking.swift in Sources */,
5489+
85C7A2E92B89024B00035D5A /* SettingsTests.swift in Sources */,
54835490
8590896C2B61763B003AF5F5 /* LoggedInWithoutTimeUITestCase.swift in Sources */,
54845491
8590896F2B61763B003AF5F5 /* LoggedOutUITestCase.swift in Sources */,
54855492
85557B202B5FBBD700795FE1 /* AccountPage.swift in Sources */,
@@ -5491,6 +5498,7 @@
54915498
85557B162B5ABBBE00795FE1 /* XCUIElementQuery+Extensions.swift in Sources */,
54925499
855D9F5B2B63E56B00D7C64D /* ProblemReportPage.swift in Sources */,
54935500
8529693A2B4F0238007EAD4C /* TermsOfServicePage.swift in Sources */,
5501+
8532E6872B8CCED600ACECD1 /* ProblemReportSubmittedPage.swift in Sources */,
54945502
850201DF2B5040A500EF8C96 /* TunnelControlPage.swift in Sources */,
54955503
85557B1E2B5FB8C700795FE1 /* HeaderBar.swift in Sources */,
54965504
85557B122B594FC900795FE1 /* ConnectivityTests.swift in Sources */,
@@ -6861,7 +6869,7 @@
68616869
PROVISIONING_PROFILE_SPECIFIER = "";
68626870
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "MullvadVPN app integration tests";
68636871
SECURITY_GROUP_IDENTIFIER = group.net.mullvad.MullvadVPN;
6864-
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
6872+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG MULLVAD_ENVIRONMENT_PRODUCTION $(inherited)";
68656873
SWIFT_EMIT_LOC_STRINGS = NO;
68666874
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/MullvadVPNUITests/BridgingHeader.h";
68676875
SWIFT_VERSION = 5.0;
@@ -6872,9 +6880,12 @@
68726880
};
68736881
8529692E2B4D9C1F007EAD4C /* Release */ = {
68746882
isa = XCBuildConfiguration;
6883+
baseConfigurationReference = 852969382B4ED818007EAD4C /* UITests.xcconfig */;
68756884
buildSettings = {
68766885
APPLICATION_IDENTIFIER = net.mullvad.MullvadVPN;
68776886
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
6887+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
6888+
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CKG9MXH72F;
68786889
ENABLE_USER_SCRIPT_SANDBOXING = NO;
68796890
GCC_C_LANGUAGE_STANDARD = gnu17;
68806891
GENERATE_INFOPLIST_FILE = YES;
@@ -6888,6 +6899,7 @@
68886899
MARKETING_VERSION = 1.0;
68896900
PRODUCT_BUNDLE_IDENTIFIER = "$(APPLICATION_IDENTIFIER).MullvadVPNUITests";
68906901
PRODUCT_NAME = "$(TARGET_NAME)";
6902+
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "MullvadVPN app integration tests";
68916903
SECURITY_GROUP_IDENTIFIER = group.net.mullvad.MullvadVPN;
68926904
SWIFT_EMIT_LOC_STRINGS = NO;
68936905
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/MullvadVPNUITests/BridgingHeader.h";
@@ -7472,25 +7484,44 @@
74727484
};
74737485
A93A1D062B59145C00F7796C /* Staging */ = {
74747486
isa = XCBuildConfiguration;
7487+
baseConfigurationReference = 852969382B4ED818007EAD4C /* UITests.xcconfig */;
74757488
buildSettings = {
7489+
APPLICATION_IDENTIFIER = net.mullvad.MullvadVPN;
7490+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
7491+
CODE_SIGN_STYLE = Manual;
7492+
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CKG9MXH72F;
7493+
"DEVELOPMENT_TEAM[sdk=macosx*]" = CKG9MXH72F;
7494+
GENERATE_INFOPLIST_FILE = YES;
74767495
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../mullvad-api/include";
7496+
INFOPLIST_FILE = MullvadVPNUITests/Info.plist;
74777497
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*][arch=arm64]" = "$(PROJECT_DIR)/../target/aarch64-apple-ios/debug";
74787498
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=arm64]" = "$(PROJECT_DIR)/../target/aarch64-apple-ios-sim/debug";
74797499
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=x86_64]" = "$(PROJECT_DIR)/../target/x86_64-apple-ios/debug";
7500+
PRODUCT_BUNDLE_IDENTIFIER = "$(APPLICATION_IDENTIFIER).MullvadVPNUITests";
74807501
PRODUCT_NAME = MullvadVPNUITests;
7502+
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "MullvadVPN app integration tests";
7503+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG MULLVAD_ENVIRONMENT_STAGING";
74817504
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/MullvadVPNUITests/BridgingHeader.h";
7505+
SWIFT_VERSION = 5.0;
7506+
TEST_TARGET_NAME = MullvadVPN;
74827507
};
74837508
name = Staging;
74847509
};
74857510
A93A1D072B59145C00F7796C /* MockRelease */ = {
74867511
isa = XCBuildConfiguration;
7512+
baseConfigurationReference = 852969382B4ED818007EAD4C /* UITests.xcconfig */;
74877513
buildSettings = {
7514+
APPLICATION_IDENTIFIER = net.mullvad.MullvadVPN;
74887515
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../mullvad-api/include";
7516+
INFOPLIST_FILE = MullvadVPNUITests/Info.plist;
74897517
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*][arch=arm64]" = "$(PROJECT_DIR)/../target/aarch64-apple-ios/release";
74907518
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=arm64]" = "$(PROJECT_DIR)/../target/aarch64-apple-ios-sim/release";
74917519
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=x86_64]" = "$(PROJECT_DIR)/../target/x86_64-apple-ios/release";
74927520
PRODUCT_NAME = MullvadVPNUITests;
7521+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = MULLVAD_ENVIRONMENT_PRODUCTION;
74937522
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/MullvadVPNUITests/BridgingHeader.h";
7523+
SWIFT_VERSION = 5.0;
7524+
TEST_TARGET_NAME = MullvadVPN;
74947525
};
74957526
name = MockRelease;
74967527
};

ios/MullvadVPN/Classes/AccessbilityIdentifier.swift

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public enum AccessibilityIdentifier: String {
6060
case settingsTableView
6161
case tunnelControlView
6262
case problemReportView
63+
case problemReportSubmittedView
6364

6465
// Other UI elements
6566
case connectionPanelInAddressRow

ios/MullvadVPN/View controllers/ProblemReport/ProblemReportSubmissionOverlayView.swift

+2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ class ProblemReportSubmissionOverlayView: UIView {
174174
override init(frame: CGRect) {
175175
super.init(frame: frame)
176176

177+
accessibilityIdentifier = AccessibilityIdentifier.problemReportSubmittedView
178+
177179
addSubviews()
178180
transitionToState(state)
179181

ios/MullvadVPN/View controllers/ProblemReport/ProblemReportViewController+ViewManagement.swift

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ extension ProblemReportViewController {
9696

9797
func makeSendButton() -> AppButton {
9898
let button = AppButton(style: .success)
99+
button.accessibilityIdentifier = AccessibilityIdentifier.problemReportSendButton
99100
button.translatesAutoresizingMaskIntoConstraints = false
100101
button.setTitle(Self.persistentViewModel.sendLogsButtonTitle, for: .normal)
101102
button.addTarget(self, action: #selector(handleSendButtonTap), for: .touchUpInside)

ios/MullvadVPNUITests/AccountTests.swift

-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
import XCTest
1010

1111
class AccountTests: LoggedOutUITestCase {
12-
override func setUpWithError() throws {
13-
continueAfterFailure = false
14-
15-
try super.setUpWithError()
16-
}
17-
1812
func testLogin() throws {
1913
LoginPage(app)
2014
.tapAccountNumberTextField()

ios/MullvadVPNUITests/Pages/ProblemReportPage.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ProblemReportPage: Page {
4040
}
4141

4242
@discardableResult func tapSendButton() -> Self {
43-
app.otherElements[AccessibilityIdentifier.problemReportSendButton]
43+
app.buttons[AccessibilityIdentifier.problemReportSendButton]
4444
.tap()
4545

4646
return self
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// ProblemReportSubmittedPage.swift
3+
// MullvadVPNUITests
4+
//
5+
// Created by Niklas Berglund on 2024-02-26.
6+
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import XCTest
11+
12+
class ProblemReportSubmittedPage: Page {
13+
@discardableResult override init(_ app: XCUIApplication) {
14+
super.init(app)
15+
16+
pageAccessibilityIdentifier = .problemReportSubmittedView
17+
waitForPageToBeShown()
18+
}
19+
}
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// SettingsTests.swift
3+
// MullvadVPNUITests
4+
//
5+
// Created by Niklas Berglund on 2024-02-23.
6+
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import XCTest
11+
12+
class SettingsTests: LoggedOutUITestCase {
13+
func testSendProblemReport() throws {
14+
#if MULLVAD_ENVIRONMENT_STAGING
15+
let shouldSkipTest = false
16+
#else
17+
let shouldSkipTest = true
18+
#endif
19+
20+
try XCTSkipIf(shouldSkipTest, "This test should only run in the staging environment")
21+
22+
HeaderBar(app)
23+
.tapSettingsButton()
24+
25+
SettingsPage(app)
26+
.tapReportAProblemCell()
27+
28+
ProblemReportPage(app)
29+
.tapEmailTextField()
30+
.enterText("cookie@mullvad.net")
31+
.tapMessageTextView()
32+
.enterText("""
33+
Dear support
34+
This is a problem report from an iOS app test.
35+
""")
36+
.tapKeyboardDoneButton()
37+
.tapSendButton()
38+
39+
ProblemReportSubmittedPage(app)
40+
}
41+
}

ios/MullvadVPNUITests/Test base classes/BaseUITestCase.swift

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class BaseUITestCase: XCTestCase {
5050

5151
/// Test level setup
5252
override func setUp() {
53+
continueAfterFailure = false
5354
app.launch()
5455
}
5556

0 commit comments

Comments
 (0)