* update the sdk * updated preview tests # Conflicts: # ElementX/Sources/Screens/Timeline/View/Style/TimelineItemSendInfoLabel.swift # ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift * update sdk to 26.03.18 + regenerated preview tests after sign out copy change * updated UI tests * pr suggestions
99 lines
2.6 KiB
Swift
99 lines
2.6 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
// Copyright 2022-2025 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files 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
|
|
}
|
|
|
|
static var isRunningAccessibilityTests: Bool {
|
|
#if DEBUG
|
|
processInfo.environment["ACCESSIBILITY_VIEW"] != nil
|
|
#else
|
|
false
|
|
#endif
|
|
}
|
|
|
|
/// Flag indicating whether the app is running the UI tests or unit tests.
|
|
static var isRunningTests: Bool {
|
|
isRunningUITests || isRunningUnitTests || isRunningIntegrationTests || isRunningAccessibilityTests
|
|
}
|
|
|
|
/// 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
|
|
}
|
|
|
|
/// The identifier of the preview that will be accessibility tested
|
|
static var accessibilityViewID: String? {
|
|
#if DEBUG
|
|
processInfo.environment["ACCESSIBILITY_VIEW"]
|
|
#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
|
|
}
|
|
|
|
var platform: String {
|
|
if #available(iOS 26.1, *), ProcessInfo.processInfo.isiOSAppOnVision {
|
|
"visionOS"
|
|
} else if ProcessInfo.processInfo.isiOSAppOnMac {
|
|
"macOS"
|
|
} else {
|
|
"iOS"
|
|
}
|
|
}
|
|
}
|