From c19b9d892055caba1728b561ce3c71be43f7903b Mon Sep 17 00:00:00 2001 From: Lei Nelissen Date: Wed, 15 Jun 2022 11:45:38 +0200 Subject: [PATCH] Add screenshotting --- .gitignore | 5 +- Gemfile.lock | 129 +++++--- fastlane/Deliverfile | 3 + fastlane/Fastfile | 18 +- fastlane/README.md | 8 + fastlane/Snapfile | 41 +++ fastlane/metadata/.gitignore | 1 + fastlane/metadata/copyright.txt | 1 + .../en-US/apple_tv_privacy_policy.txt | 1 + fastlane/metadata/en-US/description.txt | 1 + fastlane/metadata/en-US/keywords.txt | 1 + fastlane/metadata/en-US/marketing_url.txt | 1 + fastlane/metadata/en-US/name.txt | 1 + fastlane/metadata/en-US/privacy_url.txt | 1 + fastlane/metadata/en-US/promotional_text.txt | 1 + fastlane/metadata/en-US/release_notes.txt | 1 + fastlane/metadata/en-US/subtitle.txt | 1 + fastlane/metadata/en-US/support_url.txt | 1 + fastlane/metadata/primary_category.txt | 1 + .../metadata/primary_first_sub_category.txt | 1 + .../metadata/primary_second_sub_category.txt | 1 + fastlane/metadata/secondary_category.txt | 1 + .../metadata/secondary_first_sub_category.txt | 1 + .../secondary_second_sub_category.txt | 1 + index.js | 6 +- ios/Fintunes.xcodeproj/project.pbxproj | 177 ++++++++-- .../xcshareddata/xcschemes/Fintunes.xcscheme | 20 +- ios/Fintunes/Info.plist | 4 +- ios/FintunesTests/FintunesTests.m | 65 ---- ios/FintunesTests/Info.plist | 24 -- ios/FintunesUITests/FintunesUITests.swift | 61 ++++ ios/FintunesUITests/SnapshotHelper.swift | 309 ++++++++++++++++++ package-lock.json | 4 +- package.json | 2 +- src/components/TouchableHandler.tsx | 5 +- src/screens/Downloads/index.tsx | 3 +- .../Music/overlays/NowPlaying/index.tsx | 2 +- src/screens/Music/stacks/RecentAlbums.tsx | 6 +- .../Music/stacks/components/TrackListView.tsx | 7 +- src/screens/Search/index.tsx | 3 +- src/screens/index.tsx | 8 +- 41 files changed, 736 insertions(+), 192 deletions(-) create mode 100644 fastlane/Deliverfile create mode 100644 fastlane/Snapfile create mode 100644 fastlane/metadata/.gitignore create mode 100644 fastlane/metadata/copyright.txt create mode 100644 fastlane/metadata/en-US/apple_tv_privacy_policy.txt create mode 100644 fastlane/metadata/en-US/description.txt create mode 100644 fastlane/metadata/en-US/keywords.txt create mode 100644 fastlane/metadata/en-US/marketing_url.txt create mode 100644 fastlane/metadata/en-US/name.txt create mode 100644 fastlane/metadata/en-US/privacy_url.txt create mode 100644 fastlane/metadata/en-US/promotional_text.txt create mode 100644 fastlane/metadata/en-US/release_notes.txt create mode 100644 fastlane/metadata/en-US/subtitle.txt create mode 100644 fastlane/metadata/en-US/support_url.txt create mode 100644 fastlane/metadata/primary_category.txt create mode 100644 fastlane/metadata/primary_first_sub_category.txt create mode 100644 fastlane/metadata/primary_second_sub_category.txt create mode 100644 fastlane/metadata/secondary_category.txt create mode 100644 fastlane/metadata/secondary_first_sub_category.txt create mode 100644 fastlane/metadata/secondary_second_sub_category.txt delete mode 100644 ios/FintunesTests/FintunesTests.m delete mode 100644 ios/FintunesTests/Info.plist create mode 100644 ios/FintunesUITests/FintunesUITests.swift create mode 100644 ios/FintunesUITests/SnapshotHelper.swift diff --git a/.gitignore b/.gitignore index f9d41d0..43d7a2a 100644 --- a/.gitignore +++ b/.gitignore @@ -69,4 +69,7 @@ fastlane/Appfile certificates/ .env -sentry.properties \ No newline at end of file +sentry.properties + +screenshots +fastlane/Preview.html \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index c7159ec..c154b5d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,8 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.3) + CFPropertyList (3.0.5) + rexml activesupport (6.1.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) @@ -13,26 +14,29 @@ GEM algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) artifactory (3.0.15) atomos (0.1.3) - aws-eventstream (1.1.1) - aws-partitions (1.488.0) - aws-sdk-core (3.119.0) + aws-eventstream (1.2.0) + aws-partitions (1.598.0) + aws-sdk-core (3.131.1) aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) + aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.46.0) - aws-sdk-core (~> 3, >= 3.119.0) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.57.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.99.0) - aws-sdk-core (~> 3, >= 3.119.0) + aws-sdk-s3 (1.114.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.4) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) - claide (1.0.3) + claide (1.1.0) cocoapods (1.11.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) @@ -75,27 +79,29 @@ GEM commander (4.6.0) highline (~> 2.0.0) concurrent-ruby (1.1.10) + concurrent-ruby (1.1.10) declarative (0.0.20) digest-crc (0.6.4) rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) - emoji_regex (3.2.2) + emoji_regex (3.2.3) escape (0.0.4) ethon (0.15.0) ffi (>= 1.15.0) - excon (0.85.0) - faraday (1.7.0) + excon (0.92.3) + faraday (1.10.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.1) + faraday-net_http_persistent (~> 1.0) faraday-patron (~> 1.0) faraday-rack (~> 1.0) - multipart-post (>= 1.2, < 3) + faraday-retry (~> 1.0) ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) faraday (>= 0.8.0) @@ -104,14 +110,17 @@ GEM faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) faraday-net_http (1.0.1) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) - faraday_middleware (1.1.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.2.5) - fastlane (2.191.0) + fastimage (2.2.6) + fastlane (2.206.2) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -137,6 +146,7 @@ GEM mini_magick (>= 4.9.4, < 5.0.0) multipart-post (~> 2.0.0) naturally (~> 2.2) + optparse (~> 0.1.1) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) security (= 0.1.3) @@ -150,15 +160,15 @@ GEM xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) fastlane-plugin-load_json (0.0.1) - fastlane-plugin-sentry (1.12.2) + fastlane-plugin-sentry (1.8.1) fastlane-plugin-versioning_android (0.1.0) ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.10.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-core (0.4.1) + google-apis-androidpublisher_v3 (0.22.0) + google-apis-core (>= 0.5, < 2.a) + google-apis-core (0.5.0) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -167,58 +177,60 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-iamcredentials_v1 (0.6.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-playcustomapp_v1 (0.5.0) - google-apis-core (>= 0.4, < 2.a) - google-apis-storage_v1 (0.6.0) - google-apis-core (>= 0.4, < 2.a) + google-apis-iamcredentials_v1 (0.11.0) + google-apis-core (>= 0.5, < 2.a) + google-apis-playcustomapp_v1 (0.8.0) + google-apis-core (>= 0.5, < 2.a) + google-apis-storage_v1 (0.15.0) + google-apis-core (>= 0.5, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) - google-cloud-env (1.5.0) - faraday (>= 0.17.3, < 2.0) - google-cloud-errors (1.1.0) - google-cloud-storage (1.34.1) - addressable (~> 2.5) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.2.0) + google-cloud-storage (1.36.2) + addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) google-apis-storage_v1 (~> 0.1) google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (0.17.0) - faraday (>= 0.17.3, < 2.0) + googleauth (1.1.3) + faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) - signet (~> 0.14) + signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.4) + http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) i18n (1.10.0) concurrent-ruby (~> 1.0) - jmespath (1.4.0) - json (2.5.1) - jwt (2.2.3) + jmespath (1.6.1) + json (2.6.2) + jwt (2.4.1) memoist (0.16.2) mini_magick (4.11.0) - mini_mime (1.1.0) + mini_mime (1.1.2) minitest (5.15.0) molinillo (0.8.0) multi_json (1.15.0) multipart-post (2.0.0) nanaimo (0.3.0) nap (1.1.0) + nap (1.1.0) naturally (2.2.1) netrc (0.11.0) - os (1.1.1) + optparse (0.1.1) + os (1.1.4) plist (3.6.0) - public_suffix (4.0.6) + public_suffix (4.0.7) rake (13.0.6) - representable (3.1.1) + representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) @@ -226,12 +238,13 @@ GEM rexml (3.2.5) rouge (2.0.7) ruby-macho (2.5.1) + ruby-macho (2.5.1) ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.3) - signet (0.15.0) - addressable (~> 2.3) - faraday (>= 0.17.3, < 2.0) + signet (0.16.1) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.0) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) simctl (1.6.8) @@ -240,7 +253,7 @@ GEM terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - trailblazer-option (0.1.1) + trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.1) tty-spinner (0.9.3) @@ -249,11 +262,15 @@ GEM ethon (>= 0.9.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) uber (0.1.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) - unicode-display_width (1.7.0) + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) webrick (1.7.0) word_wrap (1.0.0) xcodeproj (1.21.0) @@ -268,16 +285,20 @@ GEM xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) zeitwerk (2.6.0) + zeitwerk (2.6.0) PLATFORMS ruby DEPENDENCIES + cocoapods (~> 1.11, >= 1.11.2) cocoapods (~> 1.11, >= 1.11.2) fastlane (~> 2.153) fastlane-plugin-load_json + fastlane-plugin-load_json fastlane-plugin-sentry fastlane-plugin-versioning_android + fastlane-plugin-versioning_android BUNDLED WITH 1.17.2 diff --git a/fastlane/Deliverfile b/fastlane/Deliverfile new file mode 100644 index 0000000..74739f7 --- /dev/null +++ b/fastlane/Deliverfile @@ -0,0 +1,3 @@ +# The Deliverfile allows you to store various App Store Connect metadata +# For more information, check out the docs +# https://docs.fastlane.tools/actions/deliver/ diff --git a/fastlane/Fastfile b/fastlane/Fastfile index f357762..e05ab32 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -3,7 +3,7 @@ default_platform(:ios) package = load_json(json_path: "package.json") platform :ios do - lane :beta do + before_all do get_certificates( output_path: 'certificates/' ) @@ -23,6 +23,19 @@ platform :ios do increment_build_number( xcodeproj: "ios/Fintunes.xcodeproj", ) + end + + lane :release do + build_app( + scheme: "Fintunes", + output_directory: "build", + workspace: "ios/Fintunes.xcworkspace", + export_method: "app-store", + ) + upload_to_app_store + end + + lane :beta do build_app( scheme: "Fintunes", output_directory: "build", @@ -30,6 +43,9 @@ platform :ios do export_method: "app-store", ) upload_to_testflight + end + + after_all do build_number = get_build_number( xcodeproj: "ios/Fintunes.xcodeproj", ) diff --git a/fastlane/README.md b/fastlane/README.md index e65a36c..6378662 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -15,6 +15,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do ## iOS +### ios release + +```sh +[bundle exec] fastlane ios release +``` + + + ### ios beta ```sh diff --git a/fastlane/Snapfile b/fastlane/Snapfile new file mode 100644 index 0000000..2c4ad88 --- /dev/null +++ b/fastlane/Snapfile @@ -0,0 +1,41 @@ +# Uncomment the lines below you want to change by removing the # in the beginning + +# A list of devices you want to take the screenshots from +devices([ + "iPhone 13 Pro Max", + "iPhone 8 Plus", +]) + +languages([ + "en-US", + "es-ES", + "fr-FR", + "ja", + "nl-NL", + "zh-Hans", +]) + +# The name of the scheme which contains the UI Tests +scheme("Fintunes") +workspace("ios/Fintunes.xcworkspace") + +# Where should the resulting screenshots be stored? +output_directory("./fastlane/screenshots") + +# remove the '#' to clear all previously generated screenshots before creating new ones +clear_previous_screenshots(true) + +# Remove the '#' to set the status bar to 9:41 AM, and show full battery and reception. See also override_status_bar_arguments for custom options. +# override_status_bar(true) + +# Arguments to pass to the app on launch. See https://docs.fastlane.tools/actions/snapshot/#launch-arguments +# launch_arguments(["-favColor red"]) + +# For more information about all available options run +# fastlane action snapshot + +# Enabling this option will prevent displaying the simulator window +headless(false) + +# Enabling this option will configure the Simulator to be in dark mode (false for light, true for dark) +dark_mode(false) \ No newline at end of file diff --git a/fastlane/metadata/.gitignore b/fastlane/metadata/.gitignore new file mode 100644 index 0000000..9a9b267 --- /dev/null +++ b/fastlane/metadata/.gitignore @@ -0,0 +1 @@ +review_information \ No newline at end of file diff --git a/fastlane/metadata/copyright.txt b/fastlane/metadata/copyright.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/copyright.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/en-US/apple_tv_privacy_policy.txt b/fastlane/metadata/en-US/apple_tv_privacy_policy.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/en-US/apple_tv_privacy_policy.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/en-US/description.txt b/fastlane/metadata/en-US/description.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/en-US/description.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/en-US/keywords.txt b/fastlane/metadata/en-US/keywords.txt new file mode 100644 index 0000000..4215253 --- /dev/null +++ b/fastlane/metadata/en-US/keywords.txt @@ -0,0 +1 @@ +jellyfin, audio, player, streaming, downloads, music diff --git a/fastlane/metadata/en-US/marketing_url.txt b/fastlane/metadata/en-US/marketing_url.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/en-US/marketing_url.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/en-US/name.txt b/fastlane/metadata/en-US/name.txt new file mode 100644 index 0000000..ecbdfcc --- /dev/null +++ b/fastlane/metadata/en-US/name.txt @@ -0,0 +1 @@ +Fintunes \ No newline at end of file diff --git a/fastlane/metadata/en-US/privacy_url.txt b/fastlane/metadata/en-US/privacy_url.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/en-US/privacy_url.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/en-US/promotional_text.txt b/fastlane/metadata/en-US/promotional_text.txt new file mode 100644 index 0000000..0f49e47 --- /dev/null +++ b/fastlane/metadata/en-US/promotional_text.txt @@ -0,0 +1 @@ +A streaming audio player for Jellyfin, with support for search and downloads. diff --git a/fastlane/metadata/en-US/release_notes.txt b/fastlane/metadata/en-US/release_notes.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/en-US/release_notes.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/en-US/subtitle.txt b/fastlane/metadata/en-US/subtitle.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/en-US/subtitle.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/en-US/support_url.txt b/fastlane/metadata/en-US/support_url.txt new file mode 100644 index 0000000..04efc74 --- /dev/null +++ b/fastlane/metadata/en-US/support_url.txt @@ -0,0 +1 @@ +https://github.com/leinelissen/jellyfin-audio-player diff --git a/fastlane/metadata/primary_category.txt b/fastlane/metadata/primary_category.txt new file mode 100644 index 0000000..40d886b --- /dev/null +++ b/fastlane/metadata/primary_category.txt @@ -0,0 +1 @@ +MUSIC diff --git a/fastlane/metadata/primary_first_sub_category.txt b/fastlane/metadata/primary_first_sub_category.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/primary_first_sub_category.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/primary_second_sub_category.txt b/fastlane/metadata/primary_second_sub_category.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/primary_second_sub_category.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/secondary_category.txt b/fastlane/metadata/secondary_category.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/secondary_category.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/secondary_first_sub_category.txt b/fastlane/metadata/secondary_first_sub_category.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/secondary_first_sub_category.txt @@ -0,0 +1 @@ + diff --git a/fastlane/metadata/secondary_second_sub_category.txt b/fastlane/metadata/secondary_second_sub_category.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/fastlane/metadata/secondary_second_sub_category.txt @@ -0,0 +1 @@ + diff --git a/index.js b/index.js index fc4042a..1488065 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ import 'react-native-gesture-handler'; -import { AppRegistry } from 'react-native'; +import { AppRegistry, LogBox } from 'react-native'; import TrackPlayer from 'react-native-track-player'; import App from './src/components/App'; import { name as appName } from './app.json'; @@ -8,7 +8,9 @@ import { setupSentry } from 'utility/Sentry'; import { enableScreens } from 'react-native-screens'; import { patchTrackPlayer } from 'utility/AddedTrackEvents'; -console.log(appName); +LogBox.ignoreLogs([ + 'ViewPropTypes will be removed from React Native', +]); setupSentry(); enableScreens(); diff --git a/ios/Fintunes.xcodeproj/project.pbxproj b/ios/Fintunes.xcodeproj/project.pbxproj index 729f386..a412309 100644 --- a/ios/Fintunes.xcodeproj/project.pbxproj +++ b/ios/Fintunes.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 00E356F31AD99517003FC87E /* FintunesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* FintunesTests.m */; }; 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; @@ -15,6 +14,8 @@ 38B3606A2D29107567360ACF /* libPods-Fintunes-FintunesTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EBC468D2DE6EB8FF02B72B7 /* libPods-Fintunes-FintunesTests.a */; }; 4C04FC6E055249ABB204D3BC /* Inter-VariableFont_slnt,wght.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 4B4A0465FF364579B28CF5D7 /* Inter-VariableFont_slnt,wght.ttf */; }; 4FA1B23D2550A94C007A035E /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FA1B23C2550A94C007A035E /* File.swift */; }; + AB393FCA2857CC8400773469 /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB393FC92857CC8400773469 /* SnapshotHelper.swift */; }; + AB4A8DFE2857C8DA005A1ED0 /* FintunesUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4A8DFD2857C8DA005A1ED0 /* FintunesUITests.swift */; }; D7439709FB704B4FE23C538F /* libPods-Fintunes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 12335560B9820FD5AD98AB8F /* libPods-Fintunes.a */; }; /* End PBXBuildFile section */ @@ -26,12 +27,17 @@ remoteGlobalIDString = 13B07F861A680F5B00A75B9A; remoteInfo = Fintunes; }; + AB4A8E012857C8DA005A1ED0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 13B07F861A680F5B00A75B9A; + remoteInfo = Fintunes; + }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 00E356EE1AD99517003FC87E /* FintunesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FintunesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* FintunesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FintunesTests.m; sourceTree = ""; }; 0973197F4BDB99413C326AD0 /* Pods-Fintunes.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Fintunes.release.xcconfig"; path = "Target Support Files/Pods-Fintunes/Pods-Fintunes.release.xcconfig"; sourceTree = ""; }; 12335560B9820FD5AD98AB8F /* libPods-Fintunes.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Fintunes.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07F961A680F5B00A75B9A /* Fintunes.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Fintunes.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -47,6 +53,9 @@ 5370B45C5DDCD952C6569B8D /* Pods-Fintunes.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Fintunes.debug.xcconfig"; path = "Target Support Files/Pods-Fintunes/Pods-Fintunes.debug.xcconfig"; sourceTree = ""; }; 7D43C7610851B9666193E3F6 /* libPods-Fintunes-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Fintunes-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 8EBC468D2DE6EB8FF02B72B7 /* libPods-Fintunes-FintunesTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Fintunes-FintunesTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + AB393FC92857CC8400773469 /* SnapshotHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapshotHelper.swift; sourceTree = ""; }; + AB4A8DFB2857C8DA005A1ED0 /* FintunesUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FintunesUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + AB4A8DFD2857C8DA005A1ED0 /* FintunesUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FintunesUITests.swift; sourceTree = ""; }; AFAE700A256C6B0ED0D20FE3 /* Pods-Fintunes-FintunesTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Fintunes-FintunesTests.release.xcconfig"; path = "Target Support Files/Pods-Fintunes-FintunesTests/Pods-Fintunes-FintunesTests.release.xcconfig"; sourceTree = ""; }; B20CBCFF11E124551F286B84 /* Pods-Fintunes-FintunesTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Fintunes-FintunesTests.debug.xcconfig"; path = "Target Support Files/Pods-Fintunes-FintunesTests/Pods-Fintunes-FintunesTests.debug.xcconfig"; sourceTree = ""; }; E35451F7979C52C1692C4C9F /* libPods-Fintunes-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Fintunes-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -71,26 +80,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AB4A8DF82857C8DA005A1ED0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 00E356EF1AD99517003FC87E /* FintunesTests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* FintunesTests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = FintunesTests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; 13B07FAE1A68108700A75B9A /* Fintunes */ = { isa = PBXGroup; children = ( @@ -142,7 +141,7 @@ children = ( 13B07FAE1A68108700A75B9A /* Fintunes */, 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* FintunesTests */, + AB4A8DFC2857C8DA005A1ED0 /* FintunesUITests */, 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, 46001D7383D71A837AAF6E07 /* Pods */, @@ -158,10 +157,20 @@ children = ( 13B07F961A680F5B00A75B9A /* Fintunes.app */, 00E356EE1AD99517003FC87E /* FintunesTests.xctest */, + AB4A8DFB2857C8DA005A1ED0 /* FintunesUITests.xctest */, ); name = Products; sourceTree = ""; }; + AB4A8DFC2857C8DA005A1ED0 /* FintunesUITests */ = { + isa = PBXGroup; + children = ( + AB4A8DFD2857C8DA005A1ED0 /* FintunesUITests.swift */, + AB393FC92857CC8400773469 /* SnapshotHelper.swift */, + ); + path = FintunesUITests; + sourceTree = ""; + }; CFCEB457E84E4C5195253CD7 /* Resources */ = { isa = PBXGroup; children = ( @@ -216,12 +225,31 @@ productReference = 13B07F961A680F5B00A75B9A /* Fintunes.app */; productType = "com.apple.product-type.application"; }; + AB4A8DFA2857C8DA005A1ED0 /* FintunesUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = AB4A8E052857C8DB005A1ED0 /* Build configuration list for PBXNativeTarget "FintunesUITests" */; + buildPhases = ( + AB4A8DF72857C8DA005A1ED0 /* Sources */, + AB4A8DF82857C8DA005A1ED0 /* Frameworks */, + AB4A8DF92857C8DA005A1ED0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + AB4A8E022857C8DA005A1ED0 /* PBXTargetDependency */, + ); + name = FintunesUITests; + productName = FintunesUITests; + productReference = AB4A8DFB2857C8DA005A1ED0 /* FintunesUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 83CBB9F71A601CBA00E9B192 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 1340; LastUpgradeCheck = 1130; TargetAttributes = { 00E356ED1AD99517003FC87E = { @@ -235,6 +263,12 @@ LastSwiftMigration = 1210; ProvisioningStyle = Automatic; }; + AB4A8DFA2857C8DA005A1ED0 = { + CreatedOnToolsVersion = 13.4.1; + DevelopmentTeam = 238P3C58WC; + ProvisioningStyle = Automatic; + TestTargetID = 13B07F861A680F5B00A75B9A; + }; }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Fintunes" */; @@ -252,6 +286,7 @@ targets = ( 13B07F861A680F5B00A75B9A /* Fintunes */, 00E356ED1AD99517003FC87E /* FintunesTests */, + AB4A8DFA2857C8DA005A1ED0 /* FintunesUITests */, ); }; /* End PBXProject section */ @@ -274,6 +309,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AB4A8DF92857C8DA005A1ED0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -444,7 +486,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 00E356F31AD99517003FC87E /* FintunesTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -458,6 +499,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AB4A8DF72857C8DA005A1ED0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AB4A8DFE2857C8DA005A1ED0 /* FintunesUITests.swift in Sources */, + AB393FCA2857CC8400773469 /* SnapshotHelper.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -466,6 +516,11 @@ target = 13B07F861A680F5B00A75B9A /* Fintunes */; targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; }; + AB4A8E022857C8DA005A1ED0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 13B07F861A680F5B00A75B9A /* Fintunes */; + targetProxy = AB4A8E012857C8DA005A1ED0 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -547,7 +602,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 39; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = 238P3C58WC; ENABLE_BITCODE = NO; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -560,6 +615,7 @@ "$(SDKROOT)/usr/lib/swift", "$(inherited)", ); + MARKETING_VERSION = 2.0.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -583,7 +639,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 39; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = 238P3C58WC; INFOPLIST_FILE = Fintunes/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -591,6 +647,7 @@ "$(SDKROOT)/usr/lib/swift", "$(inherited)", ); + MARKETING_VERSION = 2.0.0; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -725,6 +782,69 @@ }; name = Release; }; + AB4A8E032857C8DB005A1ED0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 6; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = 238P3C58WC; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.5; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = nl.moeilijkedingen.FintunesUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "915c5213-22f6-4f9d-8065-2a06300f9bfb"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Fintunes; + }; + name = Debug; + }; + AB4A8E042857C8DB005A1ED0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 6; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = 238P3C58WC; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.5; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = nl.moeilijkedingen.FintunesUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "915c5213-22f6-4f9d-8065-2a06300f9bfb"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Fintunes; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -755,6 +875,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + AB4A8E052857C8DB005A1ED0 /* Build configuration list for PBXNativeTarget "FintunesUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AB4A8E032857C8DB005A1ED0 /* Debug */, + AB4A8E042857C8DB005A1ED0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; diff --git a/ios/Fintunes.xcodeproj/xcshareddata/xcschemes/Fintunes.xcscheme b/ios/Fintunes.xcodeproj/xcshareddata/xcschemes/Fintunes.xcscheme index 2797954..e4fc7d4 100644 --- a/ios/Fintunes.xcodeproj/xcshareddata/xcschemes/Fintunes.xcscheme +++ b/ios/Fintunes.xcodeproj/xcshareddata/xcschemes/Fintunes.xcscheme @@ -20,6 +20,20 @@ ReferencedContainer = "container:Fintunes.xcodeproj"> + + + + diff --git a/ios/Fintunes/Info.plist b/ios/Fintunes/Info.plist index d86eb35..177f7f5 100644 --- a/ios/Fintunes/Info.plist +++ b/ios/Fintunes/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2.7 + 2.0.0 CFBundleSignature ???? CFBundleVersion - 39 + 6 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/ios/FintunesTests/FintunesTests.m b/ios/FintunesTests/FintunesTests.m deleted file mode 100644 index a4bfd24..0000000 --- a/ios/FintunesTests/FintunesTests.m +++ /dev/null @@ -1,65 +0,0 @@ -#import -#import - -#import -#import - -#define TIMEOUT_SECONDS 600 -#define TEXT_TO_LOOK_FOR @"Welcome to React" - -@interface FintunesTests : XCTestCase - -@end - -@implementation FintunesTests - -- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test -{ - if (test(view)) { - return YES; - } - for (UIView *subview in [view subviews]) { - if ([self findSubviewInView:subview matching:test]) { - return YES; - } - } - return NO; -} - -- (void)testRendersWelcomeScreen -{ - UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; - BOOL foundElement = NO; - - __block NSString *redboxError = nil; -#ifdef DEBUG - RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - if (level >= RCTLogLevelError) { - redboxError = message; - } - }); -#endif - - while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - - foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { - if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { - return YES; - } - return NO; - }]; - } - -#ifdef DEBUG - RCTSetLogFunction(RCTDefaultLogFunction); -#endif - - XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); - XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); -} - - -@end diff --git a/ios/FintunesTests/Info.plist b/ios/FintunesTests/Info.plist deleted file mode 100644 index f131edf..0000000 --- a/ios/FintunesTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.2.7 - CFBundleSignature - ???? - CFBundleVersion - 39 - - diff --git a/ios/FintunesUITests/FintunesUITests.swift b/ios/FintunesUITests/FintunesUITests.swift new file mode 100644 index 0000000..040c664 --- /dev/null +++ b/ios/FintunesUITests/FintunesUITests.swift @@ -0,0 +1,61 @@ +// +// FintunesUITests.swift +// FintunesUITests +// +// Created by Lei Nelissen on 13/06/2022. +// + +import XCTest + +class FintunesUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + snapshot("04RecentAlbums"); + app.otherElements["all-albums"].tap(); + snapshot("05AlbumsScreen"); + app.buttons["search-tab"].tap(); + app.textFields["search-input"].tap(); + app.textFields["search-input"].typeText("bicep"); + snapshot("03SearchScreen"); + if app.otherElements["search-result-157a37e93a7aec945f8ea3107abb458a"].waitForExistence(timeout: 5) { + app.otherElements["search-result-157a37e93a7aec945f8ea3107abb458a"].tap(); + app.otherElements["search-result-157a37e93a7aec945f8ea3107abb458a"].tap(); + snapshot("02AlbumScreen"); + } + if app.otherElements["play-album"].waitForExistence(timeout: 5) { + app.otherElements["play-album"].tap(); + } + if app.otherElements["open-player-modal"].waitForExistence(timeout: 5) { + app.otherElements["open-player-modal"].tap(); + snapshot("01PlayModal"); + } + } + +// func testLaunchPerformance() throws { +// if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { +// // This measures how long it takes to launch your application. +// measure(metrics: [XCTApplicationLaunchMetric()]) { +// XCUIApplication().launch() +// } +// } +// } +} diff --git a/ios/FintunesUITests/SnapshotHelper.swift b/ios/FintunesUITests/SnapshotHelper.swift new file mode 100644 index 0000000..0046aaa --- /dev/null +++ b/ios/FintunesUITests/SnapshotHelper.swift @@ -0,0 +1,309 @@ +// +// SnapshotHelper.swift +// Example +// +// Created by Felix Krause on 10/8/15. +// + +// ----------------------------------------------------- +// IMPORTANT: When modifying this file, make sure to +// increment the version number at the very +// bottom of the file to notify users about +// the new SnapshotHelper.swift +// ----------------------------------------------------- + +import Foundation +import XCTest + +var deviceLanguage = "" +var locale = "" + +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) +} + +func snapshot(_ name: String, waitForLoadingIndicator: Bool) { + if waitForLoadingIndicator { + Snapshot.snapshot(name) + } else { + Snapshot.snapshot(name, timeWaitingForIdle: 0) + } +} + +/// - Parameters: +/// - name: The name of the snapshot +/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait. +func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + Snapshot.snapshot(name, timeWaitingForIdle: timeout) +} + +enum SnapshotError: Error, CustomDebugStringConvertible { + case cannotFindSimulatorHomeDirectory + case cannotRunOnPhysicalDevice + + var debugDescription: String { + switch self { + case .cannotFindSimulatorHomeDirectory: + return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable." + case .cannotRunOnPhysicalDevice: + return "Can't use Snapshot on a physical device." + } + } +} + +@objcMembers +open class Snapshot: NSObject { + static var app: XCUIApplication? + static var waitForAnimations = true + static var cacheDirectory: URL? + static var screenshotsDirectory: URL? { + return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) + } + + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + + Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations + + do { + let cacheDir = try getCacheDirectory() + Snapshot.cacheDirectory = cacheDir + setLanguage(app) + setLocale(app) + setLaunchArguments(app) + } catch let error { + NSLog(error.localizedDescription) + } + } + + class func setLanguage(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("language.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"] + } catch { + NSLog("Couldn't detect/set language...") + } + } + + class func setLocale(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("locale.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + locale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + } catch { + NSLog("Couldn't detect/set locale...") + } + + if locale.isEmpty && !deviceLanguage.isEmpty { + locale = Locale(identifier: deviceLanguage).identifier + } + + if !locale.isEmpty { + app.launchArguments += ["-AppleLocale", "\"\(locale)\""] + } + } + + class func setLaunchArguments(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt") + app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"] + + do { + let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8) + let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: []) + let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count)) + let results = matches.map { result -> String in + (launchArguments as NSString).substring(with: result.range) + } + app.launchArguments += results + } catch { + NSLog("Couldn't detect/set launch_arguments...") + } + } + + open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + if timeout > 0 { + waitForLoadingIndicatorToDisappear(within: timeout) + } + + NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work + + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } + + #if os(OSX) + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + #else + + guard self.app != nil else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let screenshot = XCUIScreen.main.screenshot() + #if os(iOS) && !targetEnvironment(macCatalyst) + let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image + #else + let image = screenshot.image + #endif + + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } + + do { + // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices + let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ") + let range = NSRange(location: 0, length: simulator.count) + simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") + + let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") + #if swift(<5.0) + UIImagePNGRepresentation(image)?.write(to: path, options: .atomic) + #else + try image.pngData()?.write(to: path, options: .atomic) + #endif + } catch let error { + NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") + NSLog(error.localizedDescription) + } + #endif + } + + class func fixLandscapeOrientation(image: UIImage) -> UIImage { + #if os(watchOS) + return image + #else + if #available(iOS 10.0, *) { + let format = UIGraphicsImageRendererFormat() + format.scale = image.scale + let renderer = UIGraphicsImageRenderer(size: image.size, format: format) + return renderer.image { context in + image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) + } + } else { + return image + } + #endif + } + + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { + #if os(tvOS) + return + #endif + + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element + let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) + _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) + } + + class func getCacheDirectory() throws -> URL { + let cachePath = "Library/Caches/tools.fastlane" + // on OSX config is stored in /Users//Library + // and on iOS/tvOS/WatchOS it's in simulator's home dir + #if os(OSX) + let homeDir = URL(fileURLWithPath: NSHomeDirectory()) + return homeDir.appendingPathComponent(cachePath) + #elseif arch(i386) || arch(x86_64) || arch(arm64) + guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { + throw SnapshotError.cannotFindSimulatorHomeDirectory + } + let homeDir = URL(fileURLWithPath: simulatorHostHome) + return homeDir.appendingPathComponent(cachePath) + #else + throw SnapshotError.cannotRunOnPhysicalDevice + #endif + } +} + +private extension XCUIElementAttributes { + var isNetworkLoadingIndicator: Bool { + if hasAllowListedIdentifier { return false } + + let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) + let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) + + return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize + } + + var hasAllowListedIdentifier: Bool { + let allowListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] + + return allowListedIdentifiers.contains(identifier) + } + + func isStatusBar(_ deviceWidth: CGFloat) -> Bool { + if elementType == .statusBar { return true } + guard frame.origin == .zero else { return false } + + let oldStatusBarSize = CGSize(width: deviceWidth, height: 20) + let newStatusBarSize = CGSize(width: deviceWidth, height: 44) + + return [oldStatusBarSize, newStatusBarSize].contains(frame.size) + } +} + +private extension XCUIElementQuery { + var networkLoadingIndicators: XCUIElementQuery { + let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isNetworkLoadingIndicator + } + + return self.containing(isNetworkLoadingIndicator) + } + + var deviceStatusBars: XCUIElementQuery { + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width + + let isStatusBar = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isStatusBar(deviceWidth) + } + + return self.containing(isStatusBar) + } +} + +private extension CGFloat { + func isBetween(_ numberA: CGFloat, and numberB: CGFloat) -> Bool { + return numberA...numberB ~= self + } +} + +// Please don't remove the lines below +// They are used to detect outdated configuration files +// SnapshotHelperVersion [1.28] diff --git a/package-lock.json b/package-lock.json index 63f7a21..4110c92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fintunes", - "version": "1.2.7", + "version": "2.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fintunes", - "version": "1.2.7", + "version": "2.0.0", "dependencies": { "@react-native-async-storage/async-storage": "^1.17.6", "@react-native-community/blur": "^3.6.0", diff --git a/package.json b/package.json index 2b71f90..c6df426 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fintunes", - "version": "1.2.7", + "version": "2.0.0", "main": "src/index.js", "private": true, "scripts": { diff --git a/src/components/TouchableHandler.tsx b/src/components/TouchableHandler.tsx index 03a601a..7db92b5 100644 --- a/src/components/TouchableHandler.tsx +++ b/src/components/TouchableHandler.tsx @@ -5,6 +5,7 @@ interface TouchableHandlerProps { id: T; onPress: (id: T) => void; onLongPress?: (id: T) => void; + testID?: string; } function TouchableStyles({ pressed }: { pressed: boolean }): ViewStyle { @@ -23,7 +24,8 @@ function TouchableHandler({ id, onPress, onLongPress, - children + children, + testID, }: PropsWithChildren>): JSX.Element { const handlePress = useCallback(() => { return onPress(id); @@ -38,6 +40,7 @@ function TouchableHandler({ onPress={handlePress} onLongPress={handleLongPress} style={TouchableStyles} + testID={testID} > {children} diff --git a/src/screens/Downloads/index.tsx b/src/screens/Downloads/index.tsx index c6132b3..c3224fd 100644 --- a/src/screens/Downloads/index.tsx +++ b/src/screens/Downloads/index.tsx @@ -90,6 +90,7 @@ function Downloads() { onPress={handleDeleteAllTracks} disabled={!ids.length} size="small" + testID="delete-all-tracks" /> {failedIds.length > 0 && ( @@ -128,7 +129,7 @@ function Downloads() { -