From 5ff064d5dc322e3724bd6c91536078e1cf5c286c Mon Sep 17 00:00:00 2001 From: Su Ho Date: Wed, 1 Mar 2023 10:18:10 +0700 Subject: [PATCH 1/7] Remove fixed Sourcery version and replace Resolver with Factory --- Podfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Podfile b/Podfile index fb6ca9ed..6600ea73 100644 --- a/Podfile +++ b/Podfile @@ -7,9 +7,7 @@ def testing_pods pod 'Nimble' pod 'RxNimble', subspecs: ['RxBlocking', 'RxTest'] pod 'RxSwift' - # TODO: Remove or update the version of `1.8.0` to the newest version (not 1.8.1) when init a new project. - # Currently, there is a bug on `1.8.1` - the newest version. - pod 'Sourcery', '1.8.0' + pod 'Sourcery' pod 'SwiftFormat/CLI' end @@ -32,7 +30,7 @@ target '{PROJECT_NAME}' do pod 'IQKeyboardManagerSwift' pod 'NimbleExtension', :git => 'https://github.com/nimblehq/NimbleExtension', :branch => 'master' pod 'R.swift' - pod 'Resolver' # Needs Cocoapods on iOS 11 to support Resolver + pod 'Factory' # Development pod 'SwiftLint' From bb0bf7c357006b586c42db0eb0831c6bfdbe5b0c Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Thu, 9 Mar 2023 00:05:11 +0700 Subject: [PATCH 2/7] [#430] Setup makefile to install xcbeautify --- .github/workflows/automatic_pull_request_review.yml | 3 +++ .github/workflows/deploy_app_store.yml | 3 +++ .github/workflows/deploy_production_firebase.yml | 3 +++ .github/workflows/deploy_staging_firebase.yml | 3 +++ .github/workflows/test_install_script.yml | 3 +++ .github/workflows/test_upload_build_to_test_flight.yml | 3 +++ Makefile | 6 ++++++ fastlane/Helpers/Build.swift | 2 +- fastlane/Helpers/Test.swift | 2 +- 9 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/automatic_pull_request_review.yml b/.github/workflows/automatic_pull_request_review.yml index 8b5b107c..61c94b2c 100644 --- a/.github/workflows/automatic_pull_request_review.yml +++ b/.github/workflows/automatic_pull_request_review.yml @@ -26,6 +26,9 @@ jobs: restore-keys: | ${{ runner.os }}-gems- + - name: Setup + run: make setup + - name: Bundle install run: bundle install --path vendor/bundle diff --git a/.github/workflows/deploy_app_store.yml b/.github/workflows/deploy_app_store.yml index 0277e1fc..38e055a7 100644 --- a/.github/workflows/deploy_app_store.yml +++ b/.github/workflows/deploy_app_store.yml @@ -56,6 +56,9 @@ jobs: key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- + + - name: Setup + run: make setup - name: Install Pods Dependencies run: bundle exec pod install diff --git a/.github/workflows/deploy_production_firebase.yml b/.github/workflows/deploy_production_firebase.yml index 6a36f2da..dbf076bc 100644 --- a/.github/workflows/deploy_production_firebase.yml +++ b/.github/workflows/deploy_production_firebase.yml @@ -44,6 +44,9 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Setup + run: make setup + - name: Bundle install run: bundle install diff --git a/.github/workflows/deploy_staging_firebase.yml b/.github/workflows/deploy_staging_firebase.yml index 4d9534fa..1c140535 100644 --- a/.github/workflows/deploy_staging_firebase.yml +++ b/.github/workflows/deploy_staging_firebase.yml @@ -49,6 +49,9 @@ jobs: yarn global add firebase-tools echo "$(yarn global bin)" >> $GITHUB_PATH + - name: Setup + run: make setup + - name: Bundle install # if: steps.bundleCache.outputs.cache-hit != 'true' run: bundle install diff --git a/.github/workflows/test_install_script.yml b/.github/workflows/test_install_script.yml index 115a66d3..2b029127 100644 --- a/.github/workflows/test_install_script.yml +++ b/.github/workflows/test_install_script.yml @@ -18,6 +18,9 @@ jobs: with: fetch-depth: 0 + - name: Setup + run: make setup + - name: Bundle install run: bundle install diff --git a/.github/workflows/test_upload_build_to_test_flight.yml b/.github/workflows/test_upload_build_to_test_flight.yml index bbaa2043..5df37300 100644 --- a/.github/workflows/test_upload_build_to_test_flight.yml +++ b/.github/workflows/test_upload_build_to_test_flight.yml @@ -31,6 +31,9 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Setup + run: make setup + - name: Bundle install run: bundle install diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..bd2bfbef --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +# Setup +setup: install + +# Install dependencies +install: + brew install xcbeautify diff --git a/fastlane/Helpers/Build.swift b/fastlane/Helpers/Build.swift index 4bcbf283..34e33909 100644 --- a/fastlane/Helpers/Build.swift +++ b/fastlane/Helpers/Build.swift @@ -57,7 +57,7 @@ enum Build { ]), buildPath: .userDefined(Constant.buildPath), derivedDataPath: .userDefined(Constant.derivedDataPath), - xcodebuildFormatter: "xcpretty" // Default `xcbeautify` will never work + xcodebuildFormatter: "xcbeautify" ) } } diff --git a/fastlane/Helpers/Test.swift b/fastlane/Helpers/Test.swift index 46e91908..4f62e811 100644 --- a/fastlane/Helpers/Test.swift +++ b/fastlane/Helpers/Test.swift @@ -19,7 +19,7 @@ enum Test { onlyTesting: targets, codeCoverage: .userDefined(true), outputDirectory: Constant.testOutputDirectoryPath, - xcodebuildFormatter: "xcpretty", + xcodebuildFormatter: "xcbeautify", resultBundle: .userDefined(true), failBuild: .userDefined(false) ) From 7cb94e448fca4c78243e6b92f06bf38bf2764c21 Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Fri, 10 Mar 2023 16:24:18 +0700 Subject: [PATCH 3/7] [#430] Update using Cocoapod --- .github/workflows/automatic_pull_request_review.yml | 3 --- .github/workflows/deploy_app_store.yml | 3 --- .github/workflows/deploy_production_firebase.yml | 3 --- .github/workflows/deploy_staging_firebase.yml | 3 --- .github/workflows/test_install_script.yml | 3 --- .github/workflows/test_upload_build_to_test_flight.yml | 3 --- Makefile | 6 ------ Podfile | 1 + fastlane/Helpers/Build.swift | 2 +- fastlane/Helpers/Test.swift | 2 +- 10 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 Makefile diff --git a/.github/workflows/automatic_pull_request_review.yml b/.github/workflows/automatic_pull_request_review.yml index 61c94b2c..8b5b107c 100644 --- a/.github/workflows/automatic_pull_request_review.yml +++ b/.github/workflows/automatic_pull_request_review.yml @@ -26,9 +26,6 @@ jobs: restore-keys: | ${{ runner.os }}-gems- - - name: Setup - run: make setup - - name: Bundle install run: bundle install --path vendor/bundle diff --git a/.github/workflows/deploy_app_store.yml b/.github/workflows/deploy_app_store.yml index 38e055a7..0277e1fc 100644 --- a/.github/workflows/deploy_app_store.yml +++ b/.github/workflows/deploy_app_store.yml @@ -56,9 +56,6 @@ jobs: key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- - - - name: Setup - run: make setup - name: Install Pods Dependencies run: bundle exec pod install diff --git a/.github/workflows/deploy_production_firebase.yml b/.github/workflows/deploy_production_firebase.yml index dbf076bc..6a36f2da 100644 --- a/.github/workflows/deploy_production_firebase.yml +++ b/.github/workflows/deploy_production_firebase.yml @@ -44,9 +44,6 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Setup - run: make setup - - name: Bundle install run: bundle install diff --git a/.github/workflows/deploy_staging_firebase.yml b/.github/workflows/deploy_staging_firebase.yml index 1c140535..4d9534fa 100644 --- a/.github/workflows/deploy_staging_firebase.yml +++ b/.github/workflows/deploy_staging_firebase.yml @@ -49,9 +49,6 @@ jobs: yarn global add firebase-tools echo "$(yarn global bin)" >> $GITHUB_PATH - - name: Setup - run: make setup - - name: Bundle install # if: steps.bundleCache.outputs.cache-hit != 'true' run: bundle install diff --git a/.github/workflows/test_install_script.yml b/.github/workflows/test_install_script.yml index 2b029127..115a66d3 100644 --- a/.github/workflows/test_install_script.yml +++ b/.github/workflows/test_install_script.yml @@ -18,9 +18,6 @@ jobs: with: fetch-depth: 0 - - name: Setup - run: make setup - - name: Bundle install run: bundle install diff --git a/.github/workflows/test_upload_build_to_test_flight.yml b/.github/workflows/test_upload_build_to_test_flight.yml index 5df37300..bbaa2043 100644 --- a/.github/workflows/test_upload_build_to_test_flight.yml +++ b/.github/workflows/test_upload_build_to_test_flight.yml @@ -31,9 +31,6 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Setup - run: make setup - - name: Bundle install run: bundle install diff --git a/Makefile b/Makefile deleted file mode 100644 index bd2bfbef..00000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# Setup -setup: install - -# Install dependencies -install: - brew install xcbeautify diff --git a/Podfile b/Podfile index 6600ea73..58dc79c1 100644 --- a/Podfile +++ b/Podfile @@ -35,6 +35,7 @@ target '{PROJECT_NAME}' do # Development pod 'SwiftLint' pod 'Wormholy', :configurations => ['Debug Staging', 'Debug Production'] + pod 'xcbeautify' target '{PROJECT_NAME}Tests' do inherit! :search_paths diff --git a/fastlane/Helpers/Build.swift b/fastlane/Helpers/Build.swift index 34e33909..b1e3682f 100644 --- a/fastlane/Helpers/Build.swift +++ b/fastlane/Helpers/Build.swift @@ -57,7 +57,7 @@ enum Build { ]), buildPath: .userDefined(Constant.buildPath), derivedDataPath: .userDefined(Constant.derivedDataPath), - xcodebuildFormatter: "xcbeautify" + xcodebuildFormatter: "Pods/xcbeautify/xcbeautify" ) } } diff --git a/fastlane/Helpers/Test.swift b/fastlane/Helpers/Test.swift index 4f62e811..bb4188d8 100644 --- a/fastlane/Helpers/Test.swift +++ b/fastlane/Helpers/Test.swift @@ -19,7 +19,7 @@ enum Test { onlyTesting: targets, codeCoverage: .userDefined(true), outputDirectory: Constant.testOutputDirectoryPath, - xcodebuildFormatter: "xcbeautify", + xcodebuildFormatter: "Pods/xcbeautify/xcbeautify", resultBundle: .userDefined(true), failBuild: .userDefined(false) ) From bdb1db202172b7748648887b4966e72d4ff41387 Mon Sep 17 00:00:00 2001 From: David Bui Date: Thu, 30 Mar 2023 16:16:58 +0700 Subject: [PATCH 4/7] [#460] Remove styfle/cancel-workflow-action@0.5.0 in workflows Add concurrency to cancel in-progress workflow --- .github/workflows/automatic_pull_request_review.yml | 9 ++++----- .github/workflows/deploy_app_store.yml | 9 ++++----- .github/workflows/deploy_production_firebase.yml | 9 ++++----- .github/workflows/deploy_staging_firebase.yml | 9 ++++----- .github/workflows/test_install_script.yml | 9 ++++----- .github/workflows/test_upload_build_to_test_flight.yml | 9 ++++----- 6 files changed, 24 insertions(+), 30 deletions(-) diff --git a/.github/workflows/automatic_pull_request_review.yml b/.github/workflows/automatic_pull_request_review.yml index 8b5b107c..3f42072e 100644 --- a/.github/workflows/automatic_pull_request_review.yml +++ b/.github/workflows/automatic_pull_request_review.yml @@ -4,16 +4,15 @@ on: pull_request: types: [opened, reopened, edited, synchronize] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: review_pull_request: name: Pull request review by Danger runs-on: macOS-12 steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - uses: actions/checkout@v2 with: fetch-depth: 0 diff --git a/.github/workflows/deploy_app_store.yml b/.github/workflows/deploy_app_store.yml index 0277e1fc..5bcb5663 100644 --- a/.github/workflows/deploy_app_store.yml +++ b/.github/workflows/deploy_app_store.yml @@ -10,6 +10,10 @@ on: branches: [ master, main ] workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: lint: name: Lint @@ -29,11 +33,6 @@ jobs: name: Build runs-on: macOS-latest steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - name: Checkout Repo uses: actions/checkout@v2 # Set fetch-depth (default: 1) to get whole tree diff --git a/.github/workflows/deploy_production_firebase.yml b/.github/workflows/deploy_production_firebase.yml index 6a36f2da..67e22e30 100644 --- a/.github/workflows/deploy_production_firebase.yml +++ b/.github/workflows/deploy_production_firebase.yml @@ -10,6 +10,10 @@ on: branches: [ release/** ] workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: Lint: name: lint @@ -29,11 +33,6 @@ jobs: name: Build runs-on: macOS-latest steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - uses: actions/checkout@v2 # Set fetch-depth (default: 1) to get whole tree with: diff --git a/.github/workflows/deploy_staging_firebase.yml b/.github/workflows/deploy_staging_firebase.yml index 4d9534fa..3c6eb30e 100644 --- a/.github/workflows/deploy_staging_firebase.yml +++ b/.github/workflows/deploy_staging_firebase.yml @@ -10,6 +10,10 @@ on: branches: [ develop ] workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: lint: name: Lint @@ -29,11 +33,6 @@ jobs: name: Build runs-on: macOS-latest steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - uses: actions/checkout@v2 # Set fetch-depth (default: 1) to get whole tree with: diff --git a/.github/workflows/test_install_script.yml b/.github/workflows/test_install_script.yml index 115a66d3..b7378e84 100644 --- a/.github/workflows/test_install_script.yml +++ b/.github/workflows/test_install_script.yml @@ -4,16 +4,15 @@ on: push: branches: [ feature/**, bug/**, chore/** ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: Test: name: Test runs-on: macOS-12 steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - uses: actions/checkout@v2 with: fetch-depth: 0 diff --git a/.github/workflows/test_upload_build_to_test_flight.yml b/.github/workflows/test_upload_build_to_test_flight.yml index bbaa2043..04c7c863 100644 --- a/.github/workflows/test_upload_build_to_test_flight.yml +++ b/.github/workflows/test_upload_build_to_test_flight.yml @@ -11,16 +11,15 @@ name: Test Upload Build to TestFlight on: pull_request +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: build: name: Build runs-on: macOS-12 steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - name: Checkout Repo uses: actions/checkout@v2 with: From 59747e1356c7ecb179fe28bdfa823ec9e7d641b6 Mon Sep 17 00:00:00 2001 From: Bliss Pisit Wetcha Date: Tue, 10 Jan 2023 09:56:29 +0700 Subject: [PATCH 5/7] [#425] Add KIF --- .github/wiki/Project-Configurations.md | 3 +- .github/wiki/Standard-File-Organization.md | 22 +++++++++++++ .swiftlint.yml | 1 + Podfile | 6 ++++ Project.swift | 1 + .../Scheme+Initializing.swift | 10 ++++-- .../Target+Initializing.swift | 16 ++++++++++ fastlane/Constants/Constant.swift | 1 + fastlane/Fastfile.swift | 6 +++- make.sh | 3 ++ .../Configurations/Plists/Info.plist | 22 +++++++++++++ .../Specs/Application/ApplicationSpec.swift | 31 +++++++++++++++++++ .../Sources/Utilities/KIF+Swift.swift | 17 ++++++++++ .../Foundation/OptionalUnwrapSpec.swift | 6 +++- 14 files changed, 140 insertions(+), 5 deletions(-) create mode 100644 {PROJECT_NAME}KIFUITests/Configurations/Plists/Info.plist create mode 100644 {PROJECT_NAME}KIFUITests/Sources/Specs/Application/ApplicationSpec.swift create mode 100644 {PROJECT_NAME}KIFUITests/Sources/Utilities/KIF+Swift.swift diff --git a/.github/wiki/Project-Configurations.md b/.github/wiki/Project-Configurations.md index 45b687e9..7e9192aa 100644 --- a/.github/wiki/Project-Configurations.md +++ b/.github/wiki/Project-Configurations.md @@ -11,10 +11,11 @@ A target specifies a product to build, such as an iOS, watchOS, or macOS app. When creating a project from a template, a default target will be added automatically for the main application. -There are 3 default targets in a project: +There are 4 default targets in a project: - {ProjectName} - {ProjectName}Tests +- {ProjectName}KIFUITests - {ProjectName}UITests ### Schemes diff --git a/.github/wiki/Standard-File-Organization.md b/.github/wiki/Standard-File-Organization.md index 885f3f11..8123c415 100644 --- a/.github/wiki/Standard-File-Organization.md +++ b/.github/wiki/Standard-File-Organization.md @@ -103,6 +103,24 @@ To keep all current and upcoming iOS projects aligned, we standardize an iOS pro │   ├── Data+Decode.swift │   ├── String+Data.swift │   └── TestError.swift +└── {ProjectName}KIFUITests +    ├── Configurations +    │   └── Plists +    └── Sources +    ├── AccessibilityIdentifiers +    │   ├── Login +    │   └── Home +    ├── Flows +    │   ├── Login +    │   └── Home +    ├── Screens +    │   ├── Login +    │   └── Home +    ├── Specs +    │   ├── Login +    │   └── Home +    └── Utilities +    └── KIF+Swift.swift └── {ProjectName}UITests    ├── Configurations    │   └── Plists @@ -146,6 +164,10 @@ This folder contains the main sources of the project. There are three sub-folder This folder contains the unit testing and integration testing of the main project. +## {ProjectName}KIFUITests + +This folder contains the KIF UI testing of the main project. Use KIF instead of UITests for speed and reliability. + ## {ProjectName}UITests This folder contains the UI testing of the main project. diff --git a/.swiftlint.yml b/.swiftlint.yml index 1dd0b0c1..282264d0 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -2,6 +2,7 @@ included: - {PROJECT_NAME} - {PROJECT_NAME}Tests - {PROJECT_NAME}UITests + - {PROJECT_NAME}KIFUITests excluded: - {PROJECT_NAME}Tests/Sources/Mocks/Sourcery/AutoMockable.generated.swift diff --git a/Podfile b/Podfile index fb6ca9ed..8c2b23d6 100644 --- a/Podfile +++ b/Podfile @@ -43,6 +43,12 @@ target '{PROJECT_NAME}' do testing_pods end + target '{PROJECT_NAME}KIFUITests' do + testing_pods + pod 'KIF', :configurations => ['Debug Staging', 'Debug Production'] + pod 'KIF/IdentifierTests', :configurations => ['Debug Staging', 'Debug Production'] + end + target '{PROJECT_NAME}UITests' do testing_pods end diff --git a/Project.swift b/Project.swift index 35637162..3a8676cd 100644 --- a/Project.swift +++ b/Project.swift @@ -19,6 +19,7 @@ extension Project { targets: [ .mainTarget(name: name, bundleId: bundleId), .testsTarget(name: name, bundleId: bundleId), + .kifUITestsTarget(name: name, bundleId: bundleId), .uiTestsTarget(name: name, bundleId: bundleId) ], schemes: [ diff --git a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift index 7d11f044..b3e1047e 100644 --- a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift @@ -9,7 +9,10 @@ extension Scheme { name: name, shared: true, buildAction: .buildAction(targets: ["\(name)"]), - testAction: .targets(["\(name)Tests", "\(name)UITests"], configuration: debugConfigName), + testAction: .targets( + ["\(name)Tests", "\(name)KIFUITests", "\(name)UITests"], + configuration: debugConfigName + ), runAction: .runAction(configuration: debugConfigName), archiveAction: .archiveAction(configuration: releaseConfigName), profileAction: .profileAction(configuration: debugConfigName), @@ -24,7 +27,10 @@ extension Scheme { name: "\(name) Staging", shared: true, buildAction: .buildAction(targets: ["\(name)"]), - testAction: .targets(["\(name)Tests", "\(name)UITests"], configuration: debugConfigName), + testAction: .targets( + ["\(name)Tests", "\(name)KIFUITests", "\(name)UITests"], + configuration: debugConfigName + ), runAction: .runAction(configuration: debugConfigName), archiveAction: .archiveAction(configuration: releaseConfigName), profileAction: .profileAction(configuration: debugConfigName), diff --git a/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift b/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift index 26a083f0..d9cbb980 100644 --- a/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift @@ -48,6 +48,22 @@ extension Target { ) } + public static func kifUITestsTarget(name: String, bundleId: String) -> Target { + let targetName = "\(name)KIFUITests" + return Target( + name: targetName, + platform: .iOS, + product: .unitTests, + bundleId: bundleId, + infoPlist: "\(targetName)/\(plistsPath)/Info.plist", + sources: ["\(targetName)/**"], + resources: [ + "\(targetName)/**/.gitkeep", // To include empty folders + ], + dependencies: [.target(name: name)] + ) + } + public static func uiTestsTarget(name: String, bundleId: String) -> Target { let targetName = "\(name)UITests" return Target( diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index ab0b25f1..5c6eafd8 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -72,6 +72,7 @@ enum Constant { static let testTarget: String = "\(projectName)Tests" static let uiTestTarget: String = "\(projectName)UITests" + static let kifUITestTarget: String = "\(projectName)KIFUITests" } extension Constant { diff --git a/fastlane/Fastfile.swift b/fastlane/Fastfile.swift index 027204a0..4a3df422 100644 --- a/fastlane/Fastfile.swift +++ b/fastlane/Fastfile.swift @@ -137,7 +137,11 @@ class Fastfile: LaneFile { desc("Build and Test project") Test.buildAndTest( environment: .staging, - targets: [Constant.testTarget, Constant.uiTestTarget], + targets: [ + Constant.testTarget, + Constant.kifUITestTarget, + Constant.uiTestTarget + ], devices: Constant.devices ) } diff --git a/make.sh b/make.sh index 8b4686ef..f9afa0a7 100644 --- a/make.sh +++ b/make.sh @@ -126,6 +126,9 @@ rename_folder "${CONSTANT_PROJECT_NAME}Tests" "${PROJECT_NAME_NO_SPACES}Tests" # Rename UI Test folder structure rename_folder "${CONSTANT_PROJECT_NAME}UITests" "${PROJECT_NAME_NO_SPACES}UITests" +# Rename KIF UI Test folder structure +rename_folder "${CONSTANT_PROJECT_NAME}KIFUITests" "${PROJECT_NAME_NO_SPACES}KIFUITests" + # Rename app folder structure rename_folder "${CONSTANT_PROJECT_NAME}" "${PROJECT_NAME_NO_SPACES}" diff --git a/{PROJECT_NAME}KIFUITests/Configurations/Plists/Info.plist b/{PROJECT_NAME}KIFUITests/Configurations/Plists/Info.plist new file mode 100644 index 00000000..6c40a6cd --- /dev/null +++ b/{PROJECT_NAME}KIFUITests/Configurations/Plists/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/{PROJECT_NAME}KIFUITests/Sources/Specs/Application/ApplicationSpec.swift b/{PROJECT_NAME}KIFUITests/Sources/Specs/Application/ApplicationSpec.swift new file mode 100644 index 00000000..8dded39b --- /dev/null +++ b/{PROJECT_NAME}KIFUITests/Sources/Specs/Application/ApplicationSpec.swift @@ -0,0 +1,31 @@ +// +// ApplicationSpec.swift +// + +import Foundation +import Nimble +import Quick + +final class ApplicationSpec: QuickSpec { + + override func spec() { + + describe("a {PROJECT_NAME} screen") { + + beforeEach { + // Navigate to the testing screen + } + + afterEach { + // Navigate to neutral state + } + + context("when opens") { + + it("shows its UI components") { + self.tester().waitForView(withAccessibilityLabel: "Hello") + } + } + } + } +} diff --git a/{PROJECT_NAME}KIFUITests/Sources/Utilities/KIF+Swift.swift b/{PROJECT_NAME}KIFUITests/Sources/Utilities/KIF+Swift.swift new file mode 100644 index 00000000..b7b69cd9 --- /dev/null +++ b/{PROJECT_NAME}KIFUITests/Sources/Utilities/KIF+Swift.swift @@ -0,0 +1,17 @@ +// swiftlint:disable:this file_name +// +// KIF+Swift.swift +// + +import KIF + +extension XCTestCase { + + func tester(file: String = #file, _ line: Int = #line) -> KIFUITestActor { + return KIFUITestActor(inFile: file, atLine: line, delegate: self) + } + + func system(file: String = #file, _ line: Int = #line) -> KIFSystemTestActor { + return KIFSystemTestActor(inFile: file, atLine: line, delegate: self) + } +} diff --git a/{PROJECT_NAME}Tests/Sources/Specs/Supports/Extensions/Foundation/OptionalUnwrapSpec.swift b/{PROJECT_NAME}Tests/Sources/Specs/Supports/Extensions/Foundation/OptionalUnwrapSpec.swift index 58221e9c..c6952037 100644 --- a/{PROJECT_NAME}Tests/Sources/Specs/Supports/Extensions/Foundation/OptionalUnwrapSpec.swift +++ b/{PROJECT_NAME}Tests/Sources/Specs/Supports/Extensions/Foundation/OptionalUnwrapSpec.swift @@ -1,3 +1,7 @@ +// +// OptionalUnwrapSpec.swift +// + import Nimble import Quick @@ -26,7 +30,7 @@ final class OptionalUnwrapSpec: QuickSpec { } it("returns empty string") { - expect(value.string) == "" + expect(value.string.isEmpty) == true } } } From 3386ce900b90dec54bae2fac1463edebeff2e7e7 Mon Sep 17 00:00:00 2001 From: Bliss Pisit Wetcha Date: Tue, 10 Jan 2023 13:05:30 +0700 Subject: [PATCH 6/7] [#425] Override KIF scheme generation --- Project.swift | 3 ++- .../Scheme+Initializing.swift | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Project.swift b/Project.swift index 3a8676cd..8cb70cb3 100644 --- a/Project.swift +++ b/Project.swift @@ -24,7 +24,8 @@ extension Project { ], schemes: [ .productionScheme(name: name), - .stagingScheme(name: name) + .stagingScheme(name: name), + .kifUITestsScheme(name: name) ] ) } diff --git a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift index b3e1047e..f3231c6c 100644 --- a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift @@ -37,4 +37,14 @@ extension Scheme { analyzeAction: .analyzeAction(configuration: debugConfigName) ) } + + public static func kifUITestsScheme(name: String) -> Scheme { + let debugConfigName = BuildConfiguration.debugStaging.name + let releaseConfigName = BuildConfiguration.releaseStaging.name + return Scheme( + name: "\(name)KIFUITests", + shared: false, + hidden: true + ) + } } From b275b1f59f9eba1ca133663238160a6370ee42df Mon Sep 17 00:00:00 2001 From: Bliss Pisit Wetcha Date: Fri, 31 Mar 2023 14:17:27 +0700 Subject: [PATCH 7/7] [#425] Remove XCUITest target --- .github/wiki/Project-Configurations.md | 3 +- .github/wiki/Standard-File-Organization.md | 27 +---------------- .swiftlint.yml | 1 - Podfile | 4 --- Project.swift | 1 - .../Scheme+Initializing.swift | 4 +-- .../Target+Initializing.swift | 17 ----------- fastlane/Constants/Constant.swift | 1 - fastlane/Fastfile.swift | 3 +- make.sh | 3 -- .../Configurations/Plists/Info.plist | 22 -------------- {PROJECT_NAME}UITests/Resources/.gitkeep | 0 .../Specs/Application/ApplicationSpec.swift | 30 ------------------- 13 files changed, 5 insertions(+), 111 deletions(-) delete mode 100644 {PROJECT_NAME}UITests/Configurations/Plists/Info.plist delete mode 100644 {PROJECT_NAME}UITests/Resources/.gitkeep delete mode 100644 {PROJECT_NAME}UITests/Sources/Specs/Application/ApplicationSpec.swift diff --git a/.github/wiki/Project-Configurations.md b/.github/wiki/Project-Configurations.md index 7e9192aa..403e6206 100644 --- a/.github/wiki/Project-Configurations.md +++ b/.github/wiki/Project-Configurations.md @@ -11,12 +11,11 @@ A target specifies a product to build, such as an iOS, watchOS, or macOS app. When creating a project from a template, a default target will be added automatically for the main application. -There are 4 default targets in a project: +There are 3 default targets in a project: - {ProjectName} - {ProjectName}Tests - {ProjectName}KIFUITests -- {ProjectName}UITests ### Schemes diff --git a/.github/wiki/Standard-File-Organization.md b/.github/wiki/Standard-File-Organization.md index 8123c415..762f7cb9 100644 --- a/.github/wiki/Standard-File-Organization.md +++ b/.github/wiki/Standard-File-Organization.md @@ -121,27 +121,6 @@ To keep all current and upcoming iOS projects aligned, we standardize an iOS pro    │   └── Home    └── Utilities    └── KIF+Swift.swift -└── {ProjectName}UITests -    ├── Configurations -    │   └── Plists -    ├── Resources -    └── Sources -    ├── AccessibilityIdentifiers -    │   ├── Login -    │   └── Home -    ├── Flows -    │   ├── Login -    │   └── Home -    ├── Screens -    │   ├── Login -    │   └── Home -    ├── Specs -    │   ├── Login -    │   └── Home -    └── Utilities -    ├── Data+Decode.swift -    ├── String+Data.swift -    └── TestError.swift ``` ## README.md @@ -166,8 +145,4 @@ This folder contains the unit testing and integration testing of the main projec ## {ProjectName}KIFUITests -This folder contains the KIF UI testing of the main project. Use KIF instead of UITests for speed and reliability. - -## {ProjectName}UITests - -This folder contains the UI testing of the main project. +This folder contains the KIF UI testing of the main project. Use KIF instead of XCUITest for speed and reliability. diff --git a/.swiftlint.yml b/.swiftlint.yml index 282264d0..4ca7db79 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,7 +1,6 @@ included: - {PROJECT_NAME} - {PROJECT_NAME}Tests - - {PROJECT_NAME}UITests - {PROJECT_NAME}KIFUITests excluded: diff --git a/Podfile b/Podfile index 8c2b23d6..e7c8d8a1 100644 --- a/Podfile +++ b/Podfile @@ -48,10 +48,6 @@ target '{PROJECT_NAME}' do pod 'KIF', :configurations => ['Debug Staging', 'Debug Production'] pod 'KIF/IdentifierTests', :configurations => ['Debug Staging', 'Debug Production'] end - - target '{PROJECT_NAME}UITests' do - testing_pods - end end post_install do |installer| diff --git a/Project.swift b/Project.swift index 8cb70cb3..92d63a5e 100644 --- a/Project.swift +++ b/Project.swift @@ -20,7 +20,6 @@ extension Project { .mainTarget(name: name, bundleId: bundleId), .testsTarget(name: name, bundleId: bundleId), .kifUITestsTarget(name: name, bundleId: bundleId), - .uiTestsTarget(name: name, bundleId: bundleId) ], schemes: [ .productionScheme(name: name), diff --git a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift index f3231c6c..8694c4c9 100644 --- a/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/Scheme+Initializing.swift @@ -10,7 +10,7 @@ extension Scheme { shared: true, buildAction: .buildAction(targets: ["\(name)"]), testAction: .targets( - ["\(name)Tests", "\(name)KIFUITests", "\(name)UITests"], + ["\(name)Tests", "\(name)KIFUITests"], configuration: debugConfigName ), runAction: .runAction(configuration: debugConfigName), @@ -28,7 +28,7 @@ extension Scheme { shared: true, buildAction: .buildAction(targets: ["\(name)"]), testAction: .targets( - ["\(name)Tests", "\(name)KIFUITests", "\(name)UITests"], + ["\(name)Tests", "\(name)KIFUITests"], configuration: debugConfigName ), runAction: .runAction(configuration: debugConfigName), diff --git a/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift b/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift index d9cbb980..5e2158db 100644 --- a/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/Target+Initializing.swift @@ -63,21 +63,4 @@ extension Target { dependencies: [.target(name: name)] ) } - - public static func uiTestsTarget(name: String, bundleId: String) -> Target { - let targetName = "\(name)UITests" - return Target( - name: targetName, - platform: .iOS, - product: .uiTests, - bundleId: bundleId, - infoPlist: "\(targetName)/\(plistsPath)/Info.plist", - sources: ["\(targetName)/**"], - resources: [ - "\(targetName)/**/.gitkeep", // To include empty folders - "\(targetName)/Resources/**/*" - ], - dependencies: [.target(name: name)] - ) - } } diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index 5c6eafd8..adc32ed8 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -71,7 +71,6 @@ enum Constant { // MARK: - Test static let testTarget: String = "\(projectName)Tests" - static let uiTestTarget: String = "\(projectName)UITests" static let kifUITestTarget: String = "\(projectName)KIFUITests" } diff --git a/fastlane/Fastfile.swift b/fastlane/Fastfile.swift index 4a3df422..f6724110 100644 --- a/fastlane/Fastfile.swift +++ b/fastlane/Fastfile.swift @@ -139,8 +139,7 @@ class Fastfile: LaneFile { environment: .staging, targets: [ Constant.testTarget, - Constant.kifUITestTarget, - Constant.uiTestTarget + Constant.kifUITestTarget ], devices: Constant.devices ) diff --git a/make.sh b/make.sh index f9afa0a7..25c00fbc 100644 --- a/make.sh +++ b/make.sh @@ -123,9 +123,6 @@ rename_folder(){ # Rename test folder structure rename_folder "${CONSTANT_PROJECT_NAME}Tests" "${PROJECT_NAME_NO_SPACES}Tests" -# Rename UI Test folder structure -rename_folder "${CONSTANT_PROJECT_NAME}UITests" "${PROJECT_NAME_NO_SPACES}UITests" - # Rename KIF UI Test folder structure rename_folder "${CONSTANT_PROJECT_NAME}KIFUITests" "${PROJECT_NAME_NO_SPACES}KIFUITests" diff --git a/{PROJECT_NAME}UITests/Configurations/Plists/Info.plist b/{PROJECT_NAME}UITests/Configurations/Plists/Info.plist deleted file mode 100644 index 6c40a6cd..00000000 --- a/{PROJECT_NAME}UITests/Configurations/Plists/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/{PROJECT_NAME}UITests/Resources/.gitkeep b/{PROJECT_NAME}UITests/Resources/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/{PROJECT_NAME}UITests/Sources/Specs/Application/ApplicationSpec.swift b/{PROJECT_NAME}UITests/Sources/Specs/Application/ApplicationSpec.swift deleted file mode 100644 index 8cac465b..00000000 --- a/{PROJECT_NAME}UITests/Sources/Specs/Application/ApplicationSpec.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation -import Nimble -import Quick - -final class ApplicationSpec: QuickSpec { - - override func spec() { - - var app: XCUIApplication! - - describe("a {PROJECT_NAME} app") { - - beforeEach { - app = XCUIApplication() - app.launch() - } - - afterEach { - app.terminate() - } - - context("when opens") { - - it("empty tests") { - expect(true) == true - } - } - } - } -}