From c13473f566c4c6fe74ddb21db4252c55f7be2da3 Mon Sep 17 00:00:00 2001 From: ykisana Date: Wed, 18 Nov 2026 21:51:20 -0600 Subject: [PATCH] test: make UI tests pass on iOS 17 and iPad again - testGroupTimedUnblockRowKeepsWholeWordsAtTheLargestTextSize starts with everything blocked and a 15-minute default, so it only taps Unblock and the QR row. On iOS 17 the Choose Key sheet opens short at the largest text size and "Block without key" is off screen. - testCardsKeepWholeWordsAtTheLargestTextSize waits for the day chips or the week strip. On iPad the chips fit at every text size. - testScheduleCardShowsAWeekStripWhenDayChipsDontFit is skipped on iPad for the same reason. - The UI-test shared store starts with the custom websites setting, as a real install already has it. AppContainer mirrors it in a .task that doesn't reconcile, so under load the first reconcile could drop the website block and testBlockedWebsitesWithoutAppsCanBeUnblockedFromHome failed. --- Normal/App/AppServices.swift | 1 + NormalUITests/BlockingUITests.swift | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Normal/App/AppServices.swift b/Normal/App/AppServices.swift index 9ff151d..e84e747 100644 --- a/Normal/App/AppServices.swift +++ b/Normal/App/AppServices.swift @@ -16,6 +16,7 @@ final class AppServices { let store = SharedStore( defaults: UserDefaults(suiteName: "uitest-\(UUID().uuidString)") ) + store.setCustomDomainsEnabled(UITestSupport.customDomains) let screenTime = ScreenTimeService(sharedStore: store, activityCenter: center) self.screenTime = screenTime timedUnblock = TimedUnblockService( diff --git a/NormalUITests/BlockingUITests.swift b/NormalUITests/BlockingUITests.swift index e4c1d4b..b665f27 100644 --- a/NormalUITests/BlockingUITests.swift +++ b/NormalUITests/BlockingUITests.swift @@ -253,7 +253,10 @@ final class BlockingUITests: XCTestCase { ]) app.mainTab("Schedules").tap() - require(app.descendants(matching: .any)["schedule.weekdayStrip"], "The schedule card should render") + let days = app.descendants(matching: .any) + .matching(NSPredicate(format: "identifier IN %@", ["schedule.weekdayStrip", "schedule.weekdayChips"])) + .firstMatch + require(days, "The schedule card should render") let schedule = try screenLines() XCTAssertTrue(schedule.contains { $0.contains("Block") }, "\"Block\" should stay one word: \(schedule)") XCTAssertTrue(schedule.contains { $0.contains("Permanent") }, "\"Permanent\" should stay one word: \(schedule)") @@ -266,25 +269,17 @@ final class BlockingUITests: XCTestCase { func testGroupTimedUnblockRowKeepsWholeWordsAtTheLargestTextSize() throws { let app = launch([ - "-uiTestSeedGroupKey", + "-uiTestSeedGroupKey", "-uiTestStartBlocked", "-uiTestDefaultDuration", "900", "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryAccessibilityXXXL", ]) app.mainTab("Groups").tap() - let blockButton = app.buttons["group.blockButton"] - require(blockButton, "Group block button should render") - blockButton.tap() - app.buttons["keySelect.blockWithoutKey"].tap() - confirmBypass(app) - let unblockButton = app.buttons["group.unblockButton"] - require(unblockButton, "Group unblock button should render after blocking") + require(unblockButton, "The group should start blocked") unblockButton.tap() - app.buttons["keySelect.row.QR"].tap() - let duration = app.buttons["timedUnblock.duration.900"] - require(duration, "Group unblock duration sheet should appear after key scan") - duration.tap() - app.buttons["timedUnblock.confirm"].tap() + let keyRow = app.buttons["keySelect.row.QR"] + require(keyRow, "Unblocking the group should ask for a key") + keyRow.tap() require(app.buttons["Block Now"], "The group card should show the timed unblock") let lines = try screenLines() @@ -309,7 +304,8 @@ final class BlockingUITests: XCTestCase { XCTAssertFalse(app.descendants(matching: .any)["schedule.weekdayStrip"].exists) } - func testScheduleCardShowsAWeekStripWhenDayChipsDontFit() { + func testScheduleCardShowsAWeekStripWhenDayChipsDontFit() throws { + try XCTSkipIf(UIDevice.current.userInterfaceIdiom == .pad, "Day chips fit on iPad's wider cards at every text size") let app = launch([ "-uiTestSeedSchedule", "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryAccessibilityXXXL",