Files
letro-ios/ElementX/Sources/Other/Extensions/ProcessInfo.swift
Stefan Ceriu 79e3758887 Integration test improvements (#3330)
* Send a message from integration tests and check that it doesn't show up in the app logs
* Increase photo library timeout

* Wait for image tapping to process

* Send a message using the rich text editor too

* Wait for the various pickers to finish loading

* Set all logs to `trace` in integration tests

* Close formatting options after sending the second message

* Make sure logs are actually sent to tracing and get redirected to the right file

* Switch from using a custom `trace` log configuration to the lowest level `TracingConfiguration` we support
2024-09-26 10:15:09 +03:00

71 lines
1.8 KiB
Swift

//
// Copyright 2022-2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
import Foundation
extension ProcessInfo {
/// Flag indicating whether the app is running the unit tests.
static var isRunningUnitTests: Bool {
#if DEBUG
processInfo.environment["IS_RUNNING_UNIT_TESTS"] == "1"
#else
false
#endif
}
/// Flag indicating whether the app is running the UI tests.
static var isRunningUITests: Bool {
#if DEBUG
processInfo.environment["UI_TESTS_SCREEN"] != nil
#else
false
#endif
}
static var isRunningIntegrationTests: Bool {
#if DEBUG
processInfo.environment["IS_RUNNING_INTEGRATION_TESTS"] == "1"
#else
false
#endif
}
/// Flag indicating whether the app is running the UI tests or unit tests.
static var isRunningTests: Bool {
isRunningUITests || isRunningUnitTests || isRunningIntegrationTests
}
/// The identifier of the screen to be loaded when running UI tests.
static var testScreenID: UITestsScreenIdentifier? {
#if DEBUG
processInfo.environment["UI_TESTS_SCREEN"].flatMap(UITestsScreenIdentifier.init)
#else
nil
#endif
}
static var shouldDisableTimelineAccessibility: Bool {
guard isRunningUITests else {
return false
}
#if DEBUG
return processInfo.environment["UI_TESTS_DISABLE_TIMELINE_ACCESSIBILITY"] != nil
#else
return false
#endif
}
static var isXcodePreview: Bool {
#if DEBUG
processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
#else
false
#endif
}
}