mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Added custom enviroment flags for unit and UI tests.
This commit is contained in:
@@ -68,6 +68,7 @@
|
|||||||
68AC3C84E2B438036B174E30 /* EmoteRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471EB7D96AFEA8D787659686 /* EmoteRoomTimelineView.swift */; };
|
68AC3C84E2B438036B174E30 /* EmoteRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471EB7D96AFEA8D787659686 /* EmoteRoomTimelineView.swift */; };
|
||||||
6F2AB43A1EFAD8A97AF41A15 /* Introspect in Frameworks */ = {isa = PBXBuildFile; productRef = 5986E300FC849DEAB2EE7AEB /* Introspect */; };
|
6F2AB43A1EFAD8A97AF41A15 /* Introspect in Frameworks */ = {isa = PBXBuildFile; productRef = 5986E300FC849DEAB2EE7AEB /* Introspect */; };
|
||||||
7002C55A4C917F3715765127 /* MediaProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C888BCD78E2A55DCE364F160 /* MediaProviderProtocol.swift */; };
|
7002C55A4C917F3715765127 /* MediaProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C888BCD78E2A55DCE364F160 /* MediaProviderProtocol.swift */; };
|
||||||
|
7405B4824D45BA7C3D943E76 /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0CBC76C80E04345E11F2DB /* Application.swift */; };
|
||||||
7434A7F02D587A920B376A9A /* LoginScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A43964330459965AF048A8C /* LoginScreenViewModelTests.swift */; };
|
7434A7F02D587A920B376A9A /* LoginScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A43964330459965AF048A8C /* LoginScreenViewModelTests.swift */; };
|
||||||
7684092532FBC71B73916441 /* RoundedToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4238D6EB22C0F9D7A2EEC9 /* RoundedToastView.swift */; };
|
7684092532FBC71B73916441 /* RoundedToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B4238D6EB22C0F9D7A2EEC9 /* RoundedToastView.swift */; };
|
||||||
77D7DAA41AAB36800C1F2E2D /* RoomTimelineProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 095AED4CF56DFF3EB7BB84C8 /* RoomTimelineProviderProtocol.swift */; };
|
77D7DAA41AAB36800C1F2E2D /* RoomTimelineProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 095AED4CF56DFF3EB7BB84C8 /* RoomTimelineProviderProtocol.swift */; };
|
||||||
@@ -216,6 +217,7 @@
|
|||||||
71BC7CA1BC1041E93077BBA1 /* HomeScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenModels.swift; sourceTree = "<group>"; };
|
71BC7CA1BC1041E93077BBA1 /* HomeScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenModels.swift; sourceTree = "<group>"; };
|
||||||
72F37B5DA798C9AE436F2C2C /* AttributedStringBuilderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringBuilderProtocol.swift; sourceTree = "<group>"; };
|
72F37B5DA798C9AE436F2C2C /* AttributedStringBuilderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringBuilderProtocol.swift; sourceTree = "<group>"; };
|
||||||
752DEC02D93AFF46BC13313A /* NavigationRouterType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationRouterType.swift; sourceTree = "<group>"; };
|
752DEC02D93AFF46BC13313A /* NavigationRouterType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationRouterType.swift; sourceTree = "<group>"; };
|
||||||
|
7D0CBC76C80E04345E11F2DB /* Application.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = "<group>"; };
|
||||||
7DDBF99755A9008CF8C8499E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
7DDBF99755A9008CF8C8499E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||||
7FFCC48E7F701B6C24484593 /* WeakDictionaryKeyReference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeakDictionaryKeyReference.swift; sourceTree = "<group>"; };
|
7FFCC48E7F701B6C24484593 /* WeakDictionaryKeyReference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeakDictionaryKeyReference.swift; sourceTree = "<group>"; };
|
||||||
81B17DB1BC3B0C62AF84D230 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
81B17DB1BC3B0C62AF84D230 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||||
@@ -568,6 +570,7 @@
|
|||||||
951A66D15CD44C0EACE4A951 /* Sources */ = {
|
951A66D15CD44C0EACE4A951 /* Sources */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
7D0CBC76C80E04345E11F2DB /* Application.swift */,
|
||||||
A069578069541F94F2AF016C /* ElementXUITests.swift */,
|
A069578069541F94F2AF016C /* ElementXUITests.swift */,
|
||||||
0CCEAA8205BCCCB8DBE01724 /* ElementXUITestsLaunchTests.swift */,
|
0CCEAA8205BCCCB8DBE01724 /* ElementXUITestsLaunchTests.swift */,
|
||||||
4D6E4C37E9F0E53D3DF951AC /* HomeScreenUITests.swift */,
|
4D6E4C37E9F0E53D3DF951AC /* HomeScreenUITests.swift */,
|
||||||
@@ -1032,6 +1035,7 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
7405B4824D45BA7C3D943E76 /* Application.swift in Sources */,
|
||||||
20563476E4766B9C3035E461 /* ElementXUITests.swift in Sources */,
|
20563476E4766B9C3035E461 /* ElementXUITests.swift in Sources */,
|
||||||
4E50727077B53D26A7C3E504 /* ElementXUITestsLaunchTests.swift in Sources */,
|
4E50727077B53D26A7C3E504 /* ElementXUITestsLaunchTests.swift in Sources */,
|
||||||
9DC5FB22B8F86C3B51E907C1 /* HomeScreenUITests.swift in Sources */,
|
9DC5FB22B8F86C3B51E907C1 /* HomeScreenUITests.swift in Sources */,
|
||||||
|
|||||||
@@ -27,9 +27,8 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
codeCoverageEnabled = "YES"
|
|
||||||
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "NO">
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
@@ -63,6 +62,13 @@
|
|||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<CommandLineArguments>
|
<CommandLineArguments>
|
||||||
</CommandLineArguments>
|
</CommandLineArguments>
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "IS_RUNNING_UNIT_TESTS"
|
||||||
|
value = "1"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
</EnvironmentVariables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
|
|||||||
@@ -13,8 +13,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
private var appCoordinator: AppCoordinator!
|
private var appCoordinator: AppCoordinator!
|
||||||
|
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||||
|
if isRunningUnitTests {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if isRunningUITests {
|
||||||
|
// Bootstrap a different version of the application
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
appCoordinator = AppCoordinator()
|
appCoordinator = AppCoordinator()
|
||||||
appCoordinator.start()
|
appCoordinator.start()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var isRunningUnitTests: Bool {
|
||||||
|
#if DEBUG
|
||||||
|
ProcessInfo.processInfo.environment["IS_RUNNING_UNIT_TESTS"] == "1"
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private var isRunningUITests: Bool {
|
||||||
|
#if DEBUG
|
||||||
|
ProcessInfo.processInfo.environment["IS_RUNNING_UI_TESTS"] == "1"
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
name: ElementX
|
name: ElementX
|
||||||
|
|
||||||
|
schemes:
|
||||||
|
ElementX:
|
||||||
|
analyze:
|
||||||
|
config: Debug
|
||||||
|
archive:
|
||||||
|
config: Release
|
||||||
|
build:
|
||||||
|
targets:
|
||||||
|
ElementX:
|
||||||
|
- running
|
||||||
|
- testing
|
||||||
|
- profiling
|
||||||
|
- analyzing
|
||||||
|
- archiving
|
||||||
|
profile:
|
||||||
|
config: Release
|
||||||
|
run:
|
||||||
|
config: Debug
|
||||||
|
test:
|
||||||
|
config: Debug
|
||||||
|
environmentVariables:
|
||||||
|
IS_RUNNING_UNIT_TESTS: "1"
|
||||||
|
targets:
|
||||||
|
- UnitTests
|
||||||
|
- UITests
|
||||||
|
|
||||||
targets:
|
targets:
|
||||||
ElementX:
|
ElementX:
|
||||||
type: application
|
type: application
|
||||||
@@ -34,12 +60,6 @@ targets:
|
|||||||
else
|
else
|
||||||
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
|
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
scheme:
|
|
||||||
gatherCoverageData: true
|
|
||||||
testTargets:
|
|
||||||
- UnitTests
|
|
||||||
- UITests
|
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- package: MatrixRustSDK
|
- package: MatrixRustSDK
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// Application.swift
|
||||||
|
// UITests
|
||||||
|
//
|
||||||
|
// Created by Stefan Ceriu on 13/04/2022.
|
||||||
|
// Copyright © 2022 element.io. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import XCTest
|
||||||
|
|
||||||
|
struct Application {
|
||||||
|
func launch() {
|
||||||
|
let app = XCUIApplication()
|
||||||
|
app.launchEnvironment = ["IS_RUNNING_UI_TESTS": "1"]
|
||||||
|
app.launch()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,8 +24,7 @@ class ElementXUITests: XCTestCase {
|
|||||||
|
|
||||||
func testExample() throws {
|
func testExample() throws {
|
||||||
// UI tests must launch the application that they test.
|
// UI tests must launch the application that they test.
|
||||||
let app = XCUIApplication()
|
Application().launch()
|
||||||
app.launch()
|
|
||||||
|
|
||||||
// Use recording to get started writing UI tests.
|
// Use recording to get started writing UI tests.
|
||||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||||
@@ -35,7 +34,7 @@ class ElementXUITests: XCTestCase {
|
|||||||
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
|
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
|
||||||
// This measures how long it takes to launch your application.
|
// This measures how long it takes to launch your application.
|
||||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
||||||
XCUIApplication().launch()
|
Application().launch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user