This commit is contained in:
Dr. Michael Kübler
2026-11-07 23:24:14 +01:00
committed by Dr. Michael Kübler
parent 8e95cc3acd
commit c5e46946ac
16 changed files with 1073 additions and 197 deletions
+79 -2
View File
@@ -49,7 +49,7 @@ final class MikeMailUITests: XCTestCase {
app.menuItems["New"].hover()
app.menuItems["New Window"].click()
}
let table = app.outlines.element(boundBy: 1)
let table = app.outlines.firstMatch
XCTAssertTrue(table.waitForExistence(timeout: 5), app.debugDescription)
let row = table.descendants(matching: .outlineRow).firstMatch
XCTAssertTrue(row.waitForExistence(timeout: 5), app.debugDescription)
@@ -62,6 +62,83 @@ final class MikeMailUITests: XCTestCase {
XCTAssertGreaterThanOrEqual(app.windows.count, 2, app.debugDescription)
reply.click()
XCTAssertTrue(app.textFields["composeCC"].waitForExistence(timeout: 5))
app.buttons["Abbrechen"].click()
let compose = app.windows["Neue Nachricht"].firstMatch
XCTAssertTrue(compose.waitForExistence(timeout: 5))
XCTAssertGreaterThanOrEqual(app.windows.count, 3)
let body = compose.textViews["composeBody"]
XCTAssertTrue(body.waitForExistence(timeout: 5))
app.typeText("Antwort am Anfang ")
XCTAssertTrue((body.value as? String ?? "").hasPrefix("Antwort am Anfang "))
let oldFrame = compose.frame
resizeWindow(compose, app: app)
XCTAssertNotEqual(compose.frame.size, oldFrame.size)
compose.buttons["Abbrechen"].click()
let oldDetail = detail.frame
detail.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.01)).click()
resizeWindow(detail, app: app)
XCTAssertNotEqual(detail.frame.size, oldDetail.size)
}
@MainActor
func testDeleteConfirmation() {
let app = XCUIApplication()
app.launchArguments = ["-ApplePersistenceIgnoreState", "YES", "--ui-fixture", "-checkOnLaunch", "NO",
"-idleEnabled", "NO", "-pollMinutes", "0", "-selectedFolder", "unified:inbox", "-mailSearch", "",
"-mailDeleteConfirmation", "always", "--ui-busy"]
app.launch()
app.activate()
if app.windows.count == 0 {
app.menuBars.menuBarItems["File"].click()
app.menuItems["New"].hover()
app.menuItems["New Window"].click()
}
let table = app.outlines.firstMatch
XCTAssertTrue(table.waitForExistence(timeout: 5))
table.staticTexts["UI-Nachricht 1"].firstMatch.click()
app.buttons["Löschen…"].firstMatch.click()
XCTAssertTrue(app.buttons["Abbrechen"].waitForExistence(timeout: 3), app.debugDescription)
if app.buttons["Abbrechen"].exists { app.buttons["Abbrechen"].click() }
}
@MainActor
func testAccountReorderingAndDisclosure() {
continueAfterFailure = false
let app = XCUIApplication()
app.launchArguments = ["-ApplePersistenceIgnoreState", "YES", "--ui-fixture", "-checkOnLaunch", "NO",
"-idleEnabled", "NO", "-pollMinutes", "0", "-selectedFolder", "unified:inbox", "-mailSearch", ""]
app.launch()
app.activate()
if app.windows.count == 0 {
app.menuBars.menuBarItems["File"].click()
app.menuItems["New"].hover()
app.menuItems["New Window"].click()
}
app.activate()
let sidebar = app.tables["accountSidebar"]
XCTAssertTrue(sidebar.waitForExistence(timeout: 5))
let rows = sidebar.tableRows
XCTAssertTrue(rows.element(boundBy: 4).waitForExistence(timeout: 5))
let source = rows.element(boundBy: 4)
let target = rows.element(boundBy: 2)
let disclosure = target.buttons.firstMatch
XCTAssertTrue(disclosure.exists)
XCTAssertEqual(disclosure.frame.midY, target.frame.midY, accuracy: 2)
source.staticTexts["Zweites Testkonto"].click(forDuration: 1, thenDragTo: target.staticTexts["UI-Prüfung"])
XCTAssertTrue(rows.element(boundBy: 2).debugDescription.contains("second@example.com"), sidebar.debugDescription)
}
@MainActor
private func resizeWindow(_ window: XCUIElement, app: XCUIApplication) {
let original = window.frame.size
app.menuBars.menuBarItems["Window"].click()
app.menuItems["Fill"].click()
if window.frame.size == original {
app.menuBars.menuBarItems["Window"].click()
app.menuItems["Move & Resize"].hover()
app.menuItems["Left"].click()
}
let changed = NSPredicate { _, _ in window.frame.size != original }
expectation(for: changed, evaluatedWith: window)
waitForExpectations(timeout: 3)
}
}