Skip to content

test(e2e): cover att primer, clear-cache and iap negative flows N15/N19/N22 (#935) - #949

Merged
wei18 merged 1 commit into
mainfrom
test/e2e-negative-nav-935-b5
Jul 27, 2026
Merged

wei18 merged 1 commit into
mainfrom
test/e2e-negative-nav-935-b5

Conversation

@wei18

@wei18 wei18 commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Part of #935

Summary

Batch 5 (final N-row group) of #935's host-driven XCUITest E2E negative-navigation coverage. Adds three new tests to both apps and closes out the remaining doc rows per the Leader's batch-5 scope adjudication (issue #935, latest comment).

Became E2E tests

  • N15 (ATT primer decline) — -uitest-fake-ad-gate-repoll (opens the banner ad-gate, this primer's only trigger) + new -uitest-att-primer (forces isNotDetermined→true / requestSystemPrompt→no-op). Asserts "Not now" dismisses the sheet, Home stays present, and a second background→foreground cycle does NOT re-offer (the hasOffered latch). New a11y ids att.primer.continue / att.primer.notNow.
  • N19 (clear-cache Cancel + failure) — UNBLOCKED (fix(sudoku): clearCache always shows a success toast even when the delete fails (MS shows failure) #687 was fixed 2026-07-05 by ca21ca9/fix(sudoku): show failure toast when clearCache delete throws #690, unified into GameAppKit/SettingsViewModel.swift by refactor(mirror): unify Sudoku/MS SettingsView wrapper + Settings.bundle Root.plist into one shared source #832; the row's "blocked" note and both code anchors were stale). New -uitest-clear-cache-fail swaps in UITestClearCacheFailPersistence (synthetic in-progress saved game + throwing deleteAbandoned). New a11y ids settings.storage.clearCache(.confirm/.cancel), monetization.toast.(success/failure). Empirical finding: on this environment .confirmationDialog renders as a centered popover (not a bottom action sheet) — the role: .cancel button has no discrete accessibility element; Cancel is a backdrop tap. Documented in screen-contracts.md.
  • N22 (IAP purchase cancel/fail/pending) — new -uitest-iap-script swaps in UITestScriptedIAPClient (scripted .userCancelled → .failed → .pending), never the real StoreKit 2 payment sheet. New a11y id settings.iap.removeAds.

Bug found and fixed along the way: RemoveAdsRow/RestorePurchasesRow used .buttonStyle(.plain) with an internal Spacer() but no .contentShape(Rectangle()) — the swiftui-interaction-footguns "tap target shrink" pattern — leaving the row's middle an untappable dead zone for real users, not just the E2E driver. Root-caused via a synchronous tap-counter probe after print()-based app-console debugging proved unreliable in this harness; fixed with the one-line .contentShape(Rectangle()) idiom the skill prescribes.

Stayed doc-only / OUT of E2E scope (per adjudication)

  • N16 (UMP/ATT boot) — covered by launch smoke + BootDoesNotRequestATTTests; UMP form is Google-owned/EEA-only.
  • N18 (MS reminder tap deep-link) — no URL scheme exists in the repo; delegate hop is unit-scope, landing already covered by -uitest-route daily.
  • N20 (GC signed-out, Completion) — marked documentation-only; refactor(completion): delete dead leaderboard-zone state machine (both apps hardcode .hidden) #698 deleted the state machine.
  • N21 (ATT system denied) — no behavioral branch to assert; anchor updated to follow the makeATTPrimerCoordinator() extraction (MakeGameApp+Helpers.swift:101).
  • N23 (Restore empty result) — would pin a documented UX gap a future polish pass intentionally changes; unit scope.
  • N17 stays snapshot/unit per the batch-4 adjudication (unchanged this batch).

Mechanical

MakeGameApp.swift was at the 400-line SwiftLint ceiling; the three new wiring seams are extracted into makeIAPClient / makeATTPrimerCoordinator helpers (MakeGameApp+Helpers.swift) with their resolve* gates in MakeGameApp+UITestOverrides.swift, net reducing MakeGameApp.swift to 390 lines. SudokuE2ETests+MonetizationFlows.swift is a new extension file (Tuist glob-discovered) splitting the three new Sudoku tests out to keep SudokuE2ETests.swift under 400 lines too.

Test plan

  • swift test --package-path Packages/GameAppKit — 58/58
  • swift test --package-path Packages/AppMonetizationKit — 120/120
  • swift test --package-path Packages/SettingsKit — 51/51
  • mise run test:ui sudoku — 18/18 incl. test_attPrimerDeclineDismissesAndLatches_N15, test_clearCacheCancelAndFailureToast_N19, test_iapPurchaseCancelFailPendingStayInPlace_N22
  • mise run test:ui minesweeper — 14/14, same three
  • mise run lint:swift_strict on all changed Swift files — 0 violations
  • Negative proof: scripted IAP fake's first result flipped .userCancelled → .success → test_iapPurchaseCancelFailPendingStayInPlace_N22 FAILS (XCTAssertFalse on "cancelled must never raise a toast"); reverted → green again

🤖 Generated with Claude Code

…19/N22 (#935)

Batch 5 (final) of #935's host-driven XCUITest E2E negative-flow coverage.
Adds -uitest-att-primer / -uitest-clear-cache-fail / -uitest-iap-script
DEBUG-only launch-arg seams (GameAppKit) so the ATT primer decline,
clear-cache failure toast, and IAP purchase cancel/fail/pending flows can
be driven deterministically in both apps without real ATT/CloudKit/
StoreKit 2 dependencies. Extracts three construction sites out of
MakeGameApp.swift into MakeGameApp+Helpers.swift /
+UITestOverrides.swift to stay under the 400-line SwiftLint ceiling.

Along the way, N22's investigation surfaced and fixed a real pre-existing
bug: RemoveAdsRow/RestorePurchasesRow used .buttonStyle(.plain) with an
internal Spacer() but no .contentShape(Rectangle()), leaving the row's
middle an untappable dead zone (the swiftui-interaction-footguns "tap
target shrink" pattern) — affects real users tapping the row's center,
not just the E2E driver.

Doc corrections close out N16/N18/N20/N21/N23 per the batch-5 scope
adjudication (issue #935 latest comment): N19's stale "#687 blocked" note
and both stale code anchors are removed (fixed by ca21ca9/#690, unified by
#832); N21's anchor follows the ATT coordinator extraction; N16/N18/N23
get brief unit/launch-smoke-scope closure notes; N20 is marked
documentation-only.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant