From d911f1edc769fe4fa1ceb8257dd168ea5c23b95d Mon Sep 17 00:00:00 2001 From: Khoren Markosyan Date: Tue, 21 Jun 2022 15:20:15 +0400 Subject: [PATCH] implemented fastlane snapshot support for ios --- zxscanner/android/Gemfile | 3 + zxscanner/android/Gemfile.lock | 218 ++++++++++++ zxscanner/ios/.gitignore | 15 +- zxscanner/ios/Gemfile | 3 + zxscanner/ios/Gemfile.lock | 218 ++++++++++++ .../ios/Runner.xcodeproj/project.pbxproj | 173 ++++++++++ .../{Runner.xcscheme => ZXScanner.xcscheme} | 10 + .../xcschemes/zxscannerUITests.xcscheme | 77 +++++ zxscanner/ios/fastlane/Appfile | 8 + zxscanner/ios/fastlane/Fastfile | 25 ++ zxscanner/ios/fastlane/README.md | 32 ++ zxscanner/ios/fastlane/Snapfile | 30 ++ zxscanner/ios/fastlane/SnapshotHelper.swift | 309 ++++++++++++++++++ .../ios/fastlane/screenshots/background.jpg | Bin 0 -> 60058 bytes .../screenshots/en-US/keyword.strings | 3 + .../fastlane/screenshots/en-US/title.strings | 3 + .../ios/fastlane/screenshots/framefile.json | 35 ++ .../zxscannerUITests/zxscannerUITests.swift | 69 ++++ .../zxscannerUITestsLaunchTests.swift | 32 ++ zxscanner/lib/pages/settings_page.dart | 20 +- 20 files changed, 1272 insertions(+), 11 deletions(-) create mode 100644 zxscanner/android/Gemfile create mode 100644 zxscanner/android/Gemfile.lock create mode 100644 zxscanner/ios/Gemfile create mode 100644 zxscanner/ios/Gemfile.lock rename zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/{Runner.xcscheme => ZXScanner.xcscheme} (87%) create mode 100644 zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/zxscannerUITests.xcscheme create mode 100644 zxscanner/ios/fastlane/Appfile create mode 100644 zxscanner/ios/fastlane/Fastfile create mode 100644 zxscanner/ios/fastlane/README.md create mode 100644 zxscanner/ios/fastlane/Snapfile create mode 100644 zxscanner/ios/fastlane/SnapshotHelper.swift create mode 100644 zxscanner/ios/fastlane/screenshots/background.jpg create mode 100644 zxscanner/ios/fastlane/screenshots/en-US/keyword.strings create mode 100644 zxscanner/ios/fastlane/screenshots/en-US/title.strings create mode 100644 zxscanner/ios/fastlane/screenshots/framefile.json create mode 100644 zxscanner/ios/zxscannerUITests/zxscannerUITests.swift create mode 100644 zxscanner/ios/zxscannerUITests/zxscannerUITestsLaunchTests.swift diff --git a/zxscanner/android/Gemfile b/zxscanner/android/Gemfile new file mode 100644 index 0000000..7a118b4 --- /dev/null +++ b/zxscanner/android/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/zxscanner/android/Gemfile.lock b/zxscanner/android/Gemfile.lock new file mode 100644 index 0000000..ce460b7 --- /dev/null +++ b/zxscanner/android/Gemfile.lock @@ -0,0 +1,218 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.5) + rexml + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.2.0) + aws-partitions (1.600.0) + aws-sdk-core (3.131.1) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.525.0) + aws-sigv4 (~> 1.1) + 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.114.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + 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.3) + 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) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + 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-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.6) + fastlane (2.206.2) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + 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) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.22.0) + google-apis-core (>= 0.5, < 2.a) + google-apis-core (0.6.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + 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.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 (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.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.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.2) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) + naturally (2.2.1) + optparse (0.1.1) + os (1.1.4) + plist (3.6.0) + public_suffix (4.0.7) + rake (13.0.6) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.5) + rouge (2.0.7) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + 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) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + 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) + word_wrap (1.0.0) + xcodeproj (1.21.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.3.15 diff --git a/zxscanner/ios/.gitignore b/zxscanner/ios/.gitignore index 0da27ce..3365de1 100644 --- a/zxscanner/ios/.gitignore +++ b/zxscanner/ios/.gitignore @@ -33,4 +33,17 @@ Runner/GeneratedPluginRegistrant.* !default.pbxuser !default.perspectivev3 -Podfile.lock \ No newline at end of file +Podfile.lock + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/screenshots/screenshots.html +fastlane/test_output \ No newline at end of file diff --git a/zxscanner/ios/Gemfile b/zxscanner/ios/Gemfile new file mode 100644 index 0000000..7a118b4 --- /dev/null +++ b/zxscanner/ios/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/zxscanner/ios/Gemfile.lock b/zxscanner/ios/Gemfile.lock new file mode 100644 index 0000000..ce460b7 --- /dev/null +++ b/zxscanner/ios/Gemfile.lock @@ -0,0 +1,218 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.5) + rexml + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.2.0) + aws-partitions (1.600.0) + aws-sdk-core (3.131.1) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.525.0) + aws-sigv4 (~> 1.1) + 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.114.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + 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.3) + 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) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + 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-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.6) + fastlane (2.206.2) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + 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) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.22.0) + google-apis-core (>= 0.5, < 2.a) + google-apis-core (0.6.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + 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.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 (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.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.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.2) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) + naturally (2.2.1) + optparse (0.1.1) + os (1.1.4) + plist (3.6.0) + public_suffix (4.0.7) + rake (13.0.6) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.5) + rouge (2.0.7) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + 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) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + 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) + word_wrap (1.0.0) + xcodeproj (1.21.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.3.15 diff --git a/zxscanner/ios/Runner.xcodeproj/project.pbxproj b/zxscanner/ios/Runner.xcodeproj/project.pbxproj index f59bb96..19cfbc1 100644 --- a/zxscanner/ios/Runner.xcodeproj/project.pbxproj +++ b/zxscanner/ios/Runner.xcodeproj/project.pbxproj @@ -14,8 +14,21 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + A01175E2285F3F2800AC5CEC /* zxscannerUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A01175E1285F3F2800AC5CEC /* zxscannerUITests.swift */; }; + A01175E4285F3F2800AC5CEC /* zxscannerUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A01175E3285F3F2800AC5CEC /* zxscannerUITestsLaunchTests.swift */; }; + A01175EC285F3F9900AC5CEC /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A01175EB285F3F9900AC5CEC /* SnapshotHelper.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + A01175E5285F3F2800AC5CEC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -45,6 +58,10 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 9A8341A4E573B03B27A71F6D /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + A01175DF285F3F2800AC5CEC /* zxscannerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = zxscannerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + A01175E1285F3F2800AC5CEC /* zxscannerUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = zxscannerUITests.swift; sourceTree = ""; }; + A01175E3285F3F2800AC5CEC /* zxscannerUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = zxscannerUITestsLaunchTests.swift; sourceTree = ""; }; + A01175EB285F3F9900AC5CEC /* SnapshotHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SnapshotHelper.swift; path = fastlane/SnapshotHelper.swift; sourceTree = SOURCE_ROOT; }; A0B6EF4E2851EC3C0066415F /* Info-Debug.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Debug.plist"; sourceTree = ""; }; A0B6EF4F2851EC3C0066415F /* Info-Release.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Release.plist"; sourceTree = ""; }; A0FA27F02853CCDF00EBF9C5 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; @@ -60,6 +77,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A01175DC285F3F2800AC5CEC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -79,6 +103,7 @@ children = ( 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, + A01175E0285F3F2800AC5CEC /* zxscannerUITests */, 97C146EF1CF9000F007C117D /* Products */, C1F92D6E50E39FFA834789E9 /* Pods */, ED862C98908AC772A1DE46FC /* Frameworks */, @@ -89,6 +114,7 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, + A01175DF285F3F2800AC5CEC /* zxscannerUITests.xctest */, ); name = Products; sourceTree = ""; @@ -110,6 +136,16 @@ path = Runner; sourceTree = ""; }; + A01175E0285F3F2800AC5CEC /* zxscannerUITests */ = { + isa = PBXGroup; + children = ( + A01175EB285F3F9900AC5CEC /* SnapshotHelper.swift */, + A01175E1285F3F2800AC5CEC /* zxscannerUITests.swift */, + A01175E3285F3F2800AC5CEC /* zxscannerUITestsLaunchTests.swift */, + ); + path = zxscannerUITests; + sourceTree = ""; + }; C1F92D6E50E39FFA834789E9 /* Pods */ = { isa = PBXGroup; children = ( @@ -153,12 +189,31 @@ productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; }; + A01175DE285F3F2800AC5CEC /* zxscannerUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = A01175EA285F3F2800AC5CEC /* Build configuration list for PBXNativeTarget "zxscannerUITests" */; + buildPhases = ( + A01175DB285F3F2800AC5CEC /* Sources */, + A01175DC285F3F2800AC5CEC /* Frameworks */, + A01175DD285F3F2800AC5CEC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + A01175E6285F3F2800AC5CEC /* PBXTargetDependency */, + ); + name = zxscannerUITests; + productName = zxscannerUITests; + productReference = A01175DF285F3F2800AC5CEC /* zxscannerUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 1340; LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { @@ -166,6 +221,10 @@ CreatedOnToolsVersion = 7.3.1; LastSwiftMigration = 1100; }; + A01175DE285F3F2800AC5CEC = { + CreatedOnToolsVersion = 13.4.1; + TestTargetID = 97C146ED1CF9000F007C117D; + }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; @@ -182,6 +241,7 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, + A01175DE285F3F2800AC5CEC /* zxscannerUITests */, ); }; /* End PBXProject section */ @@ -198,6 +258,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A01175DD285F3F2800AC5CEC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -280,8 +347,26 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A01175DB285F3F2800AC5CEC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A01175E2285F3F2800AC5CEC /* zxscannerUITests.swift in Sources */, + A01175E4285F3F2800AC5CEC /* zxscannerUITestsLaunchTests.swift in Sources */, + A01175EC285F3F9900AC5CEC /* SnapshotHelper.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + A01175E6285F3F2800AC5CEC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = A01175E5285F3F2800AC5CEC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -532,6 +617,84 @@ }; name = Release; }; + A01175E7285F3F2800AC5CEC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + 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 = 1; + 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 = com.markosyan.zxscannerUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + 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 = Runner; + }; + name = Debug; + }; + A01175E8285F3F2800AC5CEC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + 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 = 1; + 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 = com.markosyan.zxscannerUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Runner; + }; + name = Release; + }; + A01175E9285F3F2800AC5CEC /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + 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 = 1; + 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 = com.markosyan.zxscannerUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Runner; + }; + name = Profile; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -555,6 +718,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + A01175EA285F3F2800AC5CEC /* Build configuration list for PBXNativeTarget "zxscannerUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01175E7285F3F2800AC5CEC /* Debug */, + A01175E8285F3F2800AC5CEC /* Release */, + A01175E9285F3F2800AC5CEC /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; diff --git a/zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/ZXScanner.xcscheme similarity index 87% rename from zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/ZXScanner.xcscheme index c87d15a..df12abc 100644 --- a/zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/zxscanner/ios/Runner.xcodeproj/xcshareddata/xcschemes/ZXScanner.xcscheme @@ -37,6 +37,16 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zxscanner/ios/fastlane/Appfile b/zxscanner/ios/fastlane/Appfile new file mode 100644 index 0000000..af45aa7 --- /dev/null +++ b/zxscanner/ios/fastlane/Appfile @@ -0,0 +1,8 @@ +app_identifier("com.markosyan.zxscanner") # The bundle identifier of your app +apple_id("xoren93@gmail.com") # Your Apple email address + +itc_team_id("119547301") # App Store Connect Team ID +team_id("RE853S4FBU") # Developer Portal Team ID + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/zxscanner/ios/fastlane/Fastfile b/zxscanner/ios/fastlane/Fastfile new file mode 100644 index 0000000..236dc67 --- /dev/null +++ b/zxscanner/ios/fastlane/Fastfile @@ -0,0 +1,25 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:ios) + +platform :ios do + desc "Generate new localized screenshots" + lane :screenshots do + capture_screenshots(workspace: "Runner.xcworkspace", scheme: "zxscannerUITests") + frameit # brew install imagemagick + # upload_to_app_store(skip_binary_upload: true, skip_metadata: true) + end +end diff --git a/zxscanner/ios/fastlane/README.md b/zxscanner/ios/fastlane/README.md new file mode 100644 index 0000000..a0e96bc --- /dev/null +++ b/zxscanner/ios/fastlane/README.md @@ -0,0 +1,32 @@ +fastlane documentation +---- + +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +```sh +xcode-select --install +``` + +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) + +# Available Actions + +## iOS + +### ios screenshots + +```sh +[bundle exec] fastlane ios screenshots +``` + +Generate new localized screenshots + +---- + +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/zxscanner/ios/fastlane/Snapfile b/zxscanner/ios/fastlane/Snapfile new file mode 100644 index 0000000..1d4d24b --- /dev/null +++ b/zxscanner/ios/fastlane/Snapfile @@ -0,0 +1,30 @@ +# 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 8 Plus", + "iPhone 13 Pro Max", + "iPad Pro (12.9-inch) (5th generation)" +]) + +# languages([ +# "en-US" +# ]) + +# The name of the scheme which contains the UI Tests +scheme("zxscannerUITests") + +# Where should the resulting screenshots be stored? +# output_directory("./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 diff --git a/zxscanner/ios/fastlane/SnapshotHelper.swift b/zxscanner/ios/fastlane/SnapshotHelper.swift new file mode 100644 index 0000000..0046aaa --- /dev/null +++ b/zxscanner/ios/fastlane/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/zxscanner/ios/fastlane/screenshots/background.jpg b/zxscanner/ios/fastlane/screenshots/background.jpg new file mode 100644 index 0000000000000000000000000000000000000000..83dc07c87c8a7c6c0f355704bf9e5211aa7b463d GIT binary patch literal 60058 zcmeHQ2UHYEx32C<RoL7b5w3xk+YSCKTJ4w+F*$hx``L>fWxp{q^mtud91R zw?$n*#f#&~0T_k>5BLK__dz;)MMM|?K0d$<03ZV>m>M8K34=cX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Xi{u9Dm2SnTwKH8*#y zbECGfomcNHN7|wG{23?a20M$xQws2|Y|a(z@Am6yPR}PwN*aRvdg$RUJbAVLnm|&( z{0yxcHx@MAQCja*dV+TY`(?8r$^ZG_`$*kkZWd9}a^|U-?t}E6!`PCAZ=SFs(_)Gp zdzpmkGOZdrO&_fyC$43`*TT--8ScBitcjhT&2{PF!2^am)7!MRx3prownSVft=*cYd02I^iWjiDkd< z)jbU*TH>90@2cKY&#X^s)HM2a%PDGUxwg%g6vA{Rw=j+y(j@lMU`a>cn--_RVq>D@ zK-}#Brz=_wf%xUh7j4O{n%$h3MnA%Iq|KH{^L!h^OX$#`Lxav5bk_V|4ruVvs}{7Z zQi`V^BXmS7LIGN04VN;ZSb(M=w-5?YEP&J`iUlYZG)YjfvXVmQvf{qV66Kh}WWF@fsO~0(7;Ka2Y5TNOdfba2W^%QjG!$mw`|q)hLi~83+YZ zjRFamflwgTD3EX&2nAA&0>l@f#de4T(xeyw literal 0 HcmV?d00001 diff --git a/zxscanner/ios/fastlane/screenshots/en-US/keyword.strings b/zxscanner/ios/fastlane/screenshots/en-US/keyword.strings new file mode 100644 index 0000000..62322cd --- /dev/null +++ b/zxscanner/ios/fastlane/screenshots/en-US/keyword.strings @@ -0,0 +1,3 @@ +"01_scanner_screen" = "SCAN"; +"02_creator_screen" = "CREATE"; +"03_help_screen" = "HELP"; \ No newline at end of file diff --git a/zxscanner/ios/fastlane/screenshots/en-US/title.strings b/zxscanner/ios/fastlane/screenshots/en-US/title.strings new file mode 100644 index 0000000..06e2b95 --- /dev/null +++ b/zxscanner/ios/fastlane/screenshots/en-US/title.strings @@ -0,0 +1,3 @@ +"01_scanner_screen" = "Scan Barcodes"; +"02_creator_screen" = "Create Your Barcodes"; +"03_help_screen" = "Introduction To Barcodes"; \ No newline at end of file diff --git a/zxscanner/ios/fastlane/screenshots/framefile.json b/zxscanner/ios/fastlane/screenshots/framefile.json new file mode 100644 index 0000000..b759f08 --- /dev/null +++ b/zxscanner/ios/fastlane/screenshots/framefile.json @@ -0,0 +1,35 @@ +{ + "device_frame_version": "latest", + "default": { + "title": { + "color": "#545454" + }, + "background": "./background.jpg", + "padding": 30, + "show_complete_frame": false, + "stack_title" : true, + "title_below_image": false, + "frame": "BLACK" + }, + + "data": [ + { + "filter": "01_scanner_screen", + "keyword": { + "color": "#BF382A" + } + }, + { + "filter": "02_creator_screen", + "keyword": { + "color": "#26AD5E" + } + }, + { + "filter": "03_help_screen", + "keyword": { + "color": "#394C82" + } + } + ] +} diff --git a/zxscanner/ios/zxscannerUITests/zxscannerUITests.swift b/zxscanner/ios/zxscannerUITests/zxscannerUITests.swift new file mode 100644 index 0000000..96e0408 --- /dev/null +++ b/zxscanner/ios/zxscannerUITests/zxscannerUITests.swift @@ -0,0 +1,69 @@ +// +// zxscannerUITests.swift +// zxscannerUITests +// +// Created by Khoren Markosyan on 19.06.22. +// + +import XCTest + +class zxscannerUITests: 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 testScreenshots() 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. + let element: XCUIElement + if UIDevice.current.userInterfaceIdiom == .phone { + element = app.windows.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element(boundBy: 1).children(matching: .other).element(boundBy: 1).children(matching: .other).element(boundBy: 1) + } else { + element = app.windows.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element(boundBy: 1).children(matching: .other).element(boundBy: 1).children(matching: .other).element(boundBy: 1) + } + + sleep(3) + snapshot("01_scanner_screen") + + element.children(matching: .other).element(boundBy: 2).tap() + sleep(3) +// snapshot("02_barcodes_screen") + + element.children(matching: .button).element.tap() + sleep(3) + snapshot("02_creator_screen") + + app.buttons["Back"].tap() + element.children(matching: .other).element(boundBy: 3).tap() + sleep(3) +// snapshot("04_history_screen") + + element.children(matching: .other).element(boundBy: 5).tap() + app.staticTexts["QR Code"].tap() + sleep(3) + snapshot("03_help_screen") + } + + 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/zxscanner/ios/zxscannerUITests/zxscannerUITestsLaunchTests.swift b/zxscanner/ios/zxscannerUITests/zxscannerUITestsLaunchTests.swift new file mode 100644 index 0000000..b0d6861 --- /dev/null +++ b/zxscanner/ios/zxscannerUITests/zxscannerUITestsLaunchTests.swift @@ -0,0 +1,32 @@ +// +// zxscannerUITestsLaunchTests.swift +// zxscannerUITests +// +// Created by Khoren Markosyan on 19.06.22. +// + +import XCTest + +class zxscannerUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + +// func testLaunch() throws { +// let app = XCUIApplication() +// app.launch() +// +// // Insert steps here to perform after app launch but before taking a screenshot, +// // such as logging into a test account or navigating somewhere in the app +// +// let attachment = XCTAttachment(screenshot: app.screenshot()) +// attachment.name = "Launch Screen" +// attachment.lifetime = .keepAlways +// add(attachment) +// } +} diff --git a/zxscanner/lib/pages/settings_page.dart b/zxscanner/lib/pages/settings_page.dart index 59f1edf..0efb936 100644 --- a/zxscanner/lib/pages/settings_page.dart +++ b/zxscanner/lib/pages/settings_page.dart @@ -46,16 +46,16 @@ class _SettingsPageState extends State { }, ), ), - SettingTile( - context, - leading: FontAwesomeIcons.globe, - title: S.current.settingsLanguageTitle, - trailing: LanguageWidget( - onChanged: (value) { - setState(() {}); - }, - ), - ), + // SettingTile( + // context, + // leading: FontAwesomeIcons.globe, + // title: S.current.settingsLanguageTitle, + // trailing: LanguageWidget( + // onChanged: (value) { + // setState(() {}); + // }, + // ), + // ), ], ), ),