Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ platform :ios do
lane :run_uitests do |options|
schemes = ["WireUITests"]
options[:testplan] = "UITests"

# default is "Configuration 1" (your base config with prerequisites)
config_name = options[:configuration] || "Configuration 1"
options[:testplan_configuration] = config_name

options[:number_of_retries] = 0 # no retries
begin
run_tests_frameworks(schemes, options)
Expand Down Expand Up @@ -292,15 +297,16 @@ platform :ios do
write_tests_info_to_summary("🤖 Testing schemas: #{schemas.join(', ')}")

testplan = options[:testplan] || "AllTests" # TODO: [WPB-17497] GermanLocaleTests are not run
testplan_config = options[:testplan_configuration]

is_nightly_build = options[:all] == true

schema_errors = {}

schemas.each do |scheme|
write_tests_info_to_summary("🤖 Testing scheme #{scheme} with plan #{testplan}")
write_tests_info_to_summary("🤖 Testing scheme #{scheme} with plan #{testplan} (config: #{testplan_config || 'default'})")
begin
test_plan(build, scheme, testplan)
test_plan(build, scheme, testplan, testplan_config)
schema_errors[scheme] = false
rescue => e
write_tests_info_to_summary("❌ Scheme: #{scheme} failed with errors: #{e.to_s}")
Expand Down Expand Up @@ -542,7 +548,7 @@ platform :ios do
end
end

def test_plan(build, scheme, testplan)
def test_plan(build, scheme, testplan, testplan_configuration = nil)
if ENV['IOS_SIM_ID'].nil?
create_simulator_if_needed
end
Expand All @@ -556,6 +562,8 @@ platform :ios do
run_tests(
step_name: "🧪 Running tests for scheme: #{scheme}",
testplan: testplan,
# Use only_test_configurations to select a specific configuration in the test plan
only_test_configurations: (testplan_configuration ? [testplan_configuration] : nil),
scheme: scheme,
skip_detect_devices: true,
configuration: "Debug",
Expand Down
53 changes: 53 additions & 0 deletions wire-ios/Tests/TestPlans/UITests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,59 @@
"name" : "WireUITests"
}
}
},
{
"id" : "007C3971-CF50-4512-AC3D-3A591FA81B3C",
"name" : "UITest-critical",
"options" : {
"environmentVariableEntries" : [
{
"key" : "INBUCKET_USERNAME",
"value" : "$(INBUCKET_USERNAME)"
},
{
"key" : "UITEST_TAGS",
"value" : "critical"
},
{
"key" : "BASIC_AUTH",
"value" : "$(BASIC_AUTH)"
},
{
"key" : "BACKEND_URL",
"value" : "$(BACKEND_URL)"
},
{
"key" : "INBUCKET_URL",
"value" : "$(INBUCKET_URL)"
},
{
"key" : "INBUCKET_PASSWORD",
"value" : "$(INBUCKET_PASSWORD)"
},
{
"key" : "ANTA_DEEPLINK_URL",
"value" : "$(ANTA_DEEPLINK_URL)"
},
{
"key" : "ANTA_INBUCKET_URL",
"value" : "$(ANTA_INBUCKET_URL)"
},
{
"key" : "BACKEND_URL_ANTA",
"value" : "$(BACKEND_URL_ANTA)"
},
{
"key" : "BASIC_AUTH_ANTA",
"value" : "$(BASIC_AUTH_ANTA)"
}
],
"targetForVariableExpansion" : {
"containerPath" : "container:Wire-iOS.xcodeproj",
"identifier" : "01DFC4302D7B4C6F00D1962A",
"name" : "WireUITests"
}
}
}
],
"defaultOptions" : {
Expand Down
4 changes: 2 additions & 2 deletions wire-ios/WireUITests/AccountManagementTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class AccountManagementTests: WireUITestCase {
var teamMember: UserInfo!

@MainActor
func test_Account_Management_Lock_With_Passcode() async throws {
func testCritical_Account_Management_Lock_With_Passcode() async throws {
let passcode = UserGenerator.generateAppPasscode()

do {
Expand Down Expand Up @@ -62,7 +62,7 @@ final class AccountManagementTests: WireUITestCase {
}

@MainActor
func test_Account_Management_Update_Email_Reset_password() async throws {
func testCritical_Account_Management_Update_Email_Reset_password() async throws {
let updatedUserDetails = UserGenerator.generateUniqueUserInfo()

do {
Expand Down
2 changes: 1 addition & 1 deletion wire-ios/WireUITests/BackupRestoreHistoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import XCTest
final class BackupRestoreHistoryTests: WireUITestCase {

@MainActor
func test_CreateBackupAndRestoreHistory() async throws {
func testCritical_CreateBackupAndRestoreHistory() async throws {
let groupName = UserGenerator.generateRandomGroupName()
let messageFromOwner = UserGenerator.generateRandomMessage()
let (_, teamOwner) = try await userHelper.registerUserAsTeamOwner()
Expand Down
23 changes: 21 additions & 2 deletions wire-ios/WireUITests/Helper/WireUITestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,28 @@ class WireUITestCase: XCTestCase {
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let userHelper = UserHelper()

// setup Tags
enum UITestTag {
static let critical = "critical"
}

private static let isCriticalMode: Bool = {
let raw = ProcessInfo.processInfo.environment["UITEST_TAGS"] ?? ""
return raw.range(of: UITestTag.critical, options: .caseInsensitive) != nil
}()

private func shouldSkipBasedOnTags() -> Bool {
guard Self.isCriticalMode else { return false }
return name.range(of: UITestTag.critical, options: .caseInsensitive) == nil
}

override func setUpWithError() throws {
try super.setUpWithError()

if shouldSkipBasedOnTags() {
throw XCTSkip("Skipping test \(name) due to UITEST_TAGS filter")
}

XCUIApplication().terminate()

let launchArguments = [
Expand All @@ -44,8 +65,6 @@ class WireUITestCase: XCTestCase {
])
app.launch()

// In UI tests it is usually best to stop immediately when a failure occurs
// although this does not appear to work
continueAfterFailure = false
}

Expand Down
2 changes: 1 addition & 1 deletion wire-ios/WireUITests/MultiBackendSupportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class MultiBackendSupportTests: WireUITestCase {
}

@MainActor
func test_Add_MultiBackend_Accounts() async throws {
func testCritical_Add_MultiBackend_Accounts() async throws {

defer { BackendContext.current = .staging }

Expand Down
6 changes: 3 additions & 3 deletions wire-ios/WireUITests/PersonalUserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import XCTest
final class PersonalUsersTests: WireUITestCase {

@MainActor
func test_Register_asPersonalUser() async throws {
func testCritical_Register_asPersonalUser() async throws {
let user = UserGenerator.generateUniqueUserInfo()

let welcomePage = try WelcomePage()
Expand Down Expand Up @@ -58,7 +58,7 @@ final class PersonalUsersTests: WireUITestCase {
}

@MainActor
func test_Login_asExistingPersonalUser() async throws {
func testCritical_Login_asExistingPersonalUser() async throws {
let user = try await userHelper.createPersonalUser()

let firstTimePage = try app.loginUser(email: user.email, password: user.password)
Expand All @@ -70,7 +70,7 @@ final class PersonalUsersTests: WireUITestCase {
}

@MainActor
func test_PersonalAccountLifecycle() async throws {
func testCritical_PersonalAccountLifecycle() async throws {
let userA = try await userHelper.createPersonalUser()
let userB = try await userHelper.createPersonalUser()
let messageFromUserB = "Hello from \(userB.name)"
Expand Down
8 changes: 4 additions & 4 deletions wire-ios/WireUITests/TeamManageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import XCTest
final class TeamManageTests: WireUITestCase {

@MainActor
func test_Migrate_PersonalUserToTeam() async throws {
func testCritical_Migrate_PersonalUserToTeam() async throws {
let user = try await userHelper.createPersonalUser()

let firstTimePage = try app.loginUser(email: user.email, password: user.password)
Expand All @@ -44,7 +44,7 @@ final class TeamManageTests: WireUITestCase {
}

@MainActor
func test_PersonalUser_InvitedToTeam() async throws {
func testCritical_PersonalUser_InvitedToTeam() async throws {
let owner = try await userHelper.createPersonalUser()
let memberUser = UserGenerator.generateUniqueUserInfo()
let teamID = try await BackendClient.upgradePersonalToTeam(
Expand Down Expand Up @@ -79,7 +79,7 @@ final class TeamManageTests: WireUITestCase {
}

@MainActor
func test_TeamOwner_GroupCreatedAndSendMessage() async throws {
func testCritical_TeamOwner_GroupCreatedAndSendMessage() async throws {

let groupName = UserGenerator.generateRandomGroupName()
let messageFromOwner = UserGenerator.generateRandomMessage()
Expand Down Expand Up @@ -124,7 +124,7 @@ final class TeamManageTests: WireUITestCase {
}

@MainActor
func test_GroupAdmin_RemoveAndAddParticipantFromGroup() async throws {
func testCritical_GroupAdmin_RemoveAndAddParticipantFromGroup() async throws {

let groupName = UserGenerator.generateRandomGroupName()
let (_, teamOwner) = try await userHelper.registerUserAsTeamOwner()
Expand Down
Loading