diff --git a/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj b/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj index 7f66246ef..13a049c99 100644 --- a/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/patrol/example/ios/Runner.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 983964DC2978A956007EB76F /* RunnerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 983964DB2978A956007EB76F /* RunnerUITests.m */; }; + 9862560529F9A72100B267FA /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9862560429F9A72100B267FA /* RunnerTests.swift */; }; FA27315210C24EEDF8E3A8C2 /* Pods_Runner_RunnerUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93E89E9CC733F51B93EF71E1 /* Pods_Runner_RunnerUITests.framework */; }; /* End PBXBuildFile section */ @@ -26,6 +27,13 @@ remoteGlobalIDString = 97C146ED1CF9000F007C117D; remoteInfo = Runner; }; + 9862560629F9A72100B267FA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -63,6 +71,9 @@ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 983964D92978A956007EB76F /* RunnerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 983964DB2978A956007EB76F /* RunnerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RunnerUITests.m; sourceTree = ""; }; + 98575F2E29FA960A00AF8421 /* RunnerTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RunnerTests-Bridging-Header.h"; sourceTree = ""; }; + 9862560229F9A72100B267FA /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 9862560429F9A72100B267FA /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; B447E7B3C41089DE3953018D /* Pods-Runner-RunnerUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-RunnerUITests.release.xcconfig"; path = "Target Support Files/Pods-Runner-RunnerUITests/Pods-Runner-RunnerUITests.release.xcconfig"; sourceTree = ""; }; B67A70BD9498C1A200C5D078 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -84,6 +95,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 986255FF29F9A72100B267FA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -117,6 +135,7 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 983964DA2978A956007EB76F /* RunnerUITests */, + 9862560329F9A72100B267FA /* RunnerTests */, 97C146EF1CF9000F007C117D /* Products */, 71514460146D120DA8711EC5 /* Pods */, E54C552FCC7A91D75B1E4F09 /* Frameworks */, @@ -128,6 +147,7 @@ children = ( 97C146EE1CF9000F007C117D /* Runner.app */, 983964D92978A956007EB76F /* RunnerUITests.xctest */, + 9862560229F9A72100B267FA /* RunnerTests.xctest */, ); name = Products; sourceTree = ""; @@ -155,6 +175,15 @@ path = RunnerUITests; sourceTree = ""; }; + 9862560329F9A72100B267FA /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 98575F2E29FA960A00AF8421 /* RunnerTests-Bridging-Header.h */, + 9862560429F9A72100B267FA /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; E54C552FCC7A91D75B1E4F09 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -211,6 +240,24 @@ productReference = 983964D92978A956007EB76F /* RunnerUITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; + 9862560129F9A72100B267FA /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9862560B29F9A72100B267FA /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 986255FE29F9A72100B267FA /* Sources */, + 986255FF29F9A72100B267FA /* Frameworks */, + 9862560029F9A72100B267FA /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 9862560729F9A72100B267FA /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 9862560229F9A72100B267FA /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -229,6 +276,11 @@ CreatedOnToolsVersion = 14.2; TestTargetID = 97C146ED1CF9000F007C117D; }; + 9862560129F9A72100B267FA = { + CreatedOnToolsVersion = 14.3; + LastSwiftMigration = 1430; + TestTargetID = 97C146ED1CF9000F007C117D; + }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; @@ -246,6 +298,7 @@ targets = ( 97C146ED1CF9000F007C117D /* Runner */, 983964D82978A956007EB76F /* RunnerUITests */, + 9862560129F9A72100B267FA /* RunnerTests */, ); }; /* End PBXProject section */ @@ -269,6 +322,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 9862560029F9A72100B267FA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -434,6 +494,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 986255FE29F9A72100B267FA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9862560529F9A72100B267FA /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -442,6 +510,11 @@ target = 97C146ED1CF9000F007C117D /* Runner */; targetProxy = 983964DF2978A956007EB76F /* PBXContainerItemProxy */; }; + 9862560729F9A72100B267FA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 9862560629F9A72100B267FA /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -767,6 +840,93 @@ }; name = Profile; }; + 9862560829F9A72100B267FA /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U3EG6EALX7; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = pl.leancode.patrol.Example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "RunnerTests/RunnerTests-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 9862560929F9A72100B267FA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U3EG6EALX7; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = pl.leancode.patrol.Example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "RunnerTests/RunnerTests-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 9862560A29F9A72100B267FA /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U3EG6EALX7; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = pl.leancode.patrol.Example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "RunnerTests/RunnerTests-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -800,6 +960,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + 9862560B29F9A72100B267FA /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9862560829F9A72100B267FA /* Debug */, + 9862560929F9A72100B267FA /* Release */, + 9862560A29F9A72100B267FA /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; diff --git a/packages/patrol/example/ios/RunnerTests/RunnerTests-Bridging-Header.h b/packages/patrol/example/ios/RunnerTests/RunnerTests-Bridging-Header.h new file mode 100644 index 000000000..012eb7af3 --- /dev/null +++ b/packages/patrol/example/ios/RunnerTests/RunnerTests-Bridging-Header.h @@ -0,0 +1,6 @@ +// +// Use this file to import your target's public headers that you would like to +// expose to Swift. +// + +#import "PatrolIntegrationTestRunner.h" diff --git a/packages/patrol/example/ios/RunnerTests/RunnerTests.swift b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 000000000..a72ddeb7f --- /dev/null +++ b/packages/patrol/example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,42 @@ +// TODO: Run these tests on CI + +import XCTest +import patrol + +final class RunnerTests: XCTestCase { + func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithDotAndUnderscore() { + let input = "example.example_test" + let expectedOutput = "example_exampleTest" + + let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) + XCTAssertEqual(result, expectedOutput) + } + + func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithUnderscoreOnly() { + let input = "example_test" + let expectedOutput = "exampleTest" + let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) + XCTAssertEqual(result, expectedOutput) + } + + func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithMultipleDotsAndUnderscores() { + let input = "flows.login.sign_in" + let expectedOutput = "flows_login_signIn" + let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) + XCTAssertEqual(result, expectedOutput) + } + + func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithSingleComponent() { + let input = "single" + let expectedOutput = "single" + let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) + XCTAssertEqual(result, expectedOutput) + } + + func testCreateMethodNameFromPatrolGeneratedGroup_ExampleWithEmptyString() { + let input = "" + let expectedOutput = "" + let result = PatrolUtils.createMethodName(fromPatrolGeneratedGroup: input) + XCTAssertEqual(result, expectedOutput) + } +}