Added custom enviroment flags for unit and UI tests.

This commit is contained in:
Stefan Ceriu
2022-04-13 17:19:11 +03:00
parent c605dca245
commit 3c0ca95e8f
6 changed files with 82 additions and 11 deletions
+17
View File
@@ -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()
}
}
+2 -3
View File
@@ -24,8 +24,7 @@ class ElementXUITests: XCTestCase {
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
Application().launch()
// Use recording to get started writing UI tests.
// 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, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
Application().launch()
}
}
}