From 60972a0704a4fcff4d785f8a47308da52cc2df02 Mon Sep 17 00:00:00 2001 From: Gronod Date: Sat, 12 Sep 2026 16:53:30 +0100 Subject: [PATCH] test(m9): replace full-timeout negative waits with dwell assertion (#140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two XCTAssertFalse(el.waitForExistence(timeout: 3)) sites in Milestone2UITests always burned the full 3s on the expected-absent path. Add assertAbsent(_:dwell:) (0.5s dwell + .exists) and use it at both sites — same coverage, ~6s back per suite run. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- Tests/ICCeryUITests/Milestone2UITests.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tests/ICCeryUITests/Milestone2UITests.swift b/Tests/ICCeryUITests/Milestone2UITests.swift index 31bdded..4455f0a 100644 --- a/Tests/ICCeryUITests/Milestone2UITests.swift +++ b/Tests/ICCeryUITests/Milestone2UITests.swift @@ -85,6 +85,16 @@ final class Milestone2UITests: XCTestCase { return el } + /// Assert an element stays absent after a short dwell — unlike + /// `waitForExistence`, which always burns its full timeout on the + /// negative path. + private func assertAbsent(_ el: XCUIElement, dwell: TimeInterval = 0.5, + _ message: String = "expected element to stay absent", + file: StaticString = #filePath, line: UInt = #line) { + RunLoop.current.run(until: Date().addingTimeInterval(dwell)) + XCTAssertFalse(el.exists, message, file: file, line: line) + } + private func staticText(_ exact: String) -> XCUIElement { let inApp = app.staticTexts[exact] if inApp.exists { return inApp } @@ -316,7 +326,7 @@ final class Milestone2UITests: XCTestCase { "identifier BEGINSWITH 'btnDeletePreset-'") XCTAssertTrue(deleteButtons.firstMatch.waitForExistence(timeout: 5)) deleteButtons.firstMatch.click() - XCTAssertFalse(staticText("UI Test Preset").waitForExistence(timeout: 3)) + assertAbsent(staticText("UI Test Preset")) } /// Export a preset to JSON and re-import it (issue #11). @@ -348,7 +358,7 @@ final class Milestone2UITests: XCTestCase { let deleteButtons = buttonsMatching( "identifier BEGINSWITH 'btnDeletePreset-'") deleteButtons.firstMatch.click() - XCTAssertFalse(staticText("RoundTrip").waitForExistence(timeout: 3)) + assertAbsent(staticText("RoundTrip")) // Copy the export to the import path so the hook picks it up. try FileManager.default.copyItem(at: exportURL, to: importURL) -- 2.39.5