From 521eeb2ecfbe73ffde58cf24cd03e074603bb77f Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 9 May 2023 07:43:44 +0300 Subject: [PATCH] Fix missing UI tests simulator (#860) * Fix UI and integration tests missing simulators (older) * Update fastlane and dependencies --- .github/workflows/ui_tests.yml | 2 +- Gemfile.lock | 62 +++++++++++++++++----------------- fastlane/Fastfile | 29 +++++++++++++++- 3 files changed, 60 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ui_tests.yml b/.github/workflows/ui_tests.yml index 0266a3a85..7709b687d 100644 --- a/.github/workflows/ui_tests.yml +++ b/.github/workflows/ui_tests.yml @@ -32,7 +32,7 @@ jobs: - name: Setup environment run: source ci_scripts/ci_common.sh && setup_github_actions_environment - + - name: Run tests run: bundle exec fastlane ui_tests diff --git a/Gemfile.lock b/Gemfile.lock index 79077278d..635a4d72e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,28 +1,28 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.5) + CFPropertyList (3.0.6) rexml - activesupport (7.0.4) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.1) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.682.0) - aws-sdk-core (3.168.4) + aws-partitions (1.760.0) + aws-sdk-core (3.171.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.61.0) + aws-sdk-kms (1.64.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.117.2) + aws-sdk-s3 (1.122.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) @@ -35,7 +35,7 @@ GEM colored2 (3.1.2) commander (4.6.0) highline (~> 2.0.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) declarative (0.0.20) digest-crc (0.6.4) rake (>= 12.0.0, < 14.0.0) @@ -43,8 +43,8 @@ GEM unf (>= 0.0.5, < 1.0.0) dotenv (2.8.1) emoji_regex (3.2.3) - excon (0.95.0) - faraday (1.10.2) + excon (0.99.0) + faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -73,7 +73,7 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) fastimage (2.2.6) - fastlane (2.211.0) + fastlane (2.212.2) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -122,9 +122,9 @@ GEM fastlane-plugin-xcodegen (1.1.0) fastlane-plugin-brew (~> 0.1.1) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.32.0) - google-apis-core (>= 0.9.1, < 2.a) - google-apis-core (0.9.2) + google-apis-androidpublisher_v3 (0.41.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.0) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -133,10 +133,10 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-iamcredentials_v1 (0.16.0) - google-apis-core (>= 0.9.1, < 2.a) - google-apis-playcustomapp_v1 (0.12.0) - google-apis-core (>= 0.9.1, < 2.a) + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) google-apis-storage_v1 (0.19.0) google-apis-core (>= 0.9.0, < 2.a) google-cloud-core (1.6.0) @@ -144,7 +144,7 @@ GEM google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.0) + google-cloud-errors (1.3.1) google-cloud-storage (1.44.0) addressable (~> 2.8) digest-crc (~> 0.4) @@ -153,7 +153,7 @@ GEM google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.3.0) + googleauth (1.5.2) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) @@ -165,30 +165,30 @@ GEM http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.13.0) concurrent-ruby (~> 1.0) jmespath (1.6.2) json (2.6.3) - jwt (2.5.0) + jwt (2.7.0) memoist (0.16.2) mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) + mime-types-data (3.2023.0218.1) mini_magick (4.12.0) mini_mime (1.1.2) - minitest (5.16.3) + minitest (5.18.0) multi_json (1.15.0) multipart-post (2.0.0) nanaimo (0.3.0) naturally (2.2.1) netrc (0.11.0) - nokogiri (1.13.10-arm64-darwin) + nokogiri (1.14.3-arm64-darwin) racc (~> 1.4) optparse (0.1.1) os (1.1.4) - plist (3.6.0) + plist (3.7.0) public_suffix (5.0.1) - racc (1.6.1) + racc (1.6.2) rake (13.0.6) representable (3.2.0) declarative (< 0.1.0) @@ -210,10 +210,10 @@ GEM faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - simctl (1.6.8) + simctl (1.6.10) CFPropertyList naturally - slather (2.7.3) + slather (2.7.4) CFPropertyList (>= 2.2, < 4) activesupport clamp (~> 1.3) @@ -227,14 +227,14 @@ GEM tty-screen (0.8.1) tty-spinner (0.9.3) tty-cursor (~> 0.7) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) unf (0.1.4) unf_ext unf_ext (0.0.8.2) unicode-display_width (1.8.0) - webrick (1.7.0) + webrick (1.8.1) word_wrap (1.0.0) xcode-install (2.8.1) claide (>= 0.9.1) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 89007ec23..8b1b43c95 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -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