Fix missing UI tests simulator (#860)

* Fix UI and integration tests missing simulators (older)

* Update fastlane and dependencies
This commit is contained in:
Stefan Ceriu
2023-05-09 07:43:44 +03:00
committed by GitHub
parent 542cefd703
commit 521eeb2ecf
3 changed files with 60 additions and 33 deletions
+28 -1
View File
@@ -109,7 +109,12 @@ lane :unit_tests do
)
end
lane :ui_tests do
lane :ui_tests do
create_simulator_if_necessary(
name: "iPad (9th generation)",
type: "com.apple.CoreSimulator.SimDeviceType.iPad-9th-generation"
)
run_tests(
scheme: "UITests",
devices: ["iPhone 14", "iPad (9th generation)"],
@@ -128,6 +133,11 @@ lane :ui_tests do
end
lane :integration_tests do
create_simulator_if_necessary(
name: "iPhone 13 Pro",
type: "com.apple.CoreSimulator.SimDeviceType.iPhone-13-Pro"
)
run_tests(
scheme: "IntegrationTests",
devices: ["iPhone 13 Pro"],
@@ -330,3 +340,20 @@ private_lane :update_app_icon do |options|
end
end
end
private_lane :create_simulator_if_necessary do |options|
simulator_name = options[:name]
UI.user_error!("Invalid simulator name") unless !simulator_name.to_s.empty?
simulator_type = options[:type]
UI.user_error!("Invalid simulator type") unless !simulator_type.to_s.empty?
# Use use a `(` here to avoid matching `iPhone 13 Pro` on `iPhone 13 Pro Max` for example
begin sh("xcrun simctl list devices | grep '#{simulator_name} ('")
UI.success "Simulator already exists"
rescue
sh("xcrun simctl create '#{simulator_name}' #{simulator_type}")
end
end