Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Add fastlane commands for building & testing separately #22316

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 65 additions & 29 deletions ios/brave-ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,55 @@ fastlane_version "2.86.0"
default_platform :ios

platform :ios do
desc "Run Unit Tests"
desc "Deprecated: use build_for_testing and test_without_build"
lane :test do |options|
run_tests(
project: "App/Client.xcodeproj",
scheme: "Debug",
defaultScanParams = scan_params()
run_tests(defaultScanParams.merge!({
devices: ["iPhone 15"],
code_coverage: true,
output_types: "junit",
output_files: "junit.xml",
ensure_devices_found: true,
derived_data_path: "../../../out/DerivedData",
skip_testing: [
"BraveWalletTests/ManageSiteConnectionsStoreTests/testRemoveAllPermissions",
"BraveWalletTests/ManageSiteConnectionsStoreTests/testRemovePermissions",
"BraveWalletTests/ManageSiteConnectionsStoreTests/testRemovePermissionsLastPermission",
"BraveWalletTests/SendTokenStoreTests/testResolvedAddressUsedInSolTxIfAvailable",
"BraveWalletTests/SendTokenStoreTests/testResolvedAddressUsedInEthTxIfAvailable",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionEthNetwork",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionSolNetwork",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionFailure",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionTokenChange",
"BraveWalletTests/TransactionConfirmationStoreTests/testPrepareERC20Approve",
"BraveWalletTests/TransactionConfirmationStoreTests/testPrepareTransactionNotOnSelectedNetwork"
]
)
skip_testing: skipped_tests()
}))

run_tests(
project: "App/Client.xcodeproj",
scheme: "Debug",
run_tests(defaultScanParams.merge!({
devices: ["iPad (10th generation)"],
code_coverage: true,
ensure_devices_found: true,
output_types: "junit",
output_files: "junit-ipad.xml",
derived_data_path: "../../../out/DerivedData",
skip_testing: [
"ClientTests/UserAgentTests"
],
xcargs: "-testPlan Brave_iPad"
)
}))
end

desc "Builds the app for testing"
lane :build_for_testing do |options|
defaultScanParams = scan_params()
run_tests(defaultScanParams.merge!({
build_for_testing: true,
output_style: "raw" # Don't need xcpretty for the build
}))
end

desc "Runs unit tests on a previous build (assumes build_for_testing is run)"
lane :test_without_building do |options|
defaultScanParams = scan_params()
run_tests(defaultScanParams.merge!({
test_without_building: true,
devices: ["iPhone 15"],
ensure_devices_found: true,
skip_testing: skipped_tests()
}))

run_tests(defaultScanParams.merge!({
test_without_building: true,
devices: ["iPad (10th generation)"],
ensure_devices_found: true,
output_files: "junit-ipad.xml",
testplan: "Brave_iPad",
skip_testing: [
"ClientTests/UserAgentTests"
]
}))
end

desc "Creates a Brave Beta build for TestFlight."
Expand Down Expand Up @@ -150,4 +159,31 @@ platform :ios do
}
end

private_lane :scan_params do
{
project: "App/Client.xcodeproj",
scheme: "Debug",
code_coverage: true,
output_types: "junit",
output_files: "junit.xml",
derived_data_path: "../../../out/DerivedData"
}
end

private_lane :skipped_tests do
[
"BraveWalletTests/ManageSiteConnectionsStoreTests/testRemoveAllPermissions",
"BraveWalletTests/ManageSiteConnectionsStoreTests/testRemovePermissions",
"BraveWalletTests/ManageSiteConnectionsStoreTests/testRemovePermissionsLastPermission",
"BraveWalletTests/SendTokenStoreTests/testResolvedAddressUsedInSolTxIfAvailable",
"BraveWalletTests/SendTokenStoreTests/testResolvedAddressUsedInEthTxIfAvailable",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionEthNetwork",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionSolNetwork",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionFailure",
"BraveWalletTests/SendTokenStoreTests/testUDAddressResolutionTokenChange",
"BraveWalletTests/TransactionConfirmationStoreTests/testPrepareERC20Approve",
"BraveWalletTests/TransactionConfirmationStoreTests/testPrepareTransactionNotOnSelectedNetwork"
]
end

end
Loading