From 8e7bd879e32fc529434afc2899ecfc55e8dca8d4 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Thu, 29 Feb 2024 18:12:05 +0000 Subject: [PATCH] Add tests, update deployment target --- .../SwiftUIExample.xcodeproj/project.pbxproj | 313 +++++++----------- .../xcshareddata/swiftpm/Package.resolved | 11 +- .../xcschemes/SwiftUIExample.xcscheme | 13 + .../xcschemes/SwiftUIExampleTests.xcscheme | 54 +++ .../SwiftUIExample/SwiftUIExample/App.swift | 5 +- .../SwiftUIExample/CartView.swift | 36 +- .../SwiftUIExample/CatalogView.swift | 2 + .../SwiftUIExample/ProductViewModel.swift | 42 +-- .../SwiftUIExample/StorefrontClient.swift | 42 +-- .../SwiftUIExampleTests/AppTests.swift | 30 ++ .../CheckoutSheetTests.swift | 41 +++ .../SwiftUIExampleUITests-Bridging-Header.h | 4 + .../SwiftUIExampleUITests.swift | 75 +++++ .../SwiftUIExampleUITestsLaunchTests.swift | 40 +++ .../CheckoutWebView.swift | 6 +- .../ShopifyCheckoutSheetKit.swift | 5 - 16 files changed, 438 insertions(+), 281 deletions(-) create mode 100644 Samples/SwiftUIExample/SwiftUIExample.xcodeproj/xcshareddata/xcschemes/SwiftUIExampleTests.xcscheme create mode 100644 Samples/SwiftUIExample/SwiftUIExampleTests/AppTests.swift create mode 100644 Samples/SwiftUIExample/SwiftUIExampleTests/CheckoutSheetTests.swift create mode 100644 Samples/SwiftUIExample/SwiftUIExampleUITests-Bridging-Header.h create mode 100644 Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITests.swift create mode 100644 Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITestsLaunchTests.swift diff --git a/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.pbxproj b/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.pbxproj index 7df8df41..3c2c9fb4 100644 --- a/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.pbxproj +++ b/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 6A2DBC202B90ECBA00761222 /* SwiftUIExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2DBC1F2B90ECBA00761222 /* SwiftUIExampleUITests.swift */; }; + 6A2DBC222B90ECBA00761222 /* SwiftUIExampleUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2DBC212B90ECBA00761222 /* SwiftUIExampleUITestsLaunchTests.swift */; }; 6A71777C2B90DEB000ED3B99 /* ShopifyCheckoutSheetKit in Frameworks */ = {isa = PBXBuildFile; productRef = 6A71777B2B90DEB000ED3B99 /* ShopifyCheckoutSheetKit */; }; 6A71777E2B90DECF00ED3B99 /* Buy in Frameworks */ = {isa = PBXBuildFile; productRef = 6A71777D2B90DECF00ED3B99 /* Buy */; }; 6AC6C3902B9089B60007EA2E /* ProductViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AC6C38F2B9089B60007EA2E /* ProductViewModel.swift */; }; @@ -20,14 +22,7 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 86C569D02B15DA2D00F26028 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 86C569B72B15DA2B00F26028 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 86C569BE2B15DA2B00F26028; - remoteInfo = SwiftUIExample; - }; - 86C569DA2B15DA2D00F26028 /* PBXContainerItemProxy */ = { + 6A2DBC232B90ECBA00761222 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 86C569B72B15DA2B00F26028 /* Project object */; proxyType = 1; @@ -37,6 +32,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 6A2DBC1D2B90ECBA00761222 /* SwiftUIExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftUIExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 6A2DBC1F2B90ECBA00761222 /* SwiftUIExampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIExampleUITests.swift; sourceTree = ""; }; + 6A2DBC212B90ECBA00761222 /* SwiftUIExampleUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIExampleUITestsLaunchTests.swift; sourceTree = ""; }; 6AC6C38F2B9089B60007EA2E /* ProductViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductViewModel.swift; sourceTree = ""; }; 6ACED41A2B90A7FE00AC6947 /* CartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CartView.swift; sourceTree = ""; }; 8652C4602B1659E600A770F9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; @@ -45,40 +43,40 @@ 86C569C22B15DA2B00F26028 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = ""; }; 86C569C42B15DA2B00F26028 /* CatalogView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatalogView.swift; sourceTree = ""; }; 86C569C62B15DA2D00F26028 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 86C569CF2B15DA2D00F26028 /* SwiftUIExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftUIExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 86C569D92B15DA2D00F26028 /* SwiftUIExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftUIExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 86C569EC2B15DB0A00F26028 /* StorefrontClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorefrontClient.swift; sourceTree = ""; }; 86C569F12B15DC6F00F26028 /* StorefrontGraphQL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorefrontGraphQL.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 86C569BC2B15DA2B00F26028 /* Frameworks */ = { + 6A2DBC1A2B90ECBA00761222 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 6A71777E2B90DECF00ED3B99 /* Buy in Frameworks */, - 6A71777C2B90DEB000ED3B99 /* ShopifyCheckoutSheetKit in Frameworks */, - 6ACED4192B909C5C00AC6947 /* ShopifyCheckoutSheetKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 86C569CC2B15DA2D00F26028 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 86C569D62B15DA2D00F26028 /* Frameworks */ = { + 86C569BC2B15DA2B00F26028 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6A71777E2B90DECF00ED3B99 /* Buy in Frameworks */, + 6A71777C2B90DEB000ED3B99 /* ShopifyCheckoutSheetKit in Frameworks */, + 6ACED4192B909C5C00AC6947 /* ShopifyCheckoutSheetKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 6A2DBC1E2B90ECBA00761222 /* SwiftUIExampleUITests */ = { + isa = PBXGroup; + children = ( + 6A2DBC1F2B90ECBA00761222 /* SwiftUIExampleUITests.swift */, + 6A2DBC212B90ECBA00761222 /* SwiftUIExampleUITestsLaunchTests.swift */, + ); + path = SwiftUIExampleUITests; + sourceTree = ""; + }; 86054F802B48505A00FF808D /* packages */ = { isa = PBXGroup; children = ( @@ -99,6 +97,7 @@ 8666476C2B1642730039400B /* Storefront.xcconfig */, 86054F802B48505A00FF808D /* packages */, 86C569C12B15DA2B00F26028 /* SwiftUIExample */, + 6A2DBC1E2B90ECBA00761222 /* SwiftUIExampleUITests */, 86C569C02B15DA2B00F26028 /* Products */, 86054F872B48513700FF808D /* Frameworks */, ); @@ -108,8 +107,7 @@ isa = PBXGroup; children = ( 86C569BF2B15DA2B00F26028 /* SwiftUIExample.app */, - 86C569CF2B15DA2D00F26028 /* SwiftUIExampleTests.xctest */, - 86C569D92B15DA2D00F26028 /* SwiftUIExampleUITests.xctest */, + 6A2DBC1D2B90ECBA00761222 /* SwiftUIExampleUITests.xctest */, ); name = Products; sourceTree = ""; @@ -132,6 +130,24 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 6A2DBC1C2B90ECBA00761222 /* SwiftUIExampleUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6A2DBC252B90ECBA00761222 /* Build configuration list for PBXNativeTarget "SwiftUIExampleUITests" */; + buildPhases = ( + 6A2DBC192B90ECBA00761222 /* Sources */, + 6A2DBC1A2B90ECBA00761222 /* Frameworks */, + 6A2DBC1B2B90ECBA00761222 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 6A2DBC242B90ECBA00761222 /* PBXTargetDependency */, + ); + name = SwiftUIExampleUITests; + productName = SwiftUIExampleUITests; + productReference = 6A2DBC1D2B90ECBA00761222 /* SwiftUIExampleUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; 86C569BE2B15DA2B00F26028 /* SwiftUIExample */ = { isa = PBXNativeTarget; buildConfigurationList = 86C569E32B15DA2D00F26028 /* Build configuration list for PBXNativeTarget "SwiftUIExample" */; @@ -155,42 +171,6 @@ productReference = 86C569BF2B15DA2B00F26028 /* SwiftUIExample.app */; productType = "com.apple.product-type.application"; }; - 86C569CE2B15DA2D00F26028 /* SwiftUIExampleTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 86C569E62B15DA2D00F26028 /* Build configuration list for PBXNativeTarget "SwiftUIExampleTests" */; - buildPhases = ( - 86C569CB2B15DA2D00F26028 /* Sources */, - 86C569CC2B15DA2D00F26028 /* Frameworks */, - 86C569CD2B15DA2D00F26028 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 86C569D12B15DA2D00F26028 /* PBXTargetDependency */, - ); - name = SwiftUIExampleTests; - productName = SwiftUIExampleTests; - productReference = 86C569CF2B15DA2D00F26028 /* SwiftUIExampleTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 86C569D82B15DA2D00F26028 /* SwiftUIExampleUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 86C569E92B15DA2D00F26028 /* Build configuration list for PBXNativeTarget "SwiftUIExampleUITests" */; - buildPhases = ( - 86C569D52B15DA2D00F26028 /* Sources */, - 86C569D62B15DA2D00F26028 /* Frameworks */, - 86C569D72B15DA2D00F26028 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 86C569DB2B15DA2D00F26028 /* PBXTargetDependency */, - ); - name = SwiftUIExampleUITests; - productName = SwiftUIExampleUITests; - productReference = 86C569D92B15DA2D00F26028 /* SwiftUIExampleUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -198,19 +178,15 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1500; + LastSwiftUpdateCheck = 1520; LastUpgradeCheck = 1500; TargetAttributes = { - 86C569BE2B15DA2B00F26028 = { - CreatedOnToolsVersion = 15.0.1; - }; - 86C569CE2B15DA2D00F26028 = { - CreatedOnToolsVersion = 15.0.1; + 6A2DBC1C2B90ECBA00761222 = { + CreatedOnToolsVersion = 15.2; TestTargetID = 86C569BE2B15DA2B00F26028; }; - 86C569D82B15DA2D00F26028 = { + 86C569BE2B15DA2B00F26028 = { CreatedOnToolsVersion = 15.0.1; - TestTargetID = 86C569BE2B15DA2B00F26028; }; }; }; @@ -232,32 +208,24 @@ projectRoot = ""; targets = ( 86C569BE2B15DA2B00F26028 /* SwiftUIExample */, - 86C569CE2B15DA2D00F26028 /* SwiftUIExampleTests */, - 86C569D82B15DA2D00F26028 /* SwiftUIExampleUITests */, + 6A2DBC1C2B90ECBA00761222 /* SwiftUIExampleUITests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 86C569BD2B15DA2B00F26028 /* Resources */ = { + 6A2DBC1B2B90ECBA00761222 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 86C569C72B15DA2D00F26028 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 86C569CD2B15DA2D00F26028 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 86C569D72B15DA2D00F26028 /* Resources */ = { + 86C569BD2B15DA2B00F26028 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 86C569C72B15DA2D00F26028 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -286,6 +254,15 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 6A2DBC192B90ECBA00761222 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6A2DBC202B90ECBA00761222 /* SwiftUIExampleUITests.swift in Sources */, + 6A2DBC222B90ECBA00761222 /* SwiftUIExampleUITestsLaunchTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 86C569BB2B15DA2B00F26028 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -299,36 +276,53 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 86C569CB2B15DA2D00F26028 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 86C569D52B15DA2D00F26028 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 86C569D12B15DA2D00F26028 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 86C569BE2B15DA2B00F26028 /* SwiftUIExample */; - targetProxy = 86C569D02B15DA2D00F26028 /* PBXContainerItemProxy */; - }; - 86C569DB2B15DA2D00F26028 /* PBXTargetDependency */ = { + 6A2DBC242B90ECBA00761222 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 86C569BE2B15DA2B00F26028 /* SwiftUIExample */; - targetProxy = 86C569DA2B15DA2D00F26028 /* PBXContainerItemProxy */; + targetProxy = 6A2DBC232B90ECBA00761222 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 6A2DBC262B90ECBA00761222 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7XGC83MZE; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.2; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.Shopify.SwiftUIExampleUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = SwiftUIExample; + }; + name = Debug; + }; + 6A2DBC272B90ECBA00761222 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = A7XGC83MZE; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.2; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.Shopify.SwiftUIExampleUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = SwiftUIExample; + }; + name = Release; + }; 86C569E12B15DA2D00F26028 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 8666476C2B1642730039400B /* Storefront.xcconfig */; @@ -386,7 +380,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -448,7 +442,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; @@ -474,8 +468,9 @@ INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = UIInterfaceOrientationPortrait; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -505,8 +500,9 @@ INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = UIInterfaceOrientationPortrait; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -520,117 +516,32 @@ }; name = Release; }; - 86C569E72B15DA2D00F26028 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = A7XGC83MZE; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.shopify.SwiftUIExampleTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUIExample.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SwiftUIExample"; - }; - name = Debug; - }; - 86C569E82B15DA2D00F26028 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = A7XGC83MZE; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.shopify.SwiftUIExampleTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUIExample.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SwiftUIExample"; - }; - name = Release; - }; - 86C569EA2B15DA2D00F26028 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = A7XGC83MZE; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.shopify.SwiftUIExampleUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = SwiftUIExample; - }; - name = Debug; - }; - 86C569EB2B15DA2D00F26028 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = A7XGC83MZE; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.shopify.SwiftUIExampleUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = SwiftUIExample; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 86C569BA2B15DA2B00F26028 /* Build configuration list for PBXProject "SwiftUIExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 86C569E12B15DA2D00F26028 /* Debug */, - 86C569E22B15DA2D00F26028 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 86C569E32B15DA2D00F26028 /* Build configuration list for PBXNativeTarget "SwiftUIExample" */ = { + 6A2DBC252B90ECBA00761222 /* Build configuration list for PBXNativeTarget "SwiftUIExampleUITests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 86C569E42B15DA2D00F26028 /* Debug */, - 86C569E52B15DA2D00F26028 /* Release */, + 6A2DBC262B90ECBA00761222 /* Debug */, + 6A2DBC272B90ECBA00761222 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 86C569E62B15DA2D00F26028 /* Build configuration list for PBXNativeTarget "SwiftUIExampleTests" */ = { + 86C569BA2B15DA2B00F26028 /* Build configuration list for PBXProject "SwiftUIExample" */ = { isa = XCConfigurationList; buildConfigurations = ( - 86C569E72B15DA2D00F26028 /* Debug */, - 86C569E82B15DA2D00F26028 /* Release */, + 86C569E12B15DA2D00F26028 /* Debug */, + 86C569E22B15DA2D00F26028 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 86C569E92B15DA2D00F26028 /* Build configuration list for PBXNativeTarget "SwiftUIExampleUITests" */ = { + 86C569E32B15DA2D00F26028 /* Build configuration list for PBXNativeTarget "SwiftUIExample" */ = { isa = XCConfigurationList; buildConfigurations = ( - 86C569EA2B15DA2D00F26028 /* Debug */, - 86C569EB2B15DA2D00F26028 /* Release */, + 86C569E42B15DA2D00F26028 /* Debug */, + 86C569E52B15DA2D00F26028 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9fad30c7..e39572f0 100644 --- a/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,18 +5,9 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Shopify/mobile-buy-sdk-ios", "state" : { - "revision" : "e6e85dcf8f9eb95baaa8336ad3d7967ea8c36ade", + "revision" : "3a6ecdce6b9e8f356078fbdc2b738ac32cd18153", "version" : "11.3.0" } - }, - { - "identity" : "swiftlintplugin", - "kind" : "remoteSourceControl", - "location" : "https://github.com/lukepistrol/SwiftLintPlugin", - "state" : { - "revision" : "ea6d3ca895b49910f790e98e4b4ca658e0fe490e", - "version" : "0.54.0" - } } ], "version" : 2 diff --git a/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/xcshareddata/xcschemes/SwiftUIExample.xcscheme b/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/xcshareddata/xcschemes/SwiftUIExample.xcscheme index 9bdd2690..0691c865 100644 --- a/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/xcshareddata/xcschemes/SwiftUIExample.xcscheme +++ b/Samples/SwiftUIExample/SwiftUIExample.xcodeproj/xcshareddata/xcschemes/SwiftUIExample.xcscheme @@ -28,6 +28,19 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES" shouldAutocreateTestPlan = "YES"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/SwiftUIExample/SwiftUIExample/App.swift b/Samples/SwiftUIExample/SwiftUIExample/App.swift index 745aada5..8280ebfb 100644 --- a/Samples/SwiftUIExample/SwiftUIExample/App.swift +++ b/Samples/SwiftUIExample/SwiftUIExample/App.swift @@ -49,6 +49,7 @@ struct RootTabView: View { CatalogView(cartManager: cartManager, checkoutURL: $checkoutURL, cart: $cartManager.cart) .tabItem { SwiftUI.Image(systemName: "storefront") + .accessibilityIdentifier("catalogTabIcon") Text("Catalog") } @@ -69,8 +70,10 @@ struct RootTabView: View { } } } - }.tabItem { + } + .tabItem { SwiftUI.Image(systemName: "cart") + .accessibilityIdentifier("cartTabIcon") Text("Cart") } } diff --git a/Samples/SwiftUIExample/SwiftUIExample/CartView.swift b/Samples/SwiftUIExample/SwiftUIExample/CartView.swift index ea571820..0b544c21 100644 --- a/Samples/SwiftUIExample/SwiftUIExample/CartView.swift +++ b/Samples/SwiftUIExample/SwiftUIExample/CartView.swift @@ -1,25 +1,25 @@ /* - MIT License +MIT License - Copyright 2023 - Present, Shopify Inc. +Copyright 2023 - Present, Shopify Inc. - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ import Buy import SwiftUI @@ -45,6 +45,7 @@ struct CartView: View { }, label: { Text("Checkout") }) + .accessibilityIdentifier("checkoutButton") .padding() .frame(maxWidth: .infinity) .background(Color.blue) @@ -75,6 +76,7 @@ struct CartView: View { print(error) } .edgesIgnoringSafeArea(.all) + .accessibility(identifier: "CheckoutSheet") } } .padding(.top, 20) diff --git a/Samples/SwiftUIExample/SwiftUIExample/CatalogView.swift b/Samples/SwiftUIExample/SwiftUIExample/CatalogView.swift index 926417d9..a367ce06 100644 --- a/Samples/SwiftUIExample/SwiftUIExample/CatalogView.swift +++ b/Samples/SwiftUIExample/SwiftUIExample/CatalogView.swift @@ -93,6 +93,7 @@ struct CatalogView: View { .font(.headline) } }) + .accessibilityIdentifier("addToCartButton") .padding() .frame(maxWidth: 400) .background(Color.blue) @@ -131,6 +132,7 @@ struct CatalogView: View { BadgeButton(badgeCount: Int(cartManager.cart?.totalQuantity ?? 0), action: { isShowingCart = true }) + .accessibilityIdentifier("cartIcon") Button(action: { onAppear() diff --git a/Samples/SwiftUIExample/SwiftUIExample/ProductViewModel.swift b/Samples/SwiftUIExample/SwiftUIExample/ProductViewModel.swift index 9a782241..75da8dcc 100644 --- a/Samples/SwiftUIExample/SwiftUIExample/ProductViewModel.swift +++ b/Samples/SwiftUIExample/SwiftUIExample/ProductViewModel.swift @@ -1,25 +1,25 @@ /* - MIT License +MIT License - Copyright 2023 - Present, Shopify Inc. +Copyright 2023 - Present, Shopify Inc. - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ import Buy import Combine @@ -47,10 +47,10 @@ public class CartManager: ObservableObject { func addItem(variant: GraphQL.ID, completionHandler: ((Storefront.Cart?) -> Void)?) { performCartLinesAdd(item: variant) { result in switch result { - case .success(let cart): - self.cart = cart - case .failure(let error): - print(error) + case .success(let cart): + self.cart = cart + case .failure(let error): + print(error) } completionHandler?(self.cart) } diff --git a/Samples/SwiftUIExample/SwiftUIExample/StorefrontClient.swift b/Samples/SwiftUIExample/SwiftUIExample/StorefrontClient.swift index 2dae375e..1f1704ee 100644 --- a/Samples/SwiftUIExample/SwiftUIExample/StorefrontClient.swift +++ b/Samples/SwiftUIExample/SwiftUIExample/StorefrontClient.swift @@ -1,25 +1,25 @@ /* - MIT License - - Copyright 2023 - Present, Shopify Inc. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +MIT License + +Copyright 2023 - Present, Shopify Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ import Buy import Foundation diff --git a/Samples/SwiftUIExample/SwiftUIExampleTests/AppTests.swift b/Samples/SwiftUIExample/SwiftUIExampleTests/AppTests.swift new file mode 100644 index 00000000..44475383 --- /dev/null +++ b/Samples/SwiftUIExample/SwiftUIExampleTests/AppTests.swift @@ -0,0 +1,30 @@ +import XCTest + +class AppTests: XCTestCase { + + var app: XCUIApplication! + + override func setUp() { + super.setUp() + continueAfterFailure = false + app = XCUIApplication() + app.launch() + } + + func testCheckoutSheetTitle() { + // Wait for the "Add to Cart" button to become available + let addToCartButton = app.buttons["addToCartButton"] + let exists = NSPredicate(format: "exists == true") + expectation(for: exists, evaluatedWith: addToCartButton, handler: nil) + waitForExpectations(timeout: 5, handler: nil) + + // Tap the "Add to Cart" button + addToCartButton.tap() + + // Find the "Checkout" title + let checkoutTitle = app.navigationBars["CheckoutSheet"] + + // Check if the title exists + XCTAssertTrue(checkoutTitle.exists) + } +} diff --git a/Samples/SwiftUIExample/SwiftUIExampleTests/CheckoutSheetTests.swift b/Samples/SwiftUIExample/SwiftUIExampleTests/CheckoutSheetTests.swift new file mode 100644 index 00000000..8667439d --- /dev/null +++ b/Samples/SwiftUIExample/SwiftUIExampleTests/CheckoutSheetTests.swift @@ -0,0 +1,41 @@ +// +// CheckoutSheetTests.swift +// SwiftUIExample +// +// Created by Mark Murray on 29/02/2024. +// + +import XCTest + +final class CheckoutSheetTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/Samples/SwiftUIExample/SwiftUIExampleUITests-Bridging-Header.h b/Samples/SwiftUIExample/SwiftUIExampleUITests-Bridging-Header.h new file mode 100644 index 00000000..1b2cb5d6 --- /dev/null +++ b/Samples/SwiftUIExample/SwiftUIExampleUITests-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITests.swift b/Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITests.swift new file mode 100644 index 00000000..2c0cf6f0 --- /dev/null +++ b/Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITests.swift @@ -0,0 +1,75 @@ +/* +MIT License + +Copyright 2023 - Present, Shopify Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +import XCTest + +final class SwiftUIExampleUITests: XCTestCase { + + override func setUpWithError() throws { + continueAfterFailure = false + } + + private func openCheckoutFromCartSheet(_ app: XCUIApplication) { + app.buttons["addToCartButton"].tap() + app.buttons["cartIcon"].tap() + app.buttons["checkoutButton"].tap() + } + + private func openCheckoutFromCartView(_ app: XCUIApplication) { + app.buttons["addToCartButton"].tap() + app.buttons["cartTabIcon"].tap() + app.buttons["checkoutButton"].tap() + } + + private func expectCheckoutToContain(_ element: XCUIElement) { + let exists = NSPredicate(format: "exists == true") + expectation(for: exists, evaluatedWith: element, handler: nil) + waitForExpectations(timeout: 10, handler: nil) + XCTAssertTrue(element.exists) + } + + func testCheckoutSheetHasCustomTitle() { + let app = XCUIApplication() + + app.launch() + + openCheckoutFromCartSheet(app) + + XCTAssertTrue(app.staticTexts["SwiftUI"].exists) + + expectCheckoutToContain(app.staticTexts["Contact"]) + expectCheckoutToContain(app.staticTexts["Delivery"]) + } + + func testCheckoutViewHasCustomTitle() { + let app = XCUIApplication() + + app.launch() + + openCheckoutFromCartView(app) + + XCTAssertTrue(app.staticTexts["SwiftUI"].exists) + expectCheckoutToContain(app.staticTexts["Contact"]) + expectCheckoutToContain(app.staticTexts["Delivery"]) + } +} diff --git a/Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITestsLaunchTests.swift b/Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITestsLaunchTests.swift new file mode 100644 index 00000000..3e32979e --- /dev/null +++ b/Samples/SwiftUIExample/SwiftUIExampleUITests/SwiftUIExampleUITestsLaunchTests.swift @@ -0,0 +1,40 @@ +/* + MIT License + + Copyright 2023 - Present, Shopify Inc. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +import XCTest + +final class SwiftUIExampleUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + } +} diff --git a/Sources/ShopifyCheckoutSheetKit/CheckoutWebView.swift b/Sources/ShopifyCheckoutSheetKit/CheckoutWebView.swift index 840a658e..623a5e20 100644 --- a/Sources/ShopifyCheckoutSheetKit/CheckoutWebView.swift +++ b/Sources/ShopifyCheckoutSheetKit/CheckoutWebView.swift @@ -280,11 +280,7 @@ extension CheckoutWebView: WKNavigationDelegate { extension CheckoutWebView { fileprivate struct CacheEntry { - var key: String { - didSet { - print("Set cache key:", key) - } - } + var key: String let view: CheckoutWebView diff --git a/Sources/ShopifyCheckoutSheetKit/ShopifyCheckoutSheetKit.swift b/Sources/ShopifyCheckoutSheetKit/ShopifyCheckoutSheetKit.swift index 3f8608e4..110a2b08 100644 --- a/Sources/ShopifyCheckoutSheetKit/ShopifyCheckoutSheetKit.swift +++ b/Sources/ShopifyCheckoutSheetKit/ShopifyCheckoutSheetKit.swift @@ -56,8 +56,3 @@ public func preload(checkout url: URL) { public func present(checkout url: URL, from: UIViewController, delegate: CheckoutDelegate? = nil) { from.present(CheckoutViewController(checkout: url, delegate: delegate), animated: true) } - -/// This is not used anywhere? -// public func presentRepresentable(checkout url: URL, delegate: CheckoutDelegate? = nil) { -// -// }