1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 20:10:08 +02:00

️ Sped up and improved UI test

This commit is contained in:
2022-10-15 16:37:33 +02:00
parent cb3208c008
commit 273070ef27
4 changed files with 91 additions and 45 deletions

View File

@ -0,0 +1,53 @@
//
// UI_Tests.swift
// UI Tests
//
// Created by Nico Verbruggen on 14/10/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import XCTest
final class StartupTest: UITestCase {
override func setUpWithError() throws {
continueAfterFailure = false
}
override func tearDownWithError() throws {}
func testApplicationCanLaunchWithTestConfigurationAndIdles() throws {
let app = XCUIApplication()
app.launchArguments = ["--configuration:working"]
app.launch()
}
func testApplicationCanLaunchWithTestConfigurationAndThrowsAlert() throws {
let app = XCUIApplication()
app.launchArguments = ["--configuration:broken"]
app.launch()
// Dialog 1: "PHP is not correctly installed"
assertAllExist([
app.dialogs["Notice"],
app.staticTexts["PHP is not correctly installed"],
app.buttons["OK"],
])
click(app.buttons["OK"])
// Dialog 2: PHP Monitor failed to start
assertAllExist([
app.dialogs["Notice"],
app.staticTexts["PHP Monitor cannot start due to a problem with your system configuration"],
app.buttons["Retry"],
app.buttons["Quit"]
])
click(app.buttons["Retry"])
// Dialog 1 again
assertExists(app.staticTexts["PHP is not correctly installed"])
// At this point, we can terminate the test
app.terminate()
}
}