diff --git a/UITests/DocumentationExportUITests.swift b/UITests/DocumentationExportUITests.swift index 8fafceff..aaacc461 100644 --- a/UITests/DocumentationExportUITests.swift +++ b/UITests/DocumentationExportUITests.swift @@ -103,12 +103,19 @@ final class DocumentationExportUITests: XCTestCase { app.typeText(parent.path) app.typeKey(.return, modifierFlags: []) let panel = app.dialogs["open-panel"] - XCTAssertTrue(panel.waitForExistence(timeout: 5), app.debugDescription) + // Check current readiness before starting a polling wait; `||` + // short-circuits, so delayed readiness keeps the same bounded waits. + XCTAssertTrue( + panel.exists || panel.waitForExistence(timeout: 5), app.debugDescription) // AppKit exposes this button's localized AXTitle, not an AXLabel. // Its in-dialog identifier excludes the Touch Bar duplicate. let choose = panel.buttons["OKButton"] - XCTAssertTrue(choose.waitForExistence(timeout: 5), app.debugDescription) - XCTAssertTrue(choose.wait(for: \.isHittable, toEqual: true, timeout: 5)) + XCTAssertTrue( + choose.exists || choose.waitForExistence(timeout: 5), app.debugDescription) + XCTAssertTrue( + choose.isHittable + || choose.wait(for: \.isHittable, toEqual: true, timeout: 5), + app.debugDescription) recordSegment("panel") choose.click() XCTAssertTrue( diff --git a/docs/DOCUMENTATION-UI-PROFILING.md b/docs/DOCUMENTATION-UI-PROFILING.md index 48f20b0c..fba159fb 100644 --- a/docs/DOCUMENTATION-UI-PROFILING.md +++ b/docs/DOCUMENTATION-UI-PROFILING.md @@ -55,3 +55,22 @@ The performance lane's compile/link overhead is a separate hypothesis. Inspect t actual build graph and configuration differences before proposing reuse. Existing lane-partition checks already prevent duplicated performance/golden coverage work; that existing behavior is not a new optimization. + +## Already-ready folder-panel checks + +The folder-panel journey checks the current `exists`/`isHittable` state before +starting XCTest's polling waits. The same three assertions and five-second +fallback waits remain: the real open panel must exist, its scoped OK button must +exist, and that button must be hittable. Export still uses the native button after +Go to Folder keyboard navigation and path entry; no pasteboard shortcut, seeded +panel location, or programmatic export replaces that interaction. + +Each check is a short-circuiting `exists || waitForExistence(...)` (or the +`isHittable` equivalent), so an already-ready control skips the wait call and a +delayed or missing control reaches the same bounded wait and failure. It is a +candidate optimization, not a guaranteed duration reduction: XCTest's waits also +evaluate readiness when they start, and the extra accessibility query adds cost +when readiness is delayed. Use the identical eight-phase markers and matched-run +protocol above to determine its effect. A single candidate CI run versus a +historical baseline is diagnostic; it cannot establish a reproducible improvement +or quantify workflow savings.