Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
efc1ee5fa7
commit
edad031399
@ -1003,8 +1003,10 @@ final class RitualStore: RitualStoreProviding {
|
||||
do {
|
||||
try modelContext.save()
|
||||
reloadRituals()
|
||||
// Notify widgets that data has changed
|
||||
WidgetCenter.shared.reloadAllTimelines()
|
||||
// Widget timeline reloads can destabilize test hosts; skip in tests.
|
||||
if !isRunningTests {
|
||||
WidgetCenter.shared.reloadAllTimelines()
|
||||
}
|
||||
// Trigger a UI refresh for observation-based views
|
||||
analyticsNeedsRefresh = true
|
||||
insightCardsNeedRefresh = true
|
||||
|
||||
@ -32,24 +32,24 @@ final class AndromidaUITests: XCTestCase {
|
||||
|
||||
@MainActor
|
||||
func testOnboardingHappyPath() throws {
|
||||
throw XCTSkip("Temporarily disabled due flaky onboarding card accessibility matching in simulator UI tests.")
|
||||
|
||||
let app = makeApp(resetDefaults: true, hasCompletedSetupWizard: false)
|
||||
app.launch()
|
||||
|
||||
XCTAssertTrue(app.buttons["onboarding.getStarted"].waitForExistence(timeout: 8))
|
||||
app.buttons["onboarding.getStarted"].tap()
|
||||
|
||||
tapFirstAvailableElement(
|
||||
tapFirstMatchingElement(
|
||||
app: app,
|
||||
identifiers: ["onboarding.goal.health"],
|
||||
fallbackLabels: ["Health"]
|
||||
identifierPrefix: "onboarding.goal."
|
||||
)
|
||||
XCTAssertTrue(app.buttons["onboarding.goalContinue"].waitForExistence(timeout: 8))
|
||||
app.buttons["onboarding.goalContinue"].tap()
|
||||
|
||||
tapFirstAvailableElement(
|
||||
tapFirstMatchingElement(
|
||||
app: app,
|
||||
identifiers: ["onboarding.time.morning"],
|
||||
fallbackLabels: ["Morning"]
|
||||
identifierPrefix: "onboarding.time."
|
||||
)
|
||||
XCTAssertTrue(app.buttons["onboarding.timeContinue"].waitForExistence(timeout: 8))
|
||||
app.buttons["onboarding.timeContinue"].tap()
|
||||
@ -172,4 +172,28 @@ final class AndromidaUITests: XCTestCase {
|
||||
|
||||
XCTFail("Unable to locate tap target. identifiers=\(identifiers), labels=\(fallbackLabels)")
|
||||
}
|
||||
|
||||
private func tapFirstMatchingElement(
|
||||
app: XCUIApplication,
|
||||
identifierPrefix: String,
|
||||
timeout: TimeInterval = 8
|
||||
) {
|
||||
let predicate = NSPredicate(format: "identifier BEGINSWITH %@", identifierPrefix)
|
||||
let queries = [
|
||||
app.buttons.matching(predicate),
|
||||
app.otherElements.matching(predicate),
|
||||
app.staticTexts.matching(predicate),
|
||||
app.descendants(matching: .any).matching(predicate)
|
||||
]
|
||||
|
||||
for query in queries {
|
||||
let candidate = query.firstMatch
|
||||
if candidate.waitForExistence(timeout: timeout) {
|
||||
candidate.tap()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
XCTFail("Unable to locate element with identifier prefix: \(identifierPrefix)")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user