Add UITests target

This commit is contained in:
Balazs Perlaki-Horvath 2025-05-04 21:55:16 +02:00 committed by rgaudin
parent 4028ea1269
commit 43ed5d7841
3 changed files with 85 additions and 7 deletions

View File

@ -0,0 +1,47 @@
// This file is part of Kiwix for iOS & macOS.
//
// Kiwix is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// any later version.
//
// Kiwix is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Kiwix; If not, see https://www.gnu.org/licenses/.
import XCTest
final class LoadingUITest: 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 its 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 {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}

View File

@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

View File

@ -2,8 +2,8 @@ name: Kiwix
options:
xcodeVersion: 16.1
deploymentTarget: # the three latest major versions should be supported
iOS: 16.6
macOS: 13.0
iOS: 16.6
macOS: 13.0
generateEmptyDirectories: true
useTabs: false
groupSortPosition: top
@ -75,7 +75,7 @@ targetTemplates:
- sdk: SystemConfiguration.framework
- package: Defaults
- package: StripeApplePay
sources:
sources:
- path: App
- path: Model
- path: SwiftUI
@ -111,7 +111,7 @@ targets:
INFOPLIST_KEY_UILaunchStoryboardName: SplashScreenKiwix.storyboard
sources:
- path: Support
excludes:
excludes:
- "**/qqq.lproj"
- "**/igl.lproj"
- "**/dag.lproj"
@ -136,7 +136,26 @@ targets:
- path: Tests
dependencies:
- target: Kiwix
UITests:
type: bundle.ui-testing
supportedDestinations: [iOS, macOS]
settings:
PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.UITests
# TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix
BUNDLE_LOADER: $(TEST_HOST)
entitlements:
path: Support/Kiwix-unitTest.entitlements
properties:
com.apple.security.app-sandbox: false
# from macOS 14, sandbox and unit test are not working together on CI
# a pop up appears that needs user acceptance
# see: https://developer.apple.com/documentation/security/accessing-files-from-the-macos-app-sandbox
sources:
- path: UITests
dependencies:
- target: Kiwix
schemes:
Kiwix:
build:
@ -146,8 +165,16 @@ schemes:
targets:
- UnitTests
commandLineArguments:
testing: true
testing: true
gatherCoverageData: true
coverageTargets:
- Kiwix
UITests:
build:
targets:
Kiwix: all
test:
targets:
- UITests
commandLineArguments:
testing: true