Skip to content

Commit

Permalink
[Test] add ui testing
Browse files Browse the repository at this point in the history
  • Loading branch information
zhgchgli0718 committed Feb 28, 2024
1 parent 0dfac02 commit 8971f61
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 7 deletions.
123 changes: 119 additions & 4 deletions PokemonGuider.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
1E37DD3C2B8F043F00045F6A /* PokemonUseCaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E37DD3B2B8F043F00045F6A /* PokemonUseCaseTests.swift */; };
1E37DD3E2B8F09B000045F6A /* PokemonListViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E37DD3D2B8F09B000045F6A /* PokemonListViewModelTests.swift */; };
1E37DD402B8F0E8000045F6A /* PokemonDetailViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E37DD3F2B8F0E8000045F6A /* PokemonDetailViewModelTests.swift */; };
1E37DD572B8F1A1400045F6A /* PokemonGuiderUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E37DD562B8F1A1400045F6A /* PokemonGuiderUITests.swift */; };
1E37DD592B8F1A1400045F6A /* PokemonGuiderUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E37DD582B8F1A1400045F6A /* PokemonGuiderUITestsLaunchTests.swift */; };
1E6EAC102B899973004CC1D2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6EAC0F2B899973004CC1D2 /* AppDelegate.swift */; };
1E6EAC122B899973004CC1D2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6EAC112B899973004CC1D2 /* SceneDelegate.swift */; };
1E6EAC1A2B899973004CC1D2 /* PokemonGuider.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1E6EAC182B899973004CC1D2 /* PokemonGuider.xcdatamodeld */; };
Expand Down Expand Up @@ -78,6 +80,13 @@
remoteGlobalIDString = 1E6EAC0B2B899973004CC1D2;
remoteInfo = PokemonGuider;
};
1E37DD5A2B8F1A1400045F6A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1E6EAC042B899973004CC1D2 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1E6EAC0B2B899973004CC1D2;
remoteInfo = PokemonGuider;
};
1E6EAC262B899975004CC1D2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1E6EAC042B899973004CC1D2 /* Project object */;
Expand Down Expand Up @@ -117,6 +126,9 @@
1E37DD3B2B8F043F00045F6A /* PokemonUseCaseTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PokemonUseCaseTests.swift; sourceTree = "<group>"; };
1E37DD3D2B8F09B000045F6A /* PokemonListViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PokemonListViewModelTests.swift; sourceTree = "<group>"; };
1E37DD3F2B8F0E8000045F6A /* PokemonDetailViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PokemonDetailViewModelTests.swift; sourceTree = "<group>"; };
1E37DD542B8F1A1400045F6A /* PokemonGuiderUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PokemonGuiderUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
1E37DD562B8F1A1400045F6A /* PokemonGuiderUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PokemonGuiderUITests.swift; sourceTree = "<group>"; };
1E37DD582B8F1A1400045F6A /* PokemonGuiderUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PokemonGuiderUITestsLaunchTests.swift; sourceTree = "<group>"; };
1E6EAC0C2B899973004CC1D2 /* PokemonGuider.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PokemonGuider.app; sourceTree = BUILT_PRODUCTS_DIR; };
1E6EAC0F2B899973004CC1D2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
1E6EAC112B899973004CC1D2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -161,6 +173,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
1E37DD512B8F1A1400045F6A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1E6EAC092B899973004CC1D2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -242,13 +261,23 @@
path = Stub;
sourceTree = "<group>";
};
1E37DD552B8F1A1400045F6A /* PokemonGuiderUITests */ = {
isa = PBXGroup;
children = (
1E37DD562B8F1A1400045F6A /* PokemonGuiderUITests.swift */,
1E37DD582B8F1A1400045F6A /* PokemonGuiderUITestsLaunchTests.swift */,
);
path = PokemonGuiderUITests;
sourceTree = "<group>";
};
1E6EAC032B899973004CC1D2 = {
isa = PBXGroup;
children = (
1E37DD2C2B8EDED700045F6A /* PokemonGuider.xctestplan */,
1E6EAC0E2B899973004CC1D2 /* PokemonGuider */,
1E6EAC282B899975004CC1D2 /* PokemonGuiderTests */,
1E32F7C72B8A344500EBA22C /* PokemonGuiderSnapshotTests */,
1E37DD552B8F1A1400045F6A /* PokemonGuiderUITests */,
1E6EAC0D2B899973004CC1D2 /* Products */,
1E8B614C2B8A2D440095BA7B /* Frameworks */,
);
Expand All @@ -260,6 +289,7 @@
1E6EAC0C2B899973004CC1D2 /* PokemonGuider.app */,
1E6EAC252B899975004CC1D2 /* PokemonGuiderTests.xctest */,
1E32F7C62B8A344500EBA22C /* PokemonGuiderSnapshotTests.xctest */,
1E37DD542B8F1A1400045F6A /* PokemonGuiderUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -489,6 +519,24 @@
productReference = 1E32F7C62B8A344500EBA22C /* PokemonGuiderSnapshotTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
1E37DD532B8F1A1400045F6A /* PokemonGuiderUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1E37DD5C2B8F1A1400045F6A /* Build configuration list for PBXNativeTarget "PokemonGuiderUITests" */;
buildPhases = (
1E37DD502B8F1A1400045F6A /* Sources */,
1E37DD512B8F1A1400045F6A /* Frameworks */,
1E37DD522B8F1A1400045F6A /* Resources */,
);
buildRules = (
);
dependencies = (
1E37DD5B2B8F1A1400045F6A /* PBXTargetDependency */,
);
name = PokemonGuiderUITests;
productName = PokemonGuiderUITests;
productReference = 1E37DD542B8F1A1400045F6A /* PokemonGuiderUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
1E6EAC0B2B899973004CC1D2 /* PokemonGuider */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1E6EAC392B899975004CC1D2 /* Build configuration list for PBXNativeTarget "PokemonGuider" */;
Expand Down Expand Up @@ -545,6 +593,10 @@
CreatedOnToolsVersion = 15.2;
TestTargetID = 1E6EAC0B2B899973004CC1D2;
};
1E37DD532B8F1A1400045F6A = {
CreatedOnToolsVersion = 15.2;
TestTargetID = 1E6EAC0B2B899973004CC1D2;
};
1E6EAC0B2B899973004CC1D2 = {
CreatedOnToolsVersion = 15.2;
};
Expand Down Expand Up @@ -577,6 +629,7 @@
1E6EAC0B2B899973004CC1D2 /* PokemonGuider */,
1E6EAC242B899975004CC1D2 /* PokemonGuiderTests */,
1E32F7C52B8A344500EBA22C /* PokemonGuiderSnapshotTests */,
1E37DD532B8F1A1400045F6A /* PokemonGuiderUITests */,
);
};
/* End PBXProject section */
Expand All @@ -589,6 +642,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
1E37DD522B8F1A1400045F6A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1E6EAC0A2B899973004CC1D2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -622,6 +682,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
1E37DD502B8F1A1400045F6A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1E37DD592B8F1A1400045F6A /* PokemonGuiderUITestsLaunchTests.swift in Sources */,
1E37DD572B8F1A1400045F6A /* PokemonGuiderUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1E6EAC082B899973004CC1D2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -690,6 +759,11 @@
target = 1E6EAC0B2B899973004CC1D2 /* PokemonGuider */;
targetProxy = 1E32F7CA2B8A344500EBA22C /* PBXContainerItemProxy */;
};
1E37DD5B2B8F1A1400045F6A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1E6EAC0B2B899973004CC1D2 /* PokemonGuider */;
targetProxy = 1E37DD5A2B8F1A1400045F6A /* PBXContainerItemProxy */;
};
1E6EAC272B899975004CC1D2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1E6EAC0B2B899973004CC1D2 /* PokemonGuider */;
Expand Down Expand Up @@ -755,6 +829,40 @@
};
name = Release;
};
1E37DD5D2B8F1A1400045F6A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4U9BQ9X87W;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = li.zhgchg.PokemonGuiderUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = PokemonGuider;
};
name = Debug;
};
1E37DD5E2B8F1A1400045F6A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4U9BQ9X87W;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = li.zhgchg.PokemonGuiderUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = PokemonGuider;
};
name = Release;
};
1E6EAC372B899975004CC1D2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -892,8 +1000,7 @@
INFOPLIST_KEY_CFBundleDisplayName = "Pokemon Guider";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -922,8 +1029,7 @@
INFOPLIST_KEY_CFBundleDisplayName = "Pokemon Guider";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -990,6 +1096,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1E37DD5C2B8F1A1400045F6A /* Build configuration list for PBXNativeTarget "PokemonGuiderUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1E37DD5D2B8F1A1400045F6A /* Debug */,
1E37DD5E2B8F1A1400045F6A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1E6EAC072B899973004CC1D2 /* Build configuration list for PBXProject "PokemonGuider" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "44"
endingLineNumber = "44"
landmarkName = "configure(indexPath:viewObject:)"
landmarkName = "configure(viewObject:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
Expand Down Expand Up @@ -46,8 +46,8 @@
filePath = "PokemonGuiderTests/CoordinatorTests.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "25"
endingLineNumber = "25"
startingLineNumber = "52"
endingLineNumber = "52"
landmarkName = "testPokemonCoordinator()"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -355,5 +355,69 @@
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "2014B319-6B14-4BB3-B66B-78A18E19B3AC"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "PokemonGuider/Sources/Home/HomeCoordinator.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "71"
endingLineNumber = "71"
landmarkName = "tabBarDidSelect(_:didSelect:index:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6CBBEE91-C498-42BA-B25F-2193F37587F0"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "PokemonGuiderUITests/PokemonGuiderUITests.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "41"
endingLineNumber = "41"
landmarkName = "testTapPokemonToDetail()"
landmarkType = "7">
<Locations>
<Location
uuid = "6CBBEE91-C498-42BA-B25F-2193F37587F0 - 9b57fe65d859154a"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "PokemonGuiderUITests.PokemonGuiderUITests.testTapPokemonToDetail() throws -&gt; ()"
moduleName = "PokemonGuiderUITests"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhgchgli/Documents/Projects/PokemonGuider/PokemonGuiderUITests/PokemonGuiderUITests.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "43"
endingLineNumber = "43"
offsetFromSymbolStart = "92">
</Location>
<Location
uuid = "6CBBEE91-C498-42BA-B25F-2193F37587F0 - 9b57fe65d859156d"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "PokemonGuiderUITests.PokemonGuiderUITests.testTapPokemonToDetail() throws -&gt; ()"
moduleName = "PokemonGuiderUITests"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/zhgchgli/Documents/Projects/PokemonGuider/PokemonGuiderUITests/PokemonGuiderUITests.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "44"
endingLineNumber = "44"
offsetFromSymbolStart = "92">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
2 changes: 2 additions & 0 deletions PokemonGuider/Sources/Home/HomeCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ private extension HomeCoordinator {
navigationController.title = NSLocalizedString("pokemon_list", comment: "所有寶可夢")
navigationController.tabBarItem.image = UIImage(systemName: "lizard.circle")
navigationController.navigationBar.prefersLargeTitles = true
navigationController.tabBarItem.accessibilityIdentifier = "pokemonList"
return (navigationController, coordinator)
case .myProfile:
let navigationController = UINavigationController()
let coordinator = MyProfileCoordinator(navigationController: navigationController)
navigationController.title = NSLocalizedString("my_profile", comment: "我的帳戶")
navigationController.tabBarItem.image = UIImage(systemName: "person.crop.circle")
navigationController.tabBarItem.accessibilityIdentifier = "myProfile"
return (navigationController, coordinator)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ private extension PokemonCollectionViewCell {

func makeNameLabel() -> UILabel {
let label = UILabel()
label.accessibilityIdentifier = "pokemonName"
label.font = .systemFont(ofSize: 14, weight: .heavy)
label.textColor = .navy
return label
Expand Down
Loading

0 comments on commit 8971f61

Please sign in to comment.