From 25bfe34c1db427b04f0ef0451ee3847146165464 Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 15:02:30 -0800 Subject: [PATCH 01/34] touch ups needed to run all tests through query --- BUILD.bazel | 10 +--------- ios/test-utils/BUILD.bazel | 4 ++++ .../ViewInspector/ui-test/AssetFlowViewTests.swift | 14 +++++++++++++- .../unit-test/SwiftUIAssetUnitTestCaseTests.swift | 4 ++++ plugins/check-path/ios/BUILD.bazel | 2 +- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 5e72556fc..1c142a210 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,6 +1,5 @@ -# load("@rules_player//cocoapods:cocoapod.bzl", "assemble_pod", "pod_push") +# load("@rules_player//cocoapods:cocoapod.bzl", "pod_push") # load("@rules_player//internal:stamp.bzl", "stamp") -# load("//:generated.bzl", "PlayerUI", "PlayerUI_Demo", "ui_tests", "unit_tests") load("//tools/ios:util.bzl", "assemble_pod") load("@npm//:defs.bzl", "npm_link_all_packages") @@ -80,13 +79,6 @@ js_library( srcs = ["tsconfig.build.json"] + glob(["typings/*"]), visibility = ["//visibility:public"], ) -# PlayerUI(deps = []) - -# PlayerUI_Demo(deps = []) - -# unit_tests() - -# ui_tests() # # Update the version in the podspec # stamp( diff --git a/ios/test-utils/BUILD.bazel b/ios/test-utils/BUILD.bazel index 4c72743c7..b8b7d844d 100644 --- a/ios/test-utils/BUILD.bazel +++ b/ios/test-utils/BUILD.bazel @@ -46,8 +46,12 @@ ios_ui_test( "@swiftpkg_viewinspector//:Sources_ViewInspector", "//ios/swiftui:PlayerUISwiftUI", "//ios/core:PlayerUI", + "//ios/logger:PlayerUILogger", "//ios/internal-test-utils:PlayerUIInternalTestUtilities", "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + "//plugins/beacon/ios:PlayerUIBaseBeaconPlugin", + "//plugins/beacon/swiftui:PlayerUIBeaconPlugin", + "//plugins/common-types/ios:PlayerUICommonTypesPlugin", ":PlayerUITestUtilities" ], visibility = ["//visibility:public"], diff --git a/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift b/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift index 1658d0712..91999bda5 100644 --- a/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift +++ b/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift @@ -12,10 +12,22 @@ import SwiftUI import ViewInspector @testable import PlayerUI +@testable import PlayerUICommonTypesPlugin +@testable import PlayerUIBaseBeaconPlugin +@testable import PlayerUIBeaconPlugin +@testable import PlayerUIReferenceAssets +@testable import PlayerUITestUtilities +@testable import PlayerUITestUtilitiesCore +@testable import PlayerUISwiftUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIInternalTestUtilities extension AssetFlowView: Inspectable {} -class AssetFlowViewTests: ViewInspectorTestCase { +class AssetFlowViewTests: XCTestCase { + override func setUp() { + XCUIApplication().terminate() + } func testVersionBodies() throws { let flow = FlowData.COUNTER diff --git a/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift b/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift index 66d17793c..90e593520 100644 --- a/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift +++ b/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift @@ -13,6 +13,10 @@ import ViewInspector import XCTest @testable import PlayerUI +@testable import PlayerUILogger +@testable import PlayerUISwiftUI +@testable import PlayerUITestUtilities +@testable import PlayerUITestUtilitiesCore struct ExampleData: AssetData { var id: String diff --git a/plugins/check-path/ios/BUILD.bazel b/plugins/check-path/ios/BUILD.bazel index 957361b1c..d1ac74e2f 100644 --- a/plugins/check-path/ios/BUILD.bazel +++ b/plugins/check-path/ios/BUILD.bazel @@ -25,7 +25,7 @@ pkg_files( swift_library( name = "PlayerUICheckPathPlugin", module_name = "PlayerUICheckPathPlugin", - srcs = [":PlayerUICheckPathPlugin", ":CheckPathPluginResourceShim"], + srcs = [":PlayerUICheckPathPlugin_Sources", ":CheckPathPluginResourceShim"], visibility = ["//visibility:public"], deps = ["//ios/core:PlayerUI"], data = [":PlayerUICheckPathResourceBundle"], From 3bf29c18e84858b0f200117ced82c2e4232c7cf9 Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 15:02:54 -0800 Subject: [PATCH 02/34] try running all tests in circle --- .circleci/config.yml | 120 +++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f90d52be..d34ce91e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,9 +23,9 @@ executors: TZ: "/usr/share/zoneinfo/America/Los_Angeles" ios: working_directory: ~/player - resource_class: macos.x86.medium.gen2 + resource_class: macos.m1.medium.gen1 macos: - xcode: 14.3 + xcode: 15.0.0 environment: TZ: "/usr/share/zoneinfo/America/Los_Angeles" android: @@ -117,68 +117,68 @@ jobs: command: | HOMEBREW_NO_AUTO_UPDATE=1 brew install bazelisk maven openjdk@8 - - run: - name: Set Ruby Version - command: | - rbenv install 2.6.10 - rbenv global 2.6.10 - rbenv rehash - - - restore_cache: - keys: - - android-tools-{{ arch }}-{{ checksum "scripts/install-android-tools.sh" }} - - - run: echo 'export ANDROID_HOME=~/android-tools' >> $BASH_ENV - - - run: - name: Install Android tools - command: | - sh scripts/install-android-tools.sh - echo 'export ANDROID_SDK_HOME=$ANDROID_HOME' >> $BASH_ENV - echo 'export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk/21.4.7075529' >> $BASH_ENV - echo 'export PATH=$ANDROID_SDK_HOME/tools/bin:$PATH' >> $BASH_ENV - echo 'export PATH=$ANDROID_SDK_HOME/tools:$PATH' >> $BASH_ENV - echo 'export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH' >> $BASH_ENV - echo 'export PATH=$ANDROID_SDK_HOME/emulator:$PATH' >> $BASH_ENV - source $BASH_ENV - environment: - JAVA_HOME: /usr/local/opt/openjdk@8 - - - save_cache: - key: android-tools-{{ arch }}-{{ checksum "scripts/install-android-tools.sh" }} - paths: - - ~/android-tools - - - run: gem install bundler - - - restore_cache: - keys: - - gem-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} - - gem-v1-{{ arch }}-main-{{ checksum "Gemfile.lock" }} - - - run: bundle install - - - save_cache: - key: gem-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} - paths: - - ~/.gem/ruby/2.7.5 + # - restore_cache: + # keys: + # - android-tools-{{ arch }}-{{ checksum "scripts/install-android-tools.sh" }} + + # - run: echo 'export ANDROID_HOME=~/android-tools' >> $BASH_ENV + + # - run: + # name: Install Android tools + # command: | + # sh scripts/install-android-tools.sh + # echo 'export ANDROID_SDK_HOME=$ANDROID_HOME' >> $BASH_ENV + # echo 'export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk/21.4.7075529' >> $BASH_ENV + # echo 'export PATH=$ANDROID_SDK_HOME/tools/bin:$PATH' >> $BASH_ENV + # echo 'export PATH=$ANDROID_SDK_HOME/tools:$PATH' >> $BASH_ENV + # echo 'export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH' >> $BASH_ENV + # echo 'export PATH=$ANDROID_SDK_HOME/emulator:$PATH' >> $BASH_ENV + # source $BASH_ENV + # environment: + # JAVA_HOME: /usr/local/opt/openjdk@8 + + # - save_cache: + # key: android-tools-{{ arch }}-{{ checksum "scripts/install-android-tools.sh" }} + # paths: + # - ~/android-tools + + # - run: gem install bundler + + # - restore_cache: + # keys: + # - gem-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} + # - gem-v1-{{ arch }}-main-{{ checksum "Gemfile.lock" }} + + # - run: bundle install + + # - save_cache: + # key: gem-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} + # paths: + # - ~/.gem/ruby/2.7.5 - macos/preboot-simulator: - version: "15.5" + version: "17.0" platform: "iOS" - device: "iPhone 13" + device: "iPhone 15" - - run: bazel sync - - - run: | - BUNDLE_TARGETS=$(bazel query "attr(name, '^.*_Bundles$', //...)" --output label 2>/dev/null | tr '\n' ' ') - bazel build --config=ci $BUNDLE_TARGETS - - - run: bazel shutdown - - run: cd xcode && bundle exec pod install - - run: bazel build --config=ci -- //:PlayerUI //:PlayerUI-Demo //:PlayerUI_Pod - # TODO: the timeout should be added to the test itself - - run: bazel test --test_env=APPLITOOLS_API_KEY=${APPLITOOLS_API_KEY} --test_env=APPLITOOLS_BATCH_ID=${CIRCLE_SHA1} --test_env=APPLITOOLS_PR_NUMBER=${CIRCLE_PULL_REQUEST##*/} --test_timeout=1200 --jobs=1 --verbose_failures --config=ci -- //:PlayerUI-Unit-Unit //:PlayerUI-UI-ViewInspectorTests //:PlayerUI-UI-XCUITests + - run: bazel build --config=ci -- //ios/demo:PlayerUIDemo + - run: + name: Tests + command: | + bazel coverage \ + --config=ci \ + --jobs=2 \ + --experimental_use_llvm_covmap \ + --combined_report=lcov \ + --test_output=all \ + --test_env=APPLITOOLS_API_KEY=${APPLITOOLS_API_KEY} \ + --test_env=APPLITOOLS_BATCH_ID=${CIRCLE_SHA1} \ + --test_env=APPLITOOLS_PR_NUMBER=${CIRCLE_PULL_REQUEST##*/} \ + --test_timeout=1800 \ + $(bazel query "kind(ios_unit_test, //ios/...)") \ + $(bazel query "kind(ios_unit_test, //plugins/...)") \ + $(bazel query "kind(ios_ui_test, //ios/...)") \ + $(bazel query "kind(ios_ui_test, //plugins/...)") - run: when: always From 2cba784b1bec0958c09a3e05992e82c38c774f78 Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 15:05:11 -0800 Subject: [PATCH 03/34] fix indent --- .circleci/config.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d34ce91e3..95b2ecf34 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -163,22 +163,22 @@ jobs: - run: bazel build --config=ci -- //ios/demo:PlayerUIDemo - run: - name: Tests - command: | - bazel coverage \ - --config=ci \ - --jobs=2 \ - --experimental_use_llvm_covmap \ - --combined_report=lcov \ - --test_output=all \ - --test_env=APPLITOOLS_API_KEY=${APPLITOOLS_API_KEY} \ - --test_env=APPLITOOLS_BATCH_ID=${CIRCLE_SHA1} \ - --test_env=APPLITOOLS_PR_NUMBER=${CIRCLE_PULL_REQUEST##*/} \ - --test_timeout=1800 \ - $(bazel query "kind(ios_unit_test, //ios/...)") \ - $(bazel query "kind(ios_unit_test, //plugins/...)") \ - $(bazel query "kind(ios_ui_test, //ios/...)") \ - $(bazel query "kind(ios_ui_test, //plugins/...)") + name: Tests + command: | + bazel coverage \ + --config=ci \ + --jobs=2 \ + --experimental_use_llvm_covmap \ + --combined_report=lcov \ + --test_output=all \ + --test_env=APPLITOOLS_API_KEY=${APPLITOOLS_API_KEY} \ + --test_env=APPLITOOLS_BATCH_ID=${CIRCLE_SHA1} \ + --test_env=APPLITOOLS_PR_NUMBER=${CIRCLE_PULL_REQUEST##*/} \ + --test_timeout=1800 \ + $(bazel query "kind(ios_unit_test, //ios/...)") \ + $(bazel query "kind(ios_unit_test, //plugins/...)") \ + $(bazel query "kind(ios_ui_test, //ios/...)") \ + $(bazel query "kind(ios_ui_test, //plugins/...)") - run: when: always From fbc0ca6b68a15df946e9f4e09a0dc4ec636533ce Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 15:14:10 -0800 Subject: [PATCH 04/34] check homebrew path --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 95b2ecf34..2c3bafe3d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -112,6 +112,10 @@ jobs: - attach_workspace: at: ~/player + - run: + name: Debug Env + command: | + which brew - run: name: Homebrew Dependencies command: | From 0f5bae2d92f43ab74d6630a0f28288a729157bbb Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 15:25:36 -0800 Subject: [PATCH 05/34] update openjdk version --- .circleci/config.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c3bafe3d..4798ec5e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -112,14 +112,10 @@ jobs: - attach_workspace: at: ~/player - - run: - name: Debug Env - command: | - which brew - run: name: Homebrew Dependencies command: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install bazelisk maven openjdk@8 + HOMEBREW_NO_AUTO_UPDATE=1 brew install bazelisk maven openjdk@17 # - restore_cache: # keys: From 0447c10e2d1f2a476af0cba732877bf7936fdade Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 16:05:54 -0800 Subject: [PATCH 06/34] fix resource bundle for reference assets icon catalog --- plugins/reference-assets/swiftui/BUILD.bazel | 3 +- .../swiftui/Resources/BUILD.bazel | 2 +- .../Sources/Utilities/InternalAssets.swift | 9 +++- tools/ios/BUILD.bazel | 3 +- tools/ios/Info.plist | 41 +++++++++++++++++++ 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 tools/ios/Info.plist diff --git a/plugins/reference-assets/swiftui/BUILD.bazel b/plugins/reference-assets/swiftui/BUILD.bazel index f22d4b9ce..98366aa3c 100644 --- a/plugins/reference-assets/swiftui/BUILD.bazel +++ b/plugins/reference-assets/swiftui/BUILD.bazel @@ -11,7 +11,8 @@ apple_resource_bundle( name = "PlayerUIReferenceAssetsResourceBundle", bundle_name = "ReferenceAssets", bundle_id = "com.intuit.ios.player.resources.core", - resources = ["//plugins/reference-assets/swiftui/Resources:PlayerUIReferenceAssets_Resources", "//plugins/reference-assets/core:core_native_bundle"] + resources = ["//plugins/reference-assets/swiftui/Resources:PlayerUIReferenceAssets_Resources", "//plugins/reference-assets/core:core_native_bundle"], + infoplists = ["//tools/ios:Info.plist"] ) ios_bundle_module_shim("ReferenceAssets") diff --git a/plugins/reference-assets/swiftui/Resources/BUILD.bazel b/plugins/reference-assets/swiftui/Resources/BUILD.bazel index 44145e40e..c34c20443 100644 --- a/plugins/reference-assets/swiftui/Resources/BUILD.bazel +++ b/plugins/reference-assets/swiftui/Resources/BUILD.bazel @@ -2,7 +2,7 @@ load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") pkg_files( name = "PlayerUIReferenceAssets_Resources", - srcs = glob(["svg/**/*"]), + srcs = glob(["svg/*.xcassets/**/*"]), strip_prefix = strip_prefix.from_pkg(), visibility = ["//visibility:public"], ) \ No newline at end of file diff --git a/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift b/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift index b96992b7f..c34cb206b 100644 --- a/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift +++ b/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift @@ -28,8 +28,9 @@ class InternalAssets { - returns: A resized UIImage from the SVG */ static func getSVGOfSize(name: String, size: CGSize? = nil) -> UIImage? { + print(InternalAssets.bundleURL?.absoluteString) guard - let url = Bundle(for: InternalAssets.self).resourceURL?.appendingPathComponent("ReferenceAssets.bundle"), + let url = InternalAssets.bundleURL, let bundle = Bundle(url: url) else { return nil } let image = UIImage(named: name, in: bundle, with: .none) @@ -40,6 +41,12 @@ class InternalAssets { return image?.withRenderingMode(.alwaysTemplate) } + + #if SWIFT_PACKAGE + static var bundleURL: URL? { Bundle.module.resourceURL } + #else + static var bundleURL: URL? { Bundle(for: InternalAssets.self).resourceURL?.appendingPathComponent("ReferenceAssets.bundle") } + #endif } extension UIImage { diff --git a/tools/ios/BUILD.bazel b/tools/ios/BUILD.bazel index 0da427379..846f94855 100644 --- a/tools/ios/BUILD.bazel +++ b/tools/ios/BUILD.bazel @@ -1,3 +1,4 @@ exports_files([ - "ResourceShimTemplate.swift" + "ResourceShimTemplate.swift", + "Info.plist" ]) \ No newline at end of file diff --git a/tools/ios/Info.plist b/tools/ios/Info.plist new file mode 100644 index 000000000..23f4271da --- /dev/null +++ b/tools/ios/Info.plist @@ -0,0 +1,41 @@ + + + + + CFBundleIdentifier + com.intuit.ios.player.ReferenceAssets + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ReferenceAssets + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 20E238 + DTPlatformName + iphonesimulator + DTPlatformVersion + 16.4 + DTSDKBuild + 20E238 + DTSDKName + iphonesimulator16.4 + DTXcode + 1431 + DTXcodeBuild + 14E300c + MinimumOSVersion + 13.0 + UIDeviceFamily + + 1 + 2 + + + \ No newline at end of file From 1e17870ee9458a9911ff6ba4bfc05e286b05fdaa Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 16:07:11 -0800 Subject: [PATCH 07/34] lower to serial test running, builds are getting interuptted with 2 --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4798ec5e6..8e68f5511 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -135,7 +135,7 @@ jobs: # echo 'export PATH=$ANDROID_SDK_HOME/emulator:$PATH' >> $BASH_ENV # source $BASH_ENV # environment: - # JAVA_HOME: /usr/local/opt/openjdk@8 + # JAVA_HOME: /opt/homebrew/opt/openjdk@17 # - save_cache: # key: android-tools-{{ arch }}-{{ checksum "scripts/install-android-tools.sh" }} @@ -167,7 +167,7 @@ jobs: command: | bazel coverage \ --config=ci \ - --jobs=2 \ + --jobs=1 \ --experimental_use_llvm_covmap \ --combined_report=lcov \ --test_output=all \ From 51829e2559f48697095224efdbdce9410654331b Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 11 Dec 2023 16:30:53 -0800 Subject: [PATCH 08/34] prebuild test modules before running tests --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e68f5511..40f562678 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -162,6 +162,16 @@ jobs: device: "iPhone 15" - run: bazel build --config=ci -- //ios/demo:PlayerUIDemo + + - run: + name: Test Prebuild + command: | + bazel build \ + --config=ci \ + $(bazel query "kind(ios_unit_test, //ios/...)") \ + $(bazel query "kind(ios_unit_test, //plugins/...)") \ + $(bazel query "kind(ios_ui_test, //ios/...)") \ + $(bazel query "kind(ios_ui_test, //plugins/...)") - run: name: Tests command: | From 37b4d544d1085035696f9fc032f95b3285ded8f2 Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 12 Dec 2023 11:11:01 -0800 Subject: [PATCH 09/34] remove print --- .../swiftui/Sources/Utilities/InternalAssets.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift b/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift index c34cb206b..c2aab7a1e 100644 --- a/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift +++ b/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift @@ -28,7 +28,6 @@ class InternalAssets { - returns: A resized UIImage from the SVG */ static func getSVGOfSize(name: String, size: CGSize? = nil) -> UIImage? { - print(InternalAssets.bundleURL?.absoluteString) guard let url = InternalAssets.bundleURL, let bundle = Bundle(url: url) else { return nil } From 76ae1ac802151b9978e56bcbb3df4d1318451647 Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 12 Dec 2023 11:11:06 -0800 Subject: [PATCH 10/34] try large executor --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40f562678..b4c67befd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ executors: TZ: "/usr/share/zoneinfo/America/Los_Angeles" ios: working_directory: ~/player - resource_class: macos.m1.medium.gen1 + resource_class: macos.m1.lerge.gen1 macos: xcode: 15.0.0 environment: From 3fd8d5794aecc8ebdb52d95fafe16ed3e611f85f Mon Sep 17 00:00:00 2001 From: hborawski Date: Thu, 7 Mar 2024 09:00:26 -0800 Subject: [PATCH 11/34] update swift package deps --- swift_deps.bzl | 2 +- swift_deps_index.json | 4 ++-- xcode/Package.resolved | 4 ++-- xcode/Package.swift | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/swift_deps.bzl b/swift_deps.bzl index 44e885f1c..b293d65f3 100644 --- a/swift_deps.bzl +++ b/swift_deps.bzl @@ -12,7 +12,7 @@ def swift_dependencies(): # version: 8.9.1 swift_package( name = "swiftpkg_eyes_xcui_swift_package", - commit = "ba8bc9221d1f5ca733d794d9c85ad017df9e0423", + commit = "8e968bc753f298bdc8836dae95ef8862bb6fa4bc", dependencies_index = "@//:swift_deps_index.json", remote = "https://github.com/applitools/eyes-xcui-swift-package.git", ) diff --git a/swift_deps_index.json b/swift_deps_index.json index f33b0831b..485f6488e 100644 --- a/swift_deps_index.json +++ b/swift_deps_index.json @@ -388,9 +388,9 @@ "name": "swiftpkg_eyes_xcui_swift_package", "identity": "eyes-xcui-swift-package", "remote": { - "commit": "ba8bc9221d1f5ca733d794d9c85ad017df9e0423", + "commit": "8e968bc753f298bdc8836dae95ef8862bb6fa4bc", "remote": "https://github.com/applitools/eyes-xcui-swift-package.git", - "version": "8.9.1" + "version": "8.11.0" } }, { diff --git a/xcode/Package.resolved b/xcode/Package.resolved index f2a27e95f..a3f5075e2 100644 --- a/xcode/Package.resolved +++ b/xcode/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/applitools/eyes-xcui-swift-package.git", "state" : { - "revision" : "ba8bc9221d1f5ca733d794d9c85ad017df9e0423", - "version" : "8.9.1" + "revision" : "8e968bc753f298bdc8836dae95ef8862bb6fa4bc", + "version" : "8.11.0" } }, { diff --git a/xcode/Package.swift b/xcode/Package.swift index 3cde9e82a..2e8ccfa5d 100644 --- a/xcode/Package.swift +++ b/xcode/Package.swift @@ -25,7 +25,7 @@ let package = Package( .package(url: "https://github.com/yonaskolb/XcodeGen.git", .upToNextMajor(from: "2.38.0")), // Testing - .package(url: "https://github.com/applitools/eyes-xcui-swift-package.git", exact: "8.9.1"), + .package(url: "https://github.com/applitools/eyes-xcui-swift-package.git", exact: "8.11.0"), .package(url: "https://github.com/nalexn/viewinspector.git", .upToNextMajor(from: "0.9.7")) ], targets: [] From b97a63bb1c68a9948221521c20bd1438c315123f Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 26 Mar 2024 10:07:19 -0700 Subject: [PATCH 12/34] fix resource class --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b4c67befd..f094362d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ executors: TZ: "/usr/share/zoneinfo/America/Los_Angeles" ios: working_directory: ~/player - resource_class: macos.m1.lerge.gen1 + resource_class: macos.m1.large.gen1 macos: xcode: 15.0.0 environment: From 9c66cba45b266861f12e828079683351421727d4 Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 26 Mar 2024 16:48:59 -0700 Subject: [PATCH 13/34] update xcode/macos --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f094362d2..b2b5c2dff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ executors: working_directory: ~/player resource_class: macos.m1.large.gen1 macos: - xcode: 15.0.0 + xcode: 15.1.0 environment: TZ: "/usr/share/zoneinfo/America/Los_Angeles" android: @@ -177,7 +177,7 @@ jobs: command: | bazel coverage \ --config=ci \ - --jobs=1 \ + --jobs=2 \ --experimental_use_llvm_covmap \ --combined_report=lcov \ --test_output=all \ From 05af2827ab29e7675e5f21976c3768f46fa1e08b Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 26 Mar 2024 16:57:42 -0700 Subject: [PATCH 14/34] update xcode/macos --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b2b5c2dff..5b03b04d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ executors: working_directory: ~/player resource_class: macos.m1.large.gen1 macos: - xcode: 15.1.0 + xcode: 15.3.0 environment: TZ: "/usr/share/zoneinfo/America/Los_Angeles" android: @@ -157,7 +157,7 @@ jobs: # - ~/.gem/ruby/2.7.5 - macos/preboot-simulator: - version: "17.0" + version: "17.4" platform: "iOS" device: "iPhone 15" From e56db3aafea832494ea6d19f17191a9284536941 Mon Sep 17 00:00:00 2001 From: hborawski Date: Wed, 27 Mar 2024 09:21:50 -0700 Subject: [PATCH 15/34] disable cache temporarily to test cold start build time --- .bazelrc | 6 +++--- .circleci/config.yml | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.bazelrc b/.bazelrc index aad24e953..d9b1d90e4 100644 --- a/.bazelrc +++ b/.bazelrc @@ -2,9 +2,9 @@ common --enable_bzlmod test --test_output=errors -build:ci --experimental_remote_cache_compression --experimental_remote_cache_async -test:ci --experimental_remote_cache_compression --experimental_remote_cache_async -coverage:ci --experimental_remote_cache_compression --experimental_remote_cache_async +# build:ci --experimental_remote_cache_compression --experimental_remote_cache_async +# test:ci --experimental_remote_cache_compression --experimental_remote_cache_async +# coverage:ci --experimental_remote_cache_compression --experimental_remote_cache_async # TODO: Migrate away from managed directories (https://github.com/bazelbuild/bazel/issues/15463) # TODO: Re-upgrade to Bazel 6.+ diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b03b04d4..96a7c28f8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,9 +80,7 @@ jobs: - attach_workspace: at: ~/player - run: | - echo "build --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}" >> .bazelrc.local - echo "test --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}" >> .bazelrc.local - echo "coverage --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}" >> .bazelrc.local + echo 'Skipping' - persist_to_workspace: root: . paths: From e80ac9ad2512b92432923331d533b5c78658c53d Mon Sep 17 00:00:00 2001 From: hborawski Date: Wed, 27 Mar 2024 09:40:26 -0700 Subject: [PATCH 16/34] clean bazel and cache to really test cold start --- .circleci/config.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 96a7c28f8..40147db06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -159,6 +159,12 @@ jobs: platform: "iOS" device: "iPhone 15" + - run: + name: Clean Bazel + command: | + bazel clean --expunge + rm -r $(bazel info repository_cache) + - run: bazel build --config=ci -- //ios/demo:PlayerUIDemo - run: From 3c568ec7ea0bedf606ce0c9c10d1c2e08af99723 Mon Sep 17 00:00:00 2001 From: hborawski Date: Wed, 27 Mar 2024 09:41:03 -0700 Subject: [PATCH 17/34] clean bazel and cache to really test cold start --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40147db06..2fbe5e2f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -160,10 +160,10 @@ jobs: device: "iPhone 15" - run: - name: Clean Bazel - command: | - bazel clean --expunge - rm -r $(bazel info repository_cache) + name: Clean Bazel + command: | + bazel clean --expunge + rm -r $(bazel info repository_cache) - run: bazel build --config=ci -- //ios/demo:PlayerUIDemo From 0f421ab5e15f6af61ccc690d140aa2064582047e Mon Sep 17 00:00:00 2001 From: hborawski Date: Wed, 27 Mar 2024 10:46:55 -0700 Subject: [PATCH 18/34] log out size of cache before / after clearing --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2fbe5e2f0..69df91d10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -162,8 +162,10 @@ jobs: - run: name: Clean Bazel command: | + du -sh $(bazel info repository_cache) bazel clean --expunge rm -r $(bazel info repository_cache) + du -sh $(bazel info repository_cache) - run: bazel build --config=ci -- //ios/demo:PlayerUIDemo From 33c74170d692cf096aba50f5ec17fe5a497c468e Mon Sep 17 00:00:00 2001 From: hborawski Date: Thu, 28 Mar 2024 09:56:45 -0700 Subject: [PATCH 19/34] reenable cache, speed improvements seem fine with no cache --- .bazelrc | 6 +++--- .circleci/config.yml | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.bazelrc b/.bazelrc index d9b1d90e4..aad24e953 100644 --- a/.bazelrc +++ b/.bazelrc @@ -2,9 +2,9 @@ common --enable_bzlmod test --test_output=errors -# build:ci --experimental_remote_cache_compression --experimental_remote_cache_async -# test:ci --experimental_remote_cache_compression --experimental_remote_cache_async -# coverage:ci --experimental_remote_cache_compression --experimental_remote_cache_async +build:ci --experimental_remote_cache_compression --experimental_remote_cache_async +test:ci --experimental_remote_cache_compression --experimental_remote_cache_async +coverage:ci --experimental_remote_cache_compression --experimental_remote_cache_async # TODO: Migrate away from managed directories (https://github.com/bazelbuild/bazel/issues/15463) # TODO: Re-upgrade to Bazel 6.+ diff --git a/.circleci/config.yml b/.circleci/config.yml index 69df91d10..5b03b04d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,7 +80,9 @@ jobs: - attach_workspace: at: ~/player - run: | - echo 'Skipping' + echo "build --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}" >> .bazelrc.local + echo "test --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}" >> .bazelrc.local + echo "coverage --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}" >> .bazelrc.local - persist_to_workspace: root: . paths: @@ -159,14 +161,6 @@ jobs: platform: "iOS" device: "iPhone 15" - - run: - name: Clean Bazel - command: | - du -sh $(bazel info repository_cache) - bazel clean --expunge - rm -r $(bazel info repository_cache) - du -sh $(bazel info repository_cache) - - run: bazel build --config=ci -- //ios/demo:PlayerUIDemo - run: From 275f44bc8a00f2bb2eec007795c3f5ab7c545bf4 Mon Sep 17 00:00:00 2001 From: hborawski Date: Thu, 28 Mar 2024 13:03:45 -0700 Subject: [PATCH 20/34] fix some tests that had deps removed during conversion --- ios/core/Tests/utilities/ErrorUtilitiesTests.swift | 2 +- ios/swiftui/Tests/SwiftUIRegistryTests.swift | 2 +- ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/core/Tests/utilities/ErrorUtilitiesTests.swift b/ios/core/Tests/utilities/ErrorUtilitiesTests.swift index 8ef8c5c4b..5fa99f8ab 100644 --- a/ios/core/Tests/utilities/ErrorUtilitiesTests.swift +++ b/ios/core/Tests/utilities/ErrorUtilitiesTests.swift @@ -35,7 +35,7 @@ class ErrorUtilitiesTestCase: XCTestCase { XCTFail("DecodingError expected") } catch { let message = error.playerDescription - XCTAssertEqual(message, "Expected to decode Int but found a string/data instead. (coding path bar.bbb)") + XCTAssertEqual(message, "Expected to decode Int but found a string instead. (coding path bar.bbb)") } // keyNotFound diff --git a/ios/swiftui/Tests/SwiftUIRegistryTests.swift b/ios/swiftui/Tests/SwiftUIRegistryTests.swift index 802d2cc60..23e4d78f8 100644 --- a/ios/swiftui/Tests/SwiftUIRegistryTests.swift +++ b/ios/swiftui/Tests/SwiftUIRegistryTests.swift @@ -251,7 +251,7 @@ class SwiftUIRegistryTests: XCTestCase { partialMatch.context = context partialMatch.setMapping(assetId: "someId", index: 0) let registry = SwiftUIRegistry(logger: TapableLogger()) - registry.register("text", asset: TextAsset.self) + registry.register("text", asset: SwiftUITestAsset.self) registry.partialMatchRegistry = partialMatch XCTAssertNil(registry.root) diff --git a/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift b/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift index fa0a475dd..de5071e1d 100644 --- a/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift +++ b/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift @@ -24,7 +24,7 @@ class SwiftUIPlayerTests: XCTestCase { func testFlowLoads() throws { var bag = Set() let context = SwiftUIPlayer.Context { JSContext() } - let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [], context: context) + let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [ReferenceAssetsPlugin()], context: context) let initialLoad = expectation(description: "Root loaded") player.assetRegistry.$root.sink { (asset) in @@ -65,7 +65,7 @@ class SwiftUIPlayerTests: XCTestCase { func testViewHook() throws { var bag = Set() - let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [ViewHookPlugin()]) + let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [ReferenceAssetsPlugin(), ViewHookPlugin()]) let initialLoad = expectation(description: "Root loaded") player.assetRegistry.$root.sink { (asset) in From 7a8e99fa90b8d36d47c181f67b8c6589bc23730f Mon Sep 17 00:00:00 2001 From: hborawski Date: Fri, 29 Mar 2024 09:44:27 -0700 Subject: [PATCH 21/34] update viewinspector to latest --- swift_deps.bzl | 2 +- swift_deps_index.json | 4 ++-- xcode/Package.resolved | 4 ++-- xcode/Package.swift | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/swift_deps.bzl b/swift_deps.bzl index b293d65f3..dcd649317 100644 --- a/swift_deps.bzl +++ b/swift_deps.bzl @@ -84,7 +84,7 @@ def swift_dependencies(): # version: 0.9.8 swift_package( name = "swiftpkg_viewinspector", - commit = "07c090d73e0169c342a4ed46e9010be2781eca1e", + commit = "67319287749b83f39dcc2f20edd520c610c012fd", dependencies_index = "@//:swift_deps_index.json", remote = "https://github.com/nalexn/ViewInspector", ) diff --git a/swift_deps_index.json b/swift_deps_index.json index 485f6488e..8357fd31b 100644 --- a/swift_deps_index.json +++ b/swift_deps_index.json @@ -469,9 +469,9 @@ "name": "swiftpkg_viewinspector", "identity": "viewinspector", "remote": { - "commit": "07c090d73e0169c342a4ed46e9010be2781eca1e", + "commit": "67319287749b83f39dcc2f20edd520c610c012fd", "remote": "https://github.com/nalexn/ViewInspector", - "version": "0.9.8" + "version": "0.9.10" } }, { diff --git a/xcode/Package.resolved b/xcode/Package.resolved index a3f5075e2..298e16d59 100644 --- a/xcode/Package.resolved +++ b/xcode/Package.resolved @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/nalexn/ViewInspector", "state" : { - "revision" : "07c090d73e0169c342a4ed46e9010be2781eca1e", - "version" : "0.9.8" + "revision" : "67319287749b83f39dcc2f20edd520c610c012fd", + "version" : "0.9.10" } }, { diff --git a/xcode/Package.swift b/xcode/Package.swift index 2e8ccfa5d..2a5faab9c 100644 --- a/xcode/Package.swift +++ b/xcode/Package.swift @@ -26,7 +26,7 @@ let package = Package( // Testing .package(url: "https://github.com/applitools/eyes-xcui-swift-package.git", exact: "8.11.0"), - .package(url: "https://github.com/nalexn/viewinspector.git", .upToNextMajor(from: "0.9.7")) + .package(url: "https://github.com/nalexn/viewinspector.git", .upToNextMajor(from: "0.9.10")) ], targets: [] ) From 4f92efebe46c9ea54b8a6dd5556ebe2c4439e5e5 Mon Sep 17 00:00:00 2001 From: hborawski Date: Fri, 29 Mar 2024 11:56:56 -0700 Subject: [PATCH 22/34] remove applitools from UITests --- .circleci/config.yml | 3 - MODULE.bazel | 3 +- plugins/reference-assets/swiftui/BUILD.bazel | 1 - .../swiftui/UITests/ActionAssetUITests.swift | 48 +- .../swiftui/UITests/BaseTestCase.swift | 79 ---- .../UITests/CollectionAssetUITests.swift | 14 +- .../swiftui/UITests/InfoAssetUITests.swift | 12 +- .../swiftui/UITests/InputAssetUITests.swift | 53 +-- .../swiftui/UITests/TextAssetUITests.swift | 14 +- swift_deps_index.json | 440 +----------------- xcode/Package.resolved | 108 ----- xcode/Package.swift | 7 +- 12 files changed, 63 insertions(+), 719 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b03b04d4..a1279afe8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -181,9 +181,6 @@ jobs: --experimental_use_llvm_covmap \ --combined_report=lcov \ --test_output=all \ - --test_env=APPLITOOLS_API_KEY=${APPLITOOLS_API_KEY} \ - --test_env=APPLITOOLS_BATCH_ID=${CIRCLE_SHA1} \ - --test_env=APPLITOOLS_PR_NUMBER=${CIRCLE_PULL_REQUEST##*/} \ --test_timeout=1800 \ $(bazel query "kind(ios_unit_test, //ios/...)") \ $(bazel query "kind(ios_unit_test, //plugins/...)") \ diff --git a/MODULE.bazel b/MODULE.bazel index 4a6e2e678..dddd4031a 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -44,8 +44,7 @@ swift_deps.from_file( use_repo( swift_deps, "swiftpkg_swift_hooks", - "swiftpkg_viewinspector", - "swiftpkg_eyes_xcui_swift_package", + "swiftpkg_viewinspector" ) # end iOS diff --git a/plugins/reference-assets/swiftui/BUILD.bazel b/plugins/reference-assets/swiftui/BUILD.bazel index 98366aa3c..be2f6d8ec 100644 --- a/plugins/reference-assets/swiftui/BUILD.bazel +++ b/plugins/reference-assets/swiftui/BUILD.bazel @@ -70,7 +70,6 @@ ios_ui_test( srcs = glob(["UITests/**/*.swift"]), minimum_os_version = "14.0", deps = [ - "@swiftpkg_eyes_xcui_swift_package//:remote_archive_EyesXCUI.xcframework.zip_EyesXCUI", "//ios/swiftui:PlayerUISwiftUI", "//ios/core:PlayerUI", "//ios/test-utils:PlayerUITestUtilities", diff --git a/plugins/reference-assets/swiftui/UITests/ActionAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/ActionAssetUITests.swift index 83004824d..b0c321cb0 100644 --- a/plugins/reference-assets/swiftui/UITests/ActionAssetUITests.swift +++ b/plugins/reference-assets/swiftui/UITests/ActionAssetUITests.swift @@ -1,49 +1,41 @@ import XCTest -import EyesXCUI class ActionAssetUITests: BaseTestCase { func testActionCounter() { - withEyes("action counter") { check in - waitFor(app.buttons["action"]) - check("Page Load") + openFlow("action counter") + waitFor(app.buttons["action"]) - tap(app.buttons["action"]) - waitFor(app.buttons["action"]) + waitAndTap(app.buttons["action"]) + waitFor(app.buttons["action"]) - let buttonText = app.buttons["action"].label + let buttonText = app.buttons["action"].label - check("After Click") - XCTAssertEqual(buttonText, "Clicked 1 times") - } + XCTAssertEqual(buttonText, "Clicked 1 times") } func testActionTransitionSuccess() { - withEyes("action transition to end", testName: "action transition to end - success") { check in - waitFor(app.buttons["action-good"]) - check("Page Load") + openFlow("action transition to end") + waitFor(app.buttons["action-good"]) - tap(app.buttons["action-good"]) + waitAndTap(app.buttons["action-good"]) - waitFor(app.alerts["Flow Finished"]) - check("After Click") - XCTAssertTrue(app.alerts["Flow Finished"].exists) + waitFor(app.alerts["Flow Finished"]) - XCTAssertEqual(app.alerts["Flow Finished"].staticTexts.element(boundBy: 1).label, "done") - } + XCTAssertTrue(app.alerts["Flow Finished"].exists) + + XCTAssertTrue(app.alerts["Flow Finished"].staticTexts.element(boundBy: 1).label.contains("done")) } func testActionTransitionError() { - withEyes("action transition to end", testName: "action transition to end - error") { check in - waitFor(app.buttons["action-bad"]) - check("Page Load") + openFlow("action transition to end") + waitFor(app.buttons["action-bad"]) + + waitAndTap(app.buttons["action-bad"]) - tap(app.buttons["action-bad"]) + waitFor(app.alerts["Flow Finished"]) - waitFor(app.alerts["Flow Finished"]) - check("After Click") - XCTAssertTrue(app.alerts["Flow Finished"].exists) + XCTAssertTrue(app.alerts["Flow Finished"].exists) - XCTAssertTrue(app.alerts["Flow Finished"].staticTexts.element(boundBy: 1).label.contains("Unclosed brace")) - } + XCTAssertTrue(app.alerts["Flow Finished"].staticTexts.element(boundBy: 1).label.contains("Unclosed brace")) } } diff --git a/plugins/reference-assets/swiftui/UITests/BaseTestCase.swift b/plugins/reference-assets/swiftui/UITests/BaseTestCase.swift index e80030ff2..7250b9ea7 100644 --- a/plugins/reference-assets/swiftui/UITests/BaseTestCase.swift +++ b/plugins/reference-assets/swiftui/UITests/BaseTestCase.swift @@ -8,85 +8,12 @@ import Foundation import XCTest -import EyesXCUI import PlayerUI import PlayerUITestUtilities import PlayerUITestUtilitiesCore import Combine class BaseTestCase: AssetUITestCase { - private var eyes = Eyes() - var key: String? - - func envOrDefault(_ key: String, fallback: String = "local") -> String { - guard let value = fromEnv(key) else { - print("Unable to fetch \(key) from the environment. Using fallback value: \(fallback)") - return fallback - } - return value - } - - func fromEnv(_ key: String) -> String? { - guard - let value = ProcessInfo.processInfo.environment[key], - !value.isEmpty, - value != "$(\(key))" - else { - return nil - } - return value - } - - override func setUp() { - continueAfterFailure = false - eyes.serverURL = "https://intuiteyesapi.applitools.com" - - let prNumber = envOrDefault("APPLITOOLS_PR_NUMBER") - let batchId = envOrDefault("APPLITOOLS_BATCH_ID") - if let key = fromEnv("APPLITOOLS_API_KEY") { - eyes.apiKey = key - self.key = key - } else { - print("Unable to fetch APPLITOOLS_API_KEY from environment") - } - - let info = BatchInfo(name: "reference-assets@\(prNumber)") - info?.batchId = batchId - eyes.addProperty("platform", value: "ios") - eyes.batch = info - - eyes.configuration.appName = "iOS Reference Assets" - - super.setUp() - } - - override func tearDown() { - super.tearDown() - guard key != nil else { return } - do { - try eyes.close() - } catch { - eyes.abortIfNotClosed() - } - } - - func withEyes(_ mockName: String, testName: String? = nil, body: (ApplitoolsCheck) -> Void) { - openFlow(mockName) - guard key != nil else { return body({ _ in }) } - eyes.open(withApplicationName: "iOS Reference Assets", testName: "\(testName ?? mockName)") - body({ tag in - XCTWaiter.delay() - eyes.checkApp(withTag: tag) - }) - } - - func withOutEyes(_ mockName: String, body: () -> Void) { - openFlow(mockName) - body() - } - - public typealias ApplitoolsCheck = (String) -> Void - // AssetCollectionView uses a List which wont register elements if they aren't on screen override func openFlow(_ mockName: String) { guard !app.buttons[mockName].exists else { return super.openFlow(mockName) } @@ -103,12 +30,6 @@ class BaseTestCase: AssetUITestCase { } } -extension Eyes { - func checkApp(withTag tag: String) { - self.check(withTag: "[iOS] \(tag)", andSettings: Target.window().statusBarExists(true)) - } -} - extension XCTWaiter { @discardableResult static func delay(ms duration: TimeInterval = 0.5) -> XCTWaiter.Result { diff --git a/plugins/reference-assets/swiftui/UITests/CollectionAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/CollectionAssetUITests.swift index a00e39b7d..e15c4fc05 100644 --- a/plugins/reference-assets/swiftui/UITests/CollectionAssetUITests.swift +++ b/plugins/reference-assets/swiftui/UITests/CollectionAssetUITests.swift @@ -2,14 +2,12 @@ import XCTest class CollectionAssetUITests: BaseTestCase { func testBasicCollection() { - withEyes("collection basic") { check in - waitFor(app.otherElements["view-1"]) - check("Page Load") - let value1 = app.staticTexts["text-1"].label - let value2 = app.staticTexts["text-2"].label + openFlow("collection basic") + waitFor(app.otherElements["view-1"]) + let value1 = app.staticTexts["text-1"].label + let value2 = app.staticTexts["text-2"].label - XCTAssertEqual(value1, "This is the first item in the collection") - XCTAssertEqual(value2, "This is the second item in the collection") - } + XCTAssertEqual(value1, "This is the first item in the collection") + XCTAssertEqual(value2, "This is the second item in the collection") } } diff --git a/plugins/reference-assets/swiftui/UITests/InfoAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/InfoAssetUITests.swift index aaf0460ca..6df2908aa 100644 --- a/plugins/reference-assets/swiftui/UITests/InfoAssetUITests.swift +++ b/plugins/reference-assets/swiftui/UITests/InfoAssetUITests.swift @@ -3,14 +3,14 @@ import XCTest class InfoAssetUITests: BaseTestCase { func testInfoBasic() { - withEyes("info basic") { check in - waitFor(app.buttons["next-action"]) + openFlow("info basic") + waitFor(app.buttons["next-action"]) - check("Page Load") + tap(app.buttons["next-action"]) - tap(app.buttons["next-action"]) + XCTAssertTrue(app.alerts["Flow Finished"].exists) + + XCTAssertTrue(app.alerts["Flow Finished"].staticTexts.element(boundBy: 1).label.contains("done")) - check("Flow End") - } } } diff --git a/plugins/reference-assets/swiftui/UITests/InputAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/InputAssetUITests.swift index c49410930..8c2a975aa 100644 --- a/plugins/reference-assets/swiftui/UITests/InputAssetUITests.swift +++ b/plugins/reference-assets/swiftui/UITests/InputAssetUITests.swift @@ -2,49 +2,40 @@ import XCTest class InputAssetUITests: BaseTestCase { func testBasicInput() { - withEyes("input basic") { check in - let enteredValue = "Hello World" + openFlow("input basic") + let enteredValue = "Hello World" - waitFor(app.textFields["input"]) - check("Page Load") - app.textFields["input"].firstMatch.tap() - app.textFields["input"].firstMatch.typeText(enteredValue) - app.textFields["input"].firstMatch.typeText("\n") + waitFor(app.textFields["input"]) - waitFor(app.textFields["input"]) + app.textFields["input"].firstMatch.tap() + app.textFields["input"].firstMatch.typeText(enteredValue) + app.textFields["input"].firstMatch.typeText("\n") - check("Text Entered") + waitFor(app.textFields["input"]) - let labelValue = app.textFields["input"].firstMatch.value as? String + let labelValue = app.textFields["input"].firstMatch.value as? String - XCTAssertEqual(labelValue, enteredValue) - } + XCTAssertEqual(labelValue, enteredValue) } func testInputValidation() { - withEyes("input validation") { check in - let enteredValue = "Hello World" + openFlow("input validation") + let enteredValue = "Hello World" - waitFor(app.textFields["input-1"]) + waitFor(app.textFields["input-1"]) - check("Page Load") + app.textFields["input-1"].firstMatch.tap() + app.textFields["input-1"].firstMatch.typeText(enteredValue) + app.textFields["input-1"].firstMatch.typeText("\n") - app.textFields["input-1"].firstMatch.tap() - app.textFields["input-1"].firstMatch.typeText(enteredValue) - app.textFields["input-1"].firstMatch.typeText("\n") + waitFor(app.textFields["input-1"]) + XCTAssertTrue(app.staticTexts["input-1-validation"].firstMatch.exists) - waitFor(app.textFields["input-1"]) - XCTAssertTrue(app.staticTexts["input-1-validation"].firstMatch.exists) + app.textFields["input-1"].firstMatch.tap() + app.textFields["input-1"].firstMatch.typeText("55") + app.textFields["input-1"].firstMatch.typeText("\n") - check("input 1 validation active") - - app.textFields["input-1"].firstMatch.tap() - app.textFields["input-1"].firstMatch.typeText("55") - app.textFields["input-1"].firstMatch.typeText("\n") - - waitFor(app.textFields["input-1"]) - XCTAssertFalse(app.staticTexts["input-1-validation"].firstMatch.exists) - check("input 1 validation inactive") - } + waitFor(app.textFields["input-1"]) + XCTAssertFalse(app.staticTexts["input-1-validation"].firstMatch.exists) } } diff --git a/plugins/reference-assets/swiftui/UITests/TextAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/TextAssetUITests.swift index 758965e3b..0f7244093 100644 --- a/plugins/reference-assets/swiftui/UITests/TextAssetUITests.swift +++ b/plugins/reference-assets/swiftui/UITests/TextAssetUITests.swift @@ -2,14 +2,12 @@ import XCTest class TextAssetUITests: BaseTestCase { func testBasicText() { - withEyes("text basic") { check in - waitFor(app.staticTexts["text-1"]) - check("Page Load") - let text = app.staticTexts["text-1"].label - XCTAssertEqual(text, "This is some text.") + openFlow("text basic") + waitFor(app.staticTexts["text-1"]) + let text = app.staticTexts["text-1"].label + XCTAssertEqual(text, "This is some text.") - let label = app.staticTexts["text-2"] - XCTAssertEqual(label.label, "This is some text that is a link") - } + let label = app.staticTexts["text-2"] + XCTAssertEqual(label.label, "This is some text that is a link") } } diff --git a/swift_deps_index.json b/swift_deps_index.json index 8357fd31b..7e54ddf9e 100644 --- a/swift_deps_index.json +++ b/swift_deps_index.json @@ -1,112 +1,9 @@ { "direct_dep_identities": [ - "eyes-xcui-swift-package", "swift-hooks", - "viewinspector", - "xcodegen" + "viewinspector" ], "modules": [ - { - "name": "AEXML", - "c99name": "AEXML", - "src_type": "swift", - "label": "@swiftpkg_aexml//:Sources_AEXML", - "package_identity": "aexml", - "product_memberships": [ - "AEXML" - ] - }, - { - "name": "EyesXCUI", - "c99name": "EyesXCUI", - "src_type": "binary", - "label": "@swiftpkg_eyes_xcui_swift_package//:remote_archive_EyesXCUI.xcframework.zip_EyesXCUI", - "package_identity": "eyes-xcui-swift-package", - "product_memberships": [ - "EyesXCUI" - ] - }, - { - "name": "DOT", - "c99name": "DOT", - "src_type": "swift", - "label": "@swiftpkg_graphviz//:Sources_DOT", - "package_identity": "graphviz", - "product_memberships": [ - "GraphViz" - ] - }, - { - "name": "GraphViz", - "c99name": "GraphViz", - "src_type": "swift", - "label": "@swiftpkg_graphviz//:Sources_GraphViz", - "package_identity": "graphviz", - "product_memberships": [ - "GraphViz", - "GraphVizBuilder" - ] - }, - { - "name": "GraphVizBuilder", - "c99name": "GraphVizBuilder", - "src_type": "swift", - "label": "@swiftpkg_graphviz//:Sources_GraphVizBuilder", - "package_identity": "graphviz", - "product_memberships": [ - "GraphVizBuilder" - ] - }, - { - "name": "Tools", - "c99name": "Tools", - "src_type": "swift", - "label": "@swiftpkg_graphviz//:Sources_Tools", - "package_identity": "graphviz", - "product_memberships": [ - "GraphViz" - ] - }, - { - "name": "JSONUtilities", - "c99name": "JSONUtilities", - "src_type": "swift", - "label": "@swiftpkg_jsonutilities//:Sources_JSONUtilities", - "package_identity": "jsonutilities", - "product_memberships": [ - "JSONUtilities" - ] - }, - { - "name": "PathKit", - "c99name": "PathKit", - "src_type": "swift", - "label": "@swiftpkg_pathkit//:Sources_PathKit", - "package_identity": "pathkit", - "product_memberships": [ - "PathKit" - ] - }, - { - "name": "Rainbow", - "c99name": "Rainbow", - "src_type": "swift", - "label": "@swiftpkg_rainbow//:Sources_Rainbow", - "package_identity": "rainbow", - "product_memberships": [ - "Rainbow" - ] - }, - { - "name": "Spectre", - "c99name": "Spectre", - "src_type": "swift", - "label": "@swiftpkg_spectre//:Sources_Spectre", - "package_identity": "spectre", - "product_memberships": [ - "Spectre" - ] - }, { "name": "SwiftHooks", "c99name": "SwiftHooks", @@ -117,26 +14,6 @@ "SwiftHooks" ] }, - { - "name": "SwiftCLI", - "c99name": "SwiftCLI", - "src_type": "swift", - "label": "@swiftpkg_swiftcli//:Sources_SwiftCLI", - "package_identity": "swiftcli", - "product_memberships": [ - "SwiftCLI" - ] - }, - { - "name": "Version", - "c99name": "Version", - "src_type": "swift", - "label": "@swiftpkg_version//:Sources_Version", - "package_identity": "version", - "product_memberships": [ - "Version" - ] - }, { "name": "ViewInspector", "c99name": "ViewInspector", @@ -147,160 +24,9 @@ "product_memberships": [ "ViewInspector" ] - }, - { - "name": "ProjectSpec", - "c99name": "ProjectSpec", - "src_type": "swift", - "label": "@swiftpkg_xcodegen//:Sources_ProjectSpec", - "package_identity": "xcodegen", - "product_memberships": [ - "xcodegen", - "XcodeGenKit", - "ProjectSpec" - ] - }, - { - "name": "XcodeGen", - "c99name": "XcodeGen", - "src_type": "swift", - "label": "@swiftpkg_xcodegen//:Sources_XcodeGen", - "package_identity": "xcodegen", - "product_memberships": [ - "xcodegen" - ] - }, - { - "name": "XcodeGenCLI", - "c99name": "XcodeGenCLI", - "src_type": "swift", - "label": "@swiftpkg_xcodegen//:Sources_XcodeGenCLI", - "package_identity": "xcodegen", - "product_memberships": [ - "xcodegen" - ] - }, - { - "name": "XcodeGenCore", - "c99name": "XcodeGenCore", - "src_type": "swift", - "label": "@swiftpkg_xcodegen//:Sources_XcodeGenCore", - "package_identity": "xcodegen", - "product_memberships": [ - "xcodegen", - "XcodeGenKit", - "ProjectSpec" - ] - }, - { - "name": "XcodeGenKit", - "c99name": "XcodeGenKit", - "src_type": "swift", - "label": "@swiftpkg_xcodegen//:Sources_XcodeGenKit", - "package_identity": "xcodegen", - "product_memberships": [ - "xcodegen", - "XcodeGenKit" - ] - }, - { - "name": "XcodeProj", - "c99name": "XcodeProj", - "src_type": "swift", - "label": "@swiftpkg_xcodeproj//:Sources_XcodeProj", - "package_identity": "xcodeproj", - "product_memberships": [ - "XcodeProj" - ] - }, - { - "name": "CYaml", - "c99name": "CYaml", - "src_type": "clang", - "label": "@swiftpkg_yams//:Sources_CYaml", - "package_identity": "yams", - "product_memberships": [ - "Yams" - ] - }, - { - "name": "Yams", - "c99name": "Yams", - "src_type": "swift", - "label": "@swiftpkg_yams//:Sources_Yams", - "package_identity": "yams", - "product_memberships": [ - "Yams" - ] } ], "products": [ - { - "identity": "aexml", - "name": "AEXML", - "type": "library", - "target_labels": [ - "@swiftpkg_aexml//:Sources_AEXML" - ] - }, - { - "identity": "eyes-xcui-swift-package", - "name": "EyesXCUI", - "type": "library", - "target_labels": [ - "@swiftpkg_eyes_xcui_swift_package//:remote_archive_EyesXCUI.xcframework.zip_EyesXCUI" - ] - }, - { - "identity": "graphviz", - "name": "GraphViz", - "type": "library", - "target_labels": [ - "@swiftpkg_graphviz//:Sources_GraphViz", - "@swiftpkg_graphviz//:Sources_DOT", - "@swiftpkg_graphviz//:Sources_Tools" - ] - }, - { - "identity": "graphviz", - "name": "GraphVizBuilder", - "type": "library", - "target_labels": [ - "@swiftpkg_graphviz//:Sources_GraphVizBuilder" - ] - }, - { - "identity": "jsonutilities", - "name": "JSONUtilities", - "type": "library", - "target_labels": [ - "@swiftpkg_jsonutilities//:Sources_JSONUtilities" - ] - }, - { - "identity": "pathkit", - "name": "PathKit", - "type": "library", - "target_labels": [ - "@swiftpkg_pathkit//:Sources_PathKit" - ] - }, - { - "identity": "rainbow", - "name": "Rainbow", - "type": "library", - "target_labels": [ - "@swiftpkg_rainbow//:Sources_Rainbow" - ] - }, - { - "identity": "spectre", - "name": "Spectre", - "type": "library", - "target_labels": [ - "@swiftpkg_spectre//:Sources_Spectre" - ] - }, { "identity": "swift-hooks", "name": "SwiftHooks", @@ -309,22 +35,6 @@ "@swiftpkg_swift_hooks//:Sources_SwiftHooks" ] }, - { - "identity": "swiftcli", - "name": "SwiftCLI", - "type": "library", - "target_labels": [ - "@swiftpkg_swiftcli//:Sources_SwiftCLI" - ] - }, - { - "identity": "version", - "name": "Version", - "type": "library", - "target_labels": [ - "@swiftpkg_version//:Sources_Version" - ] - }, { "identity": "viewinspector", "name": "ViewInspector", @@ -332,112 +42,9 @@ "target_labels": [ "@swiftpkg_viewinspector//:Sources_ViewInspector" ] - }, - { - "identity": "xcodegen", - "name": "ProjectSpec", - "type": "library", - "target_labels": [ - "@swiftpkg_xcodegen//:Sources_ProjectSpec" - ] - }, - { - "identity": "xcodegen", - "name": "XcodeGenKit", - "type": "library", - "target_labels": [ - "@swiftpkg_xcodegen//:Sources_XcodeGenKit" - ] - }, - { - "identity": "xcodegen", - "name": "xcodegen", - "type": "executable", - "target_labels": [ - "@swiftpkg_xcodegen//:Sources_XcodeGen" - ] - }, - { - "identity": "xcodeproj", - "name": "XcodeProj", - "type": "library", - "target_labels": [ - "@swiftpkg_xcodeproj//:Sources_XcodeProj" - ] - }, - { - "identity": "yams", - "name": "Yams", - "type": "library", - "target_labels": [ - "@swiftpkg_yams//:Sources_Yams" - ] } ], "packages": [ - { - "name": "swiftpkg_aexml", - "identity": "aexml", - "remote": { - "commit": "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", - "remote": "https://github.com/tadija/AEXML.git", - "version": "4.6.1" - } - }, - { - "name": "swiftpkg_eyes_xcui_swift_package", - "identity": "eyes-xcui-swift-package", - "remote": { - "commit": "8e968bc753f298bdc8836dae95ef8862bb6fa4bc", - "remote": "https://github.com/applitools/eyes-xcui-swift-package.git", - "version": "8.11.0" - } - }, - { - "name": "swiftpkg_graphviz", - "identity": "graphviz", - "remote": { - "commit": "70bebcf4597b9ce33e19816d6bbd4ba9b7bdf038", - "remote": "https://github.com/SwiftDocOrg/GraphViz.git", - "version": "0.2.0" - } - }, - { - "name": "swiftpkg_jsonutilities", - "identity": "jsonutilities", - "remote": { - "commit": "128d2ffc22467f69569ef8ff971683e2393191a0", - "remote": "https://github.com/yonaskolb/JSONUtilities.git", - "version": "4.2.0" - } - }, - { - "name": "swiftpkg_pathkit", - "identity": "pathkit", - "remote": { - "commit": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", - "remote": "https://github.com/kylef/PathKit.git", - "version": "1.0.1" - } - }, - { - "name": "swiftpkg_rainbow", - "identity": "rainbow", - "remote": { - "commit": "626c3d4b6b55354b4af3aa309f998fae9b31a3d9", - "remote": "https://github.com/onevcat/Rainbow.git", - "version": "3.2.0" - } - }, - { - "name": "swiftpkg_spectre", - "identity": "spectre", - "remote": { - "commit": "26cc5e9ae0947092c7139ef7ba612e34646086c7", - "remote": "https://github.com/kylef/Spectre.git", - "version": "0.10.1" - } - }, { "name": "swiftpkg_swift_hooks", "identity": "swift-hooks", @@ -447,24 +54,6 @@ "version": "0.1.0" } }, - { - "name": "swiftpkg_swiftcli", - "identity": "swiftcli", - "remote": { - "commit": "2e949055d9797c1a6bddcda0e58dada16cc8e970", - "remote": "https://github.com/jakeheis/SwiftCLI.git", - "version": "6.0.3" - } - }, - { - "name": "swiftpkg_version", - "identity": "version", - "remote": { - "commit": "1fe824b80d89201652e7eca7c9252269a1d85e25", - "remote": "https://github.com/mxcl/Version", - "version": "2.0.1" - } - }, { "name": "swiftpkg_viewinspector", "identity": "viewinspector", @@ -473,33 +62,6 @@ "remote": "https://github.com/nalexn/ViewInspector", "version": "0.9.10" } - }, - { - "name": "swiftpkg_xcodegen", - "identity": "xcodegen", - "remote": { - "commit": "87a275fb0852bb231550e66473804de57063c957", - "remote": "https://github.com/yonaskolb/XcodeGen.git", - "version": "2.38.0" - } - }, - { - "name": "swiftpkg_xcodeproj", - "identity": "xcodeproj", - "remote": { - "commit": "447c159b0c5fb047a024fd8d942d4a76cf47dde0", - "remote": "https://github.com/tuist/XcodeProj.git", - "version": "8.16.0" - } - }, - { - "name": "swiftpkg_yams", - "identity": "yams", - "remote": { - "commit": "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3", - "remote": "https://github.com/jpsim/Yams.git", - "version": "5.0.6" - } } ] } \ No newline at end of file diff --git a/xcode/Package.resolved b/xcode/Package.resolved index 298e16d59..383fb2ba5 100644 --- a/xcode/Package.resolved +++ b/xcode/Package.resolved @@ -1,68 +1,5 @@ { "pins" : [ - { - "identity" : "aexml", - "kind" : "remoteSourceControl", - "location" : "https://github.com/tadija/AEXML.git", - "state" : { - "revision" : "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", - "version" : "4.6.1" - } - }, - { - "identity" : "eyes-xcui-swift-package", - "kind" : "remoteSourceControl", - "location" : "https://github.com/applitools/eyes-xcui-swift-package.git", - "state" : { - "revision" : "8e968bc753f298bdc8836dae95ef8862bb6fa4bc", - "version" : "8.11.0" - } - }, - { - "identity" : "graphviz", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SwiftDocOrg/GraphViz.git", - "state" : { - "revision" : "70bebcf4597b9ce33e19816d6bbd4ba9b7bdf038", - "version" : "0.2.0" - } - }, - { - "identity" : "jsonutilities", - "kind" : "remoteSourceControl", - "location" : "https://github.com/yonaskolb/JSONUtilities.git", - "state" : { - "revision" : "128d2ffc22467f69569ef8ff971683e2393191a0", - "version" : "4.2.0" - } - }, - { - "identity" : "pathkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/kylef/PathKit.git", - "state" : { - "revision" : "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", - "version" : "1.0.1" - } - }, - { - "identity" : "rainbow", - "kind" : "remoteSourceControl", - "location" : "https://github.com/onevcat/Rainbow.git", - "state" : { - "revision" : "626c3d4b6b55354b4af3aa309f998fae9b31a3d9", - "version" : "3.2.0" - } - }, - { - "identity" : "spectre", - "kind" : "remoteSourceControl", - "location" : "https://github.com/kylef/Spectre.git", - "state" : { - "revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7", - "version" : "0.10.1" - } - }, { "identity" : "swift-hooks", "kind" : "remoteSourceControl", @@ -72,24 +9,6 @@ "version" : "0.1.0" } }, - { - "identity" : "swiftcli", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jakeheis/SwiftCLI.git", - "state" : { - "revision" : "2e949055d9797c1a6bddcda0e58dada16cc8e970", - "version" : "6.0.3" - } - }, - { - "identity" : "version", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mxcl/Version", - "state" : { - "revision" : "1fe824b80d89201652e7eca7c9252269a1d85e25", - "version" : "2.0.1" - } - }, { "identity" : "viewinspector", "kind" : "remoteSourceControl", @@ -98,33 +17,6 @@ "revision" : "67319287749b83f39dcc2f20edd520c610c012fd", "version" : "0.9.10" } - }, - { - "identity" : "xcodegen", - "kind" : "remoteSourceControl", - "location" : "https://github.com/yonaskolb/XcodeGen.git", - "state" : { - "revision" : "87a275fb0852bb231550e66473804de57063c957", - "version" : "2.38.0" - } - }, - { - "identity" : "xcodeproj", - "kind" : "remoteSourceControl", - "location" : "https://github.com/tuist/XcodeProj.git", - "state" : { - "revision" : "447c159b0c5fb047a024fd8d942d4a76cf47dde0", - "version" : "8.16.0" - } - }, - { - "identity" : "yams", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jpsim/Yams.git", - "state" : { - "revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3", - "version" : "5.0.6" - } } ], "version" : 2 diff --git a/xcode/Package.swift b/xcode/Package.swift index 2a5faab9c..2bbb01ee6 100644 --- a/xcode/Package.swift +++ b/xcode/Package.swift @@ -20,12 +20,7 @@ let package = Package( // Actual Dependencies .package(url: "https://github.com/intuit/swift-hooks.git", .upToNextMajor(from: "0.1.0")), - - // Tools - .package(url: "https://github.com/yonaskolb/XcodeGen.git", .upToNextMajor(from: "2.38.0")), - - // Testing - .package(url: "https://github.com/applitools/eyes-xcui-swift-package.git", exact: "8.11.0"), + // Testing Dependencies .package(url: "https://github.com/nalexn/viewinspector.git", .upToNextMajor(from: "0.9.10")) ], targets: [] From 49a37c73ad4e3e5b41f47239b0209070c8f1ad26 Mon Sep 17 00:00:00 2001 From: hborawski Date: Fri, 29 Mar 2024 12:50:21 -0700 Subject: [PATCH 23/34] fix flaky test --- ios/core/Tests/Types/Generic/AnyTypeTests.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ios/core/Tests/Types/Generic/AnyTypeTests.swift b/ios/core/Tests/Types/Generic/AnyTypeTests.swift index 5ba059f38..dbd6836eb 100644 --- a/ios/core/Tests/Types/Generic/AnyTypeTests.swift +++ b/ios/core/Tests/Types/Generic/AnyTypeTests.swift @@ -202,11 +202,13 @@ class AnyTypeTests: XCTestCase { XCTAssertEqual("[\"test\",\"data\"]", doEncode(AnyType.array(data: ["test", "data"]))) XCTAssertEqual("[1,2]", doEncode(AnyType.numberArray(data: [1, 2]))) XCTAssertEqual("[false,true]", doEncode(AnyType.booleanArray(data: [false, true]))) - XCTAssertEqual("{\"key\":false,\"key2\":1}", doEncode(AnyType.anyDictionary(data: ["key": false, "key2": 1]))) + XCTAssertEqual("{\"a\":false,\"b\":1}", doEncode(AnyType.anyDictionary(data: ["a": false, "b": 1]))) } func doEncode(_ data: AnyType) -> String? { - let data = try? JSONEncoder().encode(data) + let encoder = JSONEncoder() + encoder.outputFormatting = .sortedKeys + let data = try? encoder.encode(data) guard let data = data else { return nil } return String(data: data, encoding: .utf8) } From a564af2c38d854961035e317f555fdaf95937916 Mon Sep 17 00:00:00 2001 From: hborawski Date: Fri, 29 Mar 2024 14:39:40 -0700 Subject: [PATCH 24/34] rewrite assertPublished again --- .../ManagedPlayerViewModelTests.swift | 78 ++++++++----------- 1 file changed, 33 insertions(+), 45 deletions(-) diff --git a/ios/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift b/ios/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift index 913eb51f4..3d86ff716 100644 --- a/ios/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift +++ b/ios/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift @@ -27,9 +27,7 @@ class ManagedPlayerViewModelTests: XCTestCase { completed.fulfill() }) - Task { await viewModel.next() } - - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } action: { await viewModel.next() } let result = """ { @@ -54,9 +52,8 @@ class ManagedPlayerViewModelTests: XCTestCase { let viewModel = ManagedPlayerViewModel(manager: flowManager, onComplete: {_ in}) - Task { await viewModel.next() } - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } action: { await viewModel.next() } let result = """ { @@ -72,9 +69,7 @@ class ManagedPlayerViewModelTests: XCTestCase { let state = CompletedState.createInstance(from: stateObj)! - viewModel.result = .success(state) - - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow2 } + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow2 } action: { viewModel.result = .success(state) } } func testViewModelManagerError() async { @@ -87,12 +82,16 @@ class ManagedPlayerViewModelTests: XCTestCase { let viewModel = ManagedPlayerViewModel(manager: flowManager, onComplete: {_ in }) - await viewModel.next() + await assertPublished(AnyPublisher(viewModel.$loadingState), condition: { state in + guard + case .failed(let error) = state, + let _ = error as? PlayerError + else { return false } - guard - case .failed(let error) = viewModel.loadingState, - let _ = error as? PlayerError - else { return XCTFail("Expected PlayerError") } + return true + }) { + await viewModel.next() + } XCTAssertFalse(viewModel.loadingState.isLoaded) } @@ -102,13 +101,13 @@ class ManagedPlayerViewModelTests: XCTestCase { let viewModel = ManagedPlayerViewModel(manager: flowManager, onComplete: {_ in}) - await viewModel.next() - await assertPublished(AnyPublisher(viewModel.$loadingState)) { value in if case .loaded(let flow) = value, flow == self.flow1 { return true } return false + } action: { + await viewModel.next() } let result = """ @@ -125,31 +124,27 @@ class ManagedPlayerViewModelTests: XCTestCase { let state = CompletedState.createInstance(from: stateObj)! - viewModel.result = .success(state) - - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow2 } - - viewModel.result = .failure(PlayerError.jsConversionFailure) + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow2 } action: { viewModel.result = .success(state) } await assertPublished(AnyPublisher(viewModel.$loadingState)) { value in if case .failed = value { return true } return false + } action: { + viewModel.result = .failure(PlayerError.jsConversionFailure) } - viewModel.retry() - await assertPublished(AnyPublisher(viewModel.$loadingState)) { if case .retry = $0 { return true } return false + } action: { + viewModel.retry() } - await viewModel.next(state) - - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow2 } + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow2 } action: { await viewModel.next(state) } } func testViewModelReset() async throws { @@ -157,9 +152,7 @@ class ManagedPlayerViewModelTests: XCTestCase { let viewModel = ManagedPlayerViewModel(manager: flowManager, onComplete: {_ in}) - await viewModel.next() - - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } action: { await viewModel.next() } let result = """ { @@ -175,31 +168,27 @@ class ManagedPlayerViewModelTests: XCTestCase { let state = CompletedState.createInstance(from: stateObj)! - viewModel.result = .success(state) - - await assertPublished(AnyPublisher(viewModel.$flow), timeout: 10) { $0 == self.flow2 } - - viewModel.result = .failure(PlayerError.jsConversionFailure) + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow2 } action: { viewModel.result = .success(state) } await assertPublished(AnyPublisher(viewModel.$loadingState)) { value in if case .failed = value { return true } return false + } action: { + viewModel.result = .failure(PlayerError.jsConversionFailure) } - viewModel.reset() - await assertPublished(AnyPublisher(viewModel.$loadingState)) { if case .idle = $0 { return true } return false + } action: { + viewModel.reset() } - await viewModel.next() - - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 == self.flow1 } action: { await viewModel.next() } } func testViewModelErrorFlow() async { @@ -208,15 +197,13 @@ class ManagedPlayerViewModelTests: XCTestCase { let completed = expectation(description: "Flows Completed") let viewModel = ManagedPlayerViewModel(manager: flowManager, onComplete: {_ in}) - await viewModel.next() + await assertPublished(AnyPublisher(viewModel.$flow)) { $0 != nil } action: { await viewModel.next() } let cancellable = viewModel.$loadingState.sink { (loadingState) in guard case .failed = loadingState else { return } completed.fulfill() } - await assertPublished(AnyPublisher(viewModel.$flow)) { $0 != nil } - viewModel.result = .failure(.jsConversionFailure) await fulfillment(of: [completed], timeout: 2) @@ -305,14 +292,15 @@ class TerminatingManager: FlowManager { } internal extension XCTestCase { - @discardableResult - func assertPublished(_ publisher: AnyPublisher, timeout: Double = 2, condition: @escaping(T) -> Bool) async -> Cancellable { + func assertPublished(_ publisher: AnyPublisher, condition: @escaping (T) -> Bool, action: () async -> Void) async { let expectation = XCTestExpectation(description: "Waiting for publisher to emit value") let cancel = publisher.sink { (value) in guard condition(value) else { return } expectation.fulfill() } - await fulfillment(of: [expectation], timeout: timeout) - return cancel + defer { cancel.cancel() } + await action() + await fulfillment(of: [expectation], timeout: 5) + cancel.cancel() } } From 82939d76022dbe021e75467dee9cbf8f5bc8063b Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 1 Apr 2024 09:11:34 -0700 Subject: [PATCH 25/34] increase timeout --- .../external-action/ios/Tests/ExternalActionPluginTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/external-action/ios/Tests/ExternalActionPluginTests.swift b/plugins/external-action/ios/Tests/ExternalActionPluginTests.swift index 75ef4d8f1..7effb6702 100644 --- a/plugins/external-action/ios/Tests/ExternalActionPluginTests.swift +++ b/plugins/external-action/ios/Tests/ExternalActionPluginTests.swift @@ -250,7 +250,7 @@ class ExternalActionPluginTests: XCTestCase { } } - wait(for: [handlerExpectation, completionExpectation], timeout: 3) + wait(for: [handlerExpectation, completionExpectation], timeout: 5) } func testExternalStateHandlingOptions() { From cc98427ab66a5b16c40ffd8452a4d0110073011e Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 1 Apr 2024 09:35:48 -0700 Subject: [PATCH 26/34] tweak input asset so we can still test it all --- .../swiftui/Sources/SwiftUI/InputAsset.swift | 24 ++++++++++--------- .../SwiftUI/InputAssetTests.swift | 8 +++---- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/plugins/reference-assets/swiftui/Sources/SwiftUI/InputAsset.swift b/plugins/reference-assets/swiftui/Sources/SwiftUI/InputAsset.swift index 14323cac9..6c6242be2 100644 --- a/plugins/reference-assets/swiftui/Sources/SwiftUI/InputAsset.swift +++ b/plugins/reference-assets/swiftui/Sources/SwiftUI/InputAsset.swift @@ -102,17 +102,7 @@ struct InputAssetView: View { TextField( model.data.placeholder ?? "", text: $model.text, - onEditingChanged: { editing in - guard !editing else { - transactionContext.register(.input) { - self.model.set() - } - return - } - self.model.set() - // remove the transaction once editing ends - transactionContext.clear(.input) - } + onEditingChanged: onEditingChanged(_:) ) .padding(4) .background( @@ -130,6 +120,18 @@ struct InputAssetView: View { model.data.note?.asset?.view.foregroundColor(Color(red: 0.729, green: 0.745, blue: 0.773)).padding(.top, 8).font(.subheadline) } } + + func onEditingChanged(_ editing: Bool) { + guard !editing else { + transactionContext.register(.input) { + self.model.set() + } + return + } + self.model.set() + // remove the transaction once editing ends + transactionContext.clear(.input) + } } /** diff --git a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift index f413cd5ab..dad9db5b1 100644 --- a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift @@ -235,12 +235,12 @@ class InputAssetTests: SwiftUIAssetUnitTestCase { let stack = try view.inspect().vStack() - let field = try stack.textField(1) - model.text = "new text" - try field.callOnEditingChanged() -// model.set() + // When iOS 15 is the minimum and we can use @FocusState in the InputAsset + // we can update and call through ViewInspector for the new APIs + // for some reason it only ever calls it with true as it stands + view.onEditingChanged(false) wait(for: [setExpectation], timeout: 1) } From 58ee9b1c33dad6ad6c2707181d0d3d9c3c97b146 Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 1 Apr 2024 15:56:16 -0700 Subject: [PATCH 27/34] update iOS contrib docs, remove old docs --- .bazelignore | 5 ----- .bazelrc | 13 +------------ .circleci/config.yml | 4 ++-- .gitignore | 2 +- CONTRIBUTING.md | 35 +++++++++++++++-------------------- ios/BUILD.bazel | 2 +- 6 files changed, 20 insertions(+), 41 deletions(-) diff --git a/.bazelignore b/.bazelignore index ca3fd28d9..cb54b1553 100644 --- a/.bazelignore +++ b/.bazelignore @@ -23,11 +23,6 @@ profile DerivedData *.hmap *.ipa -xcode/Pods/ -CoverageData/ -bep.json -xcui.json -ios/*/*/Resources/**/*.js core/make-flow/node_modules core/types/node_modules diff --git a/.bazelrc b/.bazelrc index aad24e953..6ae7618e0 100644 --- a/.bazelrc +++ b/.bazelrc @@ -52,7 +52,7 @@ mobile-install --start=warm build:ci --build_metadata=ROLE=CI --workspace_status_command=./scripts/workspace-status.sh -# Circle large has 4 CPU cores/8GB mem +# Circle xlarge has 8 CPU cores/16GB mem build:ci --local_cpu_resources=8 build:ci --local_ram_resources=15000 build:ci --config="release" @@ -62,17 +62,6 @@ build:release --stamp --workspace_status_command=./scripts/workspace-status.sh # Cache action outputs on disk so they persist across output_base and bazel shutdown (eg. changing branches) # build --disk_cache=~/.cache/bazel-disk-cache -build:skip-ios -- \ - -//:PlayerUI \ - -//:PlayerUI_Pod \ - -//:PlayerUI-Demo \ - -//:PlayerUI-Unit-Unit \ - -//:PlayerUI-Unit-Unit.__internal__.__test_bundle \ - -//:PlayerUI-UI-ViewInspectorTests \ - -//:PlayerUI-UI-ViewInspectorTests.__internal__.__test_bundle \ - -//:PlayerUI-UI-XCUITests \ - -//:PlayerUI-UI-XCUITests.__internal__.__test_bundle - # Support for debugging NodeJS tests # Add the Bazel option `--config=debug` to enable this # --test_output=streamed diff --git a/.circleci/config.yml b/.circleci/config.yml index a1279afe8..815861ff6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,7 +94,7 @@ jobs: - attach_workspace: at: ~/player - - run: bazel build --config=ci --config=skip-ios -- //... + - run: bazel build --config=ci -- `bazel query '//... except filter("ios|swiftui", //...)'` - save_cache: paths: @@ -206,7 +206,7 @@ jobs: - attach_workspace: at: ~/player - - run: bazel test --config=skip-ios --config=ci -- //... -//docs/site -//android/demo:android_instrumentation_test + - run: bazel test --config=ci -- `bazel query '//... except filter("ios|swiftui", //...)'` -//docs/site -//android/demo:android_instrumentation_test - run: when: always diff --git a/.gitignore b/.gitignore index c740e6b3a..afaf3d1c1 100644 --- a/.gitignore +++ b/.gitignore @@ -76,7 +76,7 @@ xcui.json #SPM .build .swiftpm -ios/Player.xcodeproj +ios/PlayerUI.xcodeproj # Bundles used by cocoapods for development ios/*/*/Resources/**/*.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cc9b3fa40..d713bda20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,17 +21,6 @@ If the changes are larger (API design, architecture, etc), [opening an issue](ht * [Android NDK >= 19.2.5345600, <= 21](https://github.com/android/ndk/wiki/Unsupported-Downloads#r19c). Any version > 21 will not work, period. You'll need to add `ANDROID_NDK_HOME` to your environment manually. ## Building and Testing Locally (All platforms) -#### Presetup -For iOS builds, some pre-setup is required for `bazel` to generate BUILD files for dependent CocoaPods. - -```bash -bundle install -``` -CocoaPods does not directly integrate with `bazel`, when core targets are updated, the output bundles need to be copied to the location described in the `PlayerUI.podspec`, to do so run the script: -```bash -./tools/build_ios_bundles.sh -``` -This will query `bazel` for dependent targets, copy their output and regenerate the `.xcworkspace`. ### Player For speed and consistency, this repo leverages `bazel` as it's main build tool. Check out the [bazel](https://bazel.build/) docs for more info. @@ -47,20 +36,26 @@ Tests can also be ran using: bazel test //... ``` -#### Skipping iOS builds -The `.bazelrc` contains a convenience to build everything but the iOS targets, as the toolchain for those is platform specific. - -```bash -bazel build --config=skip-ios -``` - ## For Android Only builds -If you are interested in only contributing for android, follow our [android guide](https://github.com/player-ui/player/android/demo/README.md) +If you are interested in only contributing for android, follow our [android guide](https://github.com/player-ui/player/blob/main/android/demo/README.md) ## For iOS Only builds -If you are interested in only contributing for iOS, follow our [iOS guide](https://github.com/player-ui/player) +### Xcode Project generation +Generate the `.xcodeproj` to open and work in Xcode. Builds and tests will be executed through bazel, to ensure behavioral parity. +```bash +bazel run //ios:xcodeproj +open -a Xcode ios/PlayerUI.xcodeproj/ +``` +### Demo Application +#### Xcode +The first time the Xcode project is generated, the default selected target is `PlayerUI`, for a runnable target select `PlayerUIDemo` to run the demo application in the simulator. +#### Bazel +The demo app can also be built and launched in a simulator from the command line with bazel: +```bash +bazel run //ios/demo:PlayerUIDemo +``` ## Docs Sites These require the [Android NDK](https://developer.android.com/ndk). diff --git a/ios/BUILD.bazel b/ios/BUILD.bazel index 7ce9ac40e..3a5bd0edf 100644 --- a/ios/BUILD.bazel +++ b/ios/BUILD.bazel @@ -6,7 +6,7 @@ load( xcodeproj( name = "xcodeproj", - project_name = "Player", + project_name = "PlayerUI", tags = ["manual"], top_level_targets = [ top_level_target("//ios/demo:PlayerUIDemo", target_environments = ["simulator"]), From 73e407e0843812ce37cb882f23a01c89699775fa Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 1 Apr 2024 16:03:51 -0700 Subject: [PATCH 28/34] remove Inspectable conformance as it was deprecated --- .../ViewInspector/ManagedPlayer/ManagedPlayerTests.swift | 5 +---- ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift | 2 -- .../ViewInspector/ui-test/AssetFlowViewTests.swift | 2 -- .../unit-test/SwiftUIAssetUnitTestCaseTests.swift | 2 -- plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift | 2 +- .../swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift | 2 -- .../ExternalActionViewModifierPluginTests.swift | 4 +--- .../ViewInspector/SwiftUIPendingTransactionPlugin.swift | 2 -- .../swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift | 2 -- .../swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift | 2 -- .../swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift | 2 -- .../swiftui/ViewInspector/SwiftUI/InputAssetTests.swift | 2 -- .../swiftui/ViewInspector/SwiftUI/TextAssetTests.swift | 3 --- 13 files changed, 3 insertions(+), 29 deletions(-) diff --git a/ios/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift b/ios/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift index ddac1d40d..a5f7102e9 100644 --- a/ios/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift +++ b/ios/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift @@ -16,10 +16,7 @@ import ViewInspector @testable import PlayerUIInternalTestUtilities @testable import PlayerUIReferenceAssets -extension ManagedPlayer: Inspectable {} -extension Inspection: InspectionEmissary where V: Inspectable { } - -extension ManagedPlayer14: Inspectable {} +extension Inspection: InspectionEmissary { } class ManagedPlayer14Tests: XCTestCase { func testLoadingView() throws { diff --git a/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift b/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift index de5071e1d..ffea6c68a 100644 --- a/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift +++ b/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift @@ -18,8 +18,6 @@ import JavaScriptCore @testable import PlayerUIInternalTestUtilities @testable import PlayerUIReferenceAssets -extension SwiftUIPlayer: Inspectable {} - class SwiftUIPlayerTests: XCTestCase { func testFlowLoads() throws { var bag = Set() diff --git a/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift b/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift index 91999bda5..9e662cc3b 100644 --- a/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift +++ b/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift @@ -22,8 +22,6 @@ import ViewInspector @testable import PlayerUIInternalTestUtilities @testable import PlayerUIInternalTestUtilities -extension AssetFlowView: Inspectable {} - class AssetFlowViewTests: XCTestCase { override func setUp() { XCUIApplication().terminate() diff --git a/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift b/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift index 90e593520..45ef4eff7 100644 --- a/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift +++ b/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift @@ -40,8 +40,6 @@ class ExampleSwiftUIAsset: UncontrolledAsset { override var view: AnyView { AnyView(ExampleView(model: model)) } } -extension ExampleView: Inspectable {} - class SwiftUIAssetUnitTestDefaultTests: SwiftUIAssetUnitTestCase { func testDefaultRegister() { let player = TestPlayer(plugins: [self], registry: SwiftUIRegistry(logger: TapableLogger())) diff --git a/plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift b/plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift index 58aa55ef9..0200a2ee5 100644 --- a/plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift +++ b/plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift @@ -93,7 +93,7 @@ class BeaconPluginTests: XCTestCase { wait(for: [beaconed], timeout: 5) } } -extension TestButton: Inspectable {} + struct TestButton: View { @Environment(\.beaconContext) var beaconContext var metaData: MetaData? diff --git a/plugins/check-path/swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift b/plugins/check-path/swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift index a7f338e94..3c38a554a 100644 --- a/plugins/check-path/swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift +++ b/plugins/check-path/swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift @@ -40,5 +40,3 @@ private struct CheckPathTestAssetView: View { Text(checkPath == nil ? "Not Found" : "Found").onAppear { didAppear?(self) } } } - -extension CheckPathTestAssetView: Inspectable {} diff --git a/plugins/external-action/swiftui/ViewInspector/ExternalActionViewModifierPluginTests.swift b/plugins/external-action/swiftui/ViewInspector/ExternalActionViewModifierPluginTests.swift index 6bb119c19..7d9952f72 100644 --- a/plugins/external-action/swiftui/ViewInspector/ExternalActionViewModifierPluginTests.swift +++ b/plugins/external-action/swiftui/ViewInspector/ExternalActionViewModifierPluginTests.swift @@ -247,7 +247,5 @@ class ExternalActionViewModifierPluginTests: XCTestCase { } } -extension ExternalStateSheetModifier: Inspectable {} extension InspectableSheet: PopupPresenter {} -extension SwiftUIPlayer: Inspectable {} -extension Inspection: InspectionEmissary where V: Inspectable { } +extension Inspection: InspectionEmissary { } diff --git a/plugins/pending-transaction/swiftui/ViewInspector/SwiftUIPendingTransactionPlugin.swift b/plugins/pending-transaction/swiftui/ViewInspector/SwiftUIPendingTransactionPlugin.swift index bf8861e14..5e1c84237 100644 --- a/plugins/pending-transaction/swiftui/ViewInspector/SwiftUIPendingTransactionPlugin.swift +++ b/plugins/pending-transaction/swiftui/ViewInspector/SwiftUIPendingTransactionPlugin.swift @@ -86,7 +86,6 @@ class SwiftUIPendingTransactionPluginTests: XCTestCase { } } -extension TestButtons: Inspectable {} private struct TestButtons: View { @Environment(\.transactionContext) var transactionContext @@ -114,7 +113,6 @@ private struct TestButtons: View { } } -extension TestButtons2: Inspectable {} private struct TestButtons2: View { @Environment(\.transactionContext) var transactionContext diff --git a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift index 5c29d86c4..04f5ca9fa 100644 --- a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift @@ -17,8 +17,6 @@ import ViewInspector @testable import PlayerUISwiftUI @testable import PlayerUIBeaconPlugin -extension ActionAssetView: Inspectable {} - class ActionAssetTests: SwiftUIAssetUnitTestCase { override func register(registry: SwiftUIRegistry) { registry.register("action", asset: ActionAsset.self) diff --git a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift index f14aa3b3c..bd5dbb563 100644 --- a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift @@ -16,8 +16,6 @@ import SwiftUI @testable import PlayerUIReferenceAssets @testable import PlayerUISwiftUI -extension CollectionAssetView: Inspectable {} - class CollectionAssetTests: SwiftUIAssetUnitTestCase { override func register(registry: SwiftUIRegistry) { registry.register("collection", asset: CollectionAsset.self) diff --git a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift index 9ec6a9245..ad793daa2 100644 --- a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift @@ -16,8 +16,6 @@ import XCTest @testable import PlayerUIReferenceAssets @testable import PlayerUISwiftUI -extension InfoAssetView: Inspectable {} - class InfoAssetTests: SwiftUIAssetUnitTestCase { override func register(registry: SwiftUIRegistry) { registry.register("info", asset: InfoAsset.self) diff --git a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift index dad9db5b1..d57b6a474 100644 --- a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift @@ -18,8 +18,6 @@ import JavaScriptCore @testable import PlayerUIReferenceAssets @testable import PlayerUISwiftUI -extension InputAssetView: Inspectable {} -extension ValidationView: Inspectable {} class InputAssetTests: SwiftUIAssetUnitTestCase { override func register(registry: SwiftUIRegistry) { diff --git a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/TextAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/TextAssetTests.swift index 0517bfe18..688d340b8 100644 --- a/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/TextAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/TextAssetTests.swift @@ -15,9 +15,6 @@ import SwiftUI @testable import PlayerUISwiftUI @testable import PlayerUITestUtilities -extension TextAssetView: Inspectable {} -extension LinkModifier: Inspectable {} - class TextAssetTests: SwiftUIAssetUnitTestCase { override func register(registry: SwiftUIRegistry) { registry.register("text", asset: TextAsset.self) From e1483c53df2892b93065afc2f4c3ae58899c7af6 Mon Sep 17 00:00:00 2001 From: hborawski Date: Mon, 1 Apr 2024 16:27:05 -0700 Subject: [PATCH 29/34] change syntax for building all except ios --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 815861ff6..b2567ab27 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,8 +93,8 @@ jobs: steps: - attach_workspace: at: ~/player - - - run: bazel build --config=ci -- `bazel query '//... except filter("ios|swiftui", //...)'` + - run: bazel query '//... except filter("ios|swiftui", //...)' + - run: bazel build --config=ci -- $(bazel query '//... except filter("ios|swiftui", //...)') - save_cache: paths: @@ -206,7 +206,7 @@ jobs: - attach_workspace: at: ~/player - - run: bazel test --config=ci -- `bazel query '//... except filter("ios|swiftui", //...)'` -//docs/site -//android/demo:android_instrumentation_test + - run: bazel test --config=ci -- $(bazel query '//... except filter("ios|swiftui", //...)') -//docs/site -//android/demo:android_instrumentation_test - run: when: always From 035381c34e65d09d5b7b5fbf9c07064564fd9474 Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 2 Apr 2024 10:52:58 -0700 Subject: [PATCH 30/34] bump rules_swift --- MODULE.bazel | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index dddd4031a..afce68939 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -22,9 +22,9 @@ node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") node.toolchain(node_version = "18.18.0") ################################# -# iOS - -bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift") +###### Start iOS ###### +## Rule Dependencies +bazel_dep(name = "rules_swift", version = "1.14.0", repo_name = "build_bazel_rules_swift") bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple") bazel_dep(name = "rules_ios", version = "3.1.4", repo_name = "build_bazel_rules_ios") bazel_dep(name = "rules_xcodeproj", version = "1.13.0") @@ -32,7 +32,7 @@ bazel_dep(name = "rules_xcodeproj", version = "1.13.0") bazel_dep(name = "gazelle", version = "0.34.0", repo_name = "bazel_gazelle") bazel_dep(name = "rules_swift_package_manager", version = "0.22.0") -# swift_deps START +## This section is handled by rules_swift_package_manager swift_deps = use_extension( "@rules_swift_package_manager//:extensions.bzl", "swift_deps", @@ -41,13 +41,16 @@ swift_deps.from_file( deps_index = "//:swift_deps_index.json", ) +## SPM Dependencies +### need to be listed here to be available as a target in BUILD files +### Add dependency in xcode/Package.swift and then run `bazel run //:update_swift_pkgs` +### before adding it here use_repo( swift_deps, "swiftpkg_swift_hooks", "swiftpkg_viewinspector" ) - -# end iOS +###### End iOS ###### npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm") npm.npm_translate_lock( From 9ac29b6d620ec8a59953f900c99c98575728e24f Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 2 Apr 2024 11:30:59 -0700 Subject: [PATCH 31/34] try storing coverage artifacts --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b2567ab27..a058e205b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -196,6 +196,16 @@ jobs: mkdir -p $RESULTS_DIR/$(dirname $line) cp $line $RESULTS_DIR/$(dirname $line) done + - run: + when: always + command: | + mkdir -p _coverage/lcov + mkdir -p _coverage/html + cp -r $(bazel info output_path)/_coverage/_coverage_report.dat _coverage + genhtml --branch-coverage --output-directory=_coverage/html/ "$(bazel info output_path)/_coverage/_coverage_report.dat" + + - store_artifacts: + path: _coverage - store_test_results: path: _test_results From 069906b6a75825ef8ff739eaa6ebabdc18ce207c Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 2 Apr 2024 11:36:19 -0700 Subject: [PATCH 32/34] fix path --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a058e205b..83ad849ac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -201,7 +201,7 @@ jobs: command: | mkdir -p _coverage/lcov mkdir -p _coverage/html - cp -r $(bazel info output_path)/_coverage/_coverage_report.dat _coverage + cp -r $(bazel info output_path)/_coverage/_coverage_report.dat _coverage/lcov/ genhtml --branch-coverage --output-directory=_coverage/html/ "$(bazel info output_path)/_coverage/_coverage_report.dat" - store_artifacts: From 6b172c724c683e3760bfedad2db610641fa68d1e Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 2 Apr 2024 12:06:34 -0700 Subject: [PATCH 33/34] install lcov with brew so we have genhtml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 83ad849ac..d374dff64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -115,7 +115,7 @@ jobs: - run: name: Homebrew Dependencies command: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install bazelisk maven openjdk@17 + HOMEBREW_NO_AUTO_UPDATE=1 brew install bazelisk maven openjdk@17 lcov # - restore_cache: # keys: From 6f3a4fad14aa7e2c962befd96d153405e2dedf60 Mon Sep 17 00:00:00 2001 From: hborawski Date: Tue, 2 Apr 2024 13:15:39 -0700 Subject: [PATCH 34/34] zip up html coverage output --- .circleci/config.yml | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d374dff64..b7663bcf1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -117,45 +117,6 @@ jobs: command: | HOMEBREW_NO_AUTO_UPDATE=1 brew install bazelisk maven openjdk@17 lcov - # - restore_cache: - # keys: - # - android-tools-{{ arch }}-{{ checksum "scripts/install-android-tools.sh" }} - - # - run: echo 'export ANDROID_HOME=~/android-tools' >> $BASH_ENV - - # - run: - # name: Install Android tools - # command: | - # sh scripts/install-android-tools.sh - # echo 'export ANDROID_SDK_HOME=$ANDROID_HOME' >> $BASH_ENV - # echo 'export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk/21.4.7075529' >> $BASH_ENV - # echo 'export PATH=$ANDROID_SDK_HOME/tools/bin:$PATH' >> $BASH_ENV - # echo 'export PATH=$ANDROID_SDK_HOME/tools:$PATH' >> $BASH_ENV - # echo 'export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH' >> $BASH_ENV - # echo 'export PATH=$ANDROID_SDK_HOME/emulator:$PATH' >> $BASH_ENV - # source $BASH_ENV - # environment: - # JAVA_HOME: /opt/homebrew/opt/openjdk@17 - - # - save_cache: - # key: android-tools-{{ arch }}-{{ checksum "scripts/install-android-tools.sh" }} - # paths: - # - ~/android-tools - - # - run: gem install bundler - - # - restore_cache: - # keys: - # - gem-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} - # - gem-v1-{{ arch }}-main-{{ checksum "Gemfile.lock" }} - - # - run: bundle install - - # - save_cache: - # key: gem-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} - # paths: - # - ~/.gem/ruby/2.7.5 - - macos/preboot-simulator: version: "17.4" platform: "iOS" @@ -203,6 +164,8 @@ jobs: mkdir -p _coverage/html cp -r $(bazel info output_path)/_coverage/_coverage_report.dat _coverage/lcov/ genhtml --branch-coverage --output-directory=_coverage/html/ "$(bazel info output_path)/_coverage/_coverage_report.dat" + zip -r _coverage/html.zip _coverage/html/ + rm -r _coverage/html/ - store_artifacts: path: _coverage