Repository navigation
test(e2e): cover sudoku hub failure flows N3-N5 (#935) - #937
Merged
Merged
Conversation
Adds host-driven XCUITest E2E coverage for the Sudoku-only negative Daily/Practice hub flows in docs/navigation-flows.md §4: N3 (Practice draw failure), N4 (Daily .exhausted, both the Practice-swap and Cancel-to-Home exits), and N5 (Daily .failed fetch error). These rows are Sudoku-only — MS's daily/practice fetches are synchronous and non-throwing (N6), so this failure class is structurally unreachable there; no MS counterpart is added. A new DEBUG-only -uitest-puzzle-fault <mode> launch arg (GameAppKit.UITestLaunchArg) and a wrapping UITestFaultingPuzzleProvider (SudokuAppComposition) let the E2E suite force PuzzleStore's fetchDailyTrio/fetchPracticePool to fail deterministically, since the live generator otherwise has no reliable way to produce these outcomes on demand. Stable a11y ids (sudoku.practiceHub.failure, sudoku.dailyHub.exhausted[.practice/.cancel], sudoku.dailyHub.failure) anchor the new tests; docs/screen-contracts.md is updated to match, including correcting a stale ".alert" claim for the .exhausted state that #768 had already replaced with an inline block. Co-Authored-By: Claude <[email protected]>
Review follow-up on PR #937 (CR round 1): - UITestLaunchArgTests: 4-case suite for puzzleFaultValue(in:) mirroring the routeValue template (parses value / nil when absent / nil without trailing value / first occurrence wins). - navigation-flows.md N3 code anchor updated to PracticeHubViewModel.swift:94-96 (pre-existing drift; the catch/.failed branch moved since the row was written). Co-Authored-By: Claude <[email protected]>
7 tasks done
wei18
added a commit
that referenced
this pull request
Jul 23, 2026
Adds host-driven XCUITest E2E coverage for N12 (Sudoku) / N13 (MS): Close on the daily re-view Completion route (SUD-COMPLETION-REVIEW / MS-COMPLETION-REVIEW, pushed from a completed daily card) pops exactly one path entry back to the Daily hub. Completed-daily state lives in CloudKit Private DB and cannot be produced by real play on the CI simulator (signed-out CK degrades to "no cards"; the near-win boards use no-op persistence and write nothing), so a new DEBUG-only -uitest-seed-completed-daily launch arg (GameAppKit.UITestLaunchArg) seeds today's daily trio as already completed: - Sudoku: UITestSeededCompletedDailyPersistence (SudokuAppComposition) wraps the live PersistenceProtocol, reporting today's three daily puzzleIds as completed (fetchCompletedDailyIds/ByDay) with a frozen loadIfExists snapshot built from the real Puzzle the puzzleProvider reverse-derives for that id. - Minesweeper: MinesweeperDailyHubViewModel's completed-card tap is fully synchronous (no snapshot fetch), so only the completed-ids read needs faking. MinesweeperSavedGameStore had no protocol seam, so this extracts MinesweeperDailyOverlayReading (MinesweeperPersistence) covering exactly the two methods the VM's phase-2 overlay calls (fetchFailedDailyIds/fetchCompletedDailyIdsByDay) — verified by reading the VM's actual call sites, not by widening every consumer. UITestSeededCompletedDailyOverlayReading (MinesweeperAppComposition) is the DEBUG fake; LiveRouteFactory threads it as a separate dailyOverlayReading param alongside the existing concrete savedGameStore (which other consumers — board save/resume/replay, MinesweeperDailyOpenGuardView — keep using unchanged). New stable a11y ids anchor both tests: sudoku.dailyHub.root / minesweeper.dailyHub.root (a zero-size .background marker sibling to the week-strip header, not an ancestor of its day-dot elements — avoids the #937 "container id clobbers descendant ids" cascade) and sudoku.dailyHub.card.completed / minesweeper.dailyHub.card.completed (applied on the card's own accessibilityElement alongside its existing combined label). docs/navigation-flows.md's N12/N13 anchors were stale (:226/:282); fixed to :260/:311 and cross-referenced to the new E2E tests. docs/screen-contracts.md documents the new ids and the E2E coverage. Both new tests were verified to fail (no completed card to tap) with the seed temporarily forced off, then pass again once restored. Part of #935. Co-Authored-By: Claude <[email protected]>
wei18
added a commit
that referenced
this pull request
Jul 23, 2026
* test(e2e): cover daily re-view completion close N12/N13 (#935) Adds host-driven XCUITest E2E coverage for N12 (Sudoku) / N13 (MS): Close on the daily re-view Completion route (SUD-COMPLETION-REVIEW / MS-COMPLETION-REVIEW, pushed from a completed daily card) pops exactly one path entry back to the Daily hub. Completed-daily state lives in CloudKit Private DB and cannot be produced by real play on the CI simulator (signed-out CK degrades to "no cards"; the near-win boards use no-op persistence and write nothing), so a new DEBUG-only -uitest-seed-completed-daily launch arg (GameAppKit.UITestLaunchArg) seeds today's daily trio as already completed: - Sudoku: UITestSeededCompletedDailyPersistence (SudokuAppComposition) wraps the live PersistenceProtocol, reporting today's three daily puzzleIds as completed (fetchCompletedDailyIds/ByDay) with a frozen loadIfExists snapshot built from the real Puzzle the puzzleProvider reverse-derives for that id. - Minesweeper: MinesweeperDailyHubViewModel's completed-card tap is fully synchronous (no snapshot fetch), so only the completed-ids read needs faking. MinesweeperSavedGameStore had no protocol seam, so this extracts MinesweeperDailyOverlayReading (MinesweeperPersistence) covering exactly the two methods the VM's phase-2 overlay calls (fetchFailedDailyIds/fetchCompletedDailyIdsByDay) — verified by reading the VM's actual call sites, not by widening every consumer. UITestSeededCompletedDailyOverlayReading (MinesweeperAppComposition) is the DEBUG fake; LiveRouteFactory threads it as a separate dailyOverlayReading param alongside the existing concrete savedGameStore (which other consumers — board save/resume/replay, MinesweeperDailyOpenGuardView — keep using unchanged). New stable a11y ids anchor both tests: sudoku.dailyHub.root / minesweeper.dailyHub.root (a zero-size .background marker sibling to the week-strip header, not an ancestor of its day-dot elements — avoids the #937 "container id clobbers descendant ids" cascade) and sudoku.dailyHub.card.completed / minesweeper.dailyHub.card.completed (applied on the card's own accessibilityElement alongside its existing combined label). docs/navigation-flows.md's N12/N13 anchors were stale (:226/:282); fixed to :260/:311 and cross-referenced to the new E2E tests. docs/screen-contracts.md documents the new ids and the E2E coverage. Both new tests were verified to fail (no completed card to tap) with the seed temporarily forced off, then pass again once restored. Part of #935. Co-Authored-By: Claude <[email protected]> * docs(contracts): point N13 anchor at the Close closure, not its comment (#935) CR round 1 on PR #942: MinesweeperAppComposition/LiveRouteFactory.swift:311 is the #697 comment block; the actual `onClose: { closePath?.wrappedValue.removeLast() }` sits at :326, matching the Sudoku N12 convention of anchoring the code line. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
This was referenced Jul 27, 2026
Closed
wei18
added a commit
that referenced
this pull request
Jul 27, 2026
…951) (#952) Pulls wei18/apple-dev-skills#41 into the submodule pointer: the swiftui-interaction-footguns skill now documents that a container's accessibilityIdentifier can clobber its descendants' own ids in the XCUITest AX tree, with the leaf / sibling-marker fixes and the ScrollView counter-example. Both sightings came out of this repo's #935 E2E batches (#937 exhausted-block buttons, #942 daily-hub root anchors). Closes #951 Co-authored-by: Claude <[email protected]>
wei18
added a commit
that referenced
this pull request
Jul 28, 2026
…en the Cancel half (#956) (#957) Re-diagnosed the intermittent test_clearCacheCancelAndFailureToast_N19 failure: the issue's original "fixed backdrop coordinate" hypothesis was wrong. Repeat-running under contention reproduced the flake at ~15-50%, always at the same assertion ("should raise the failure toast"), with the Cancel/backdrop-dismiss half always succeeding. Root cause: a race in SettingsViewModel.clearCache() — deleteAbandoned only runs `if let candidate = resumeCandidate`, and resumeCandidate is populated by bootstrap()'s async persistence.latestInProgress() fetch. If that hadn't resolved by the time the test tapped Confirm, clearCache() silently fell through to the unconditional success toast instead of the failure one. Closes the race product-side: SettingsViewModel.isCacheStateReady flips true once bootstrap() settles either way; SettingsStorageSection renders a zero-size, non-localized settings.storage.cacheReady sibling marker only while it's true (mirrors DailyHubView's sudoku.dailyHub.root pattern, no container id per the #937 lesson, no L10n work needed). Threaded through SettingsScreen -> GameAppKit.SettingsView (both apps share the composition). The E2E test now waits for that anchor before touching the row at all. Also hardens the Cancel/backdrop half per the issue's directions: waits for the confirm button to be isHittable (not merely exists) before every tap, re-queries a fresh handle after reopening instead of reusing the pre-Cancel one, and taps the popover's own PopoverDismissRegion backdrop element (discovered via idb ui_describe_all) instead of a fixed normalized-offset coordinate. Split the clear-cache helper into NegativeNavigationE2ESupport+ClearCache.swift to keep the main file under the 400-line SwiftLint ceiling, and updated docs/screen-contracts.md accordingly. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #935.
Batch 2 of the negative-navigation E2E coverage: adds host-driven XCUITest
coverage for Sudoku's N3/N4/N5 rows (docs/navigation-flows.md §4) —
Practice draw failure, Daily
.exhausted(both the Practice-swap andCancel-to-Home exits), and Daily
.failed.-uitest-puzzle-fault <mode>launch arg(
GameAppKit.UITestLaunchArg, mode one ofpracticeFail/dailyExhausted/dailyFail) plus a wrappingUITestFaultingPuzzleProvider(SudokuAppComposition) that forcesPuzzleStore'sfetchDailyTrio/fetchPracticePoolto faildeterministically — the live generator has no reliable way to produce
these outcomes from a real fetch on demand.
sudoku.practiceHub.failure,sudoku.dailyHub.exhausted(+.practice/.cancel),sudoku.dailyHub.failure.App/SudokuE2ETests/SudokuE2ETests.swift(
test_practiceDrawFailureShowsCaptionNoNavigation_N3,test_dailyExhaustedPracticeLandsOnPracticeHub_N4,test_dailyExhaustedCancelLandsOnHome_N4,test_dailyLoadFailureShowsInlineWarning_N5).docs/screen-contracts.mdupdated with the new ids forSUD-PRACTICE-HUB/
SUD-DAILY-HUB, and corrects a stale claim that.exhaustedrenders asystem
.alert— fix(sudoku): Daily .exhausted shows a system alert over a blank page — inconsistent with inline board-load-failed treatment #768 replaced that with the inline block this PR isnow anchoring.
Sudoku-only, no MS counterpart (N6): MS's daily/practice fetches
(
dailyTrio(date:)) are synchronous and non-throwing, so this wholefailure class is structurally unreachable on Minesweeper — see
navigation-flows.mdrow N6 ("onPhase1Errorcomment: unreachable").Test plan
swift test --package-path Packages/GameAppKit— 46/46 passswift test --package-path Packages/SudokuKit— full suite passedclean once (exit 0); a rerun hit the known pre-existing local segfault
near ToastController/SettingsView NSWindow tests (parallel-execution
flake, not introduced by this PR) — confirmed by a filtered rerun
scoped to every changed area (
DailyHub|PracticeHub|RouteFactory| SudokuAppComposition): 117/117 pass.mise run test:ui sudoku— 12/12 pass (8 pre-existing + 4 new)mise run test:ui minesweeper— 8/8 pass, no regressionmise run lint:swift_strict <changed files>— 0 violationsdailyExhaustedfault modedelegate instead of throw —
test_dailyExhaustedPracticeLandsOnPracticeHub_N4failed with
XCTAssertTrue failed - N4: exhausted block should appear under the -uitest-puzzle-fault seam; reverted, suite green again.🤖 Generated with Claude Code