diff options
| author | Christian Cleberg <[email protected]> | 2026-07-20 17:21:03 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-07-20 17:55:24 -0500 |
| commit | 38723030eb0db58a9d62a45c7725861901309a05 (patch) | |
| tree | 808f81c5ff6bbf843dbca6f55fb5a949cc9e41b8 /DomainDigUITests/AccessibilityAuditTests.swift | |
| parent | 23ef8ef9e632b205675b0fda8200635201d2a889 (diff) | |
| download | domain-dig-38723030eb0db58a9d62a45c7725861901309a05.tar.gz domain-dig-38723030eb0db58a9d62a45c7725861901309a05.tar.bz2 domain-dig-38723030eb0db58a9d62a45c7725861901309a05.zip | |
feat(a11y): add accessibility audit harness (#21 phase 0)
Phase 0 of the accessibility pass: a regression guard that must exist
before any of the remedial phases, so their acceptance criteria are
enforced rather than asserted once by hand.
- Fix the project-level IPHONEOS_DEPLOYMENT_TARGET, which was 26.2 while
all three targets are 17.6. It was shadowed everywhere today, but any
target added later would silently inherit it and drop iOS 17.6 support
with no error.
- Add a DomainDigUITests target running performAccessibilityAudit on the
six primary screens, plus a sweep of every root screen at
AccessibilityXXXL. Uses the existing DOMAIN_DIG_FORCE_PRO_PLUS debug
argument so Pro-gated screens are reachable.
- Findings are reported, not failed. The audit surfaces violations that
exist today, so gating on them would block unrelated PRs until the
whole pass lands. Enforcement is a committed constant,
AccessibilityAuditHarness.enforcedAuditTypes, widened per audit type as
each phase clears a category.
- CI now runs xcodebuild test across two simulators. Audit coverage is
not nested between OS versions: on Tracked Domains, iOS 18.6 reported 2
findings and iOS 27.0 reported 6 (including contrast and
element-detection issues 18.6 never raised), while at accessibility
text sizes the Dashboard produced a hit-region finding on 18.6 that
27.0 did not.
- Simulator selection is now dynamic and floor-aware. The previous
selector took the first iPhone from any runtime, which can resolve to a
simulator below the deployment target where the app cannot install.
Baseline on iOS 18.6: 15 findings across 7 tests — text clipping on every
screen, contrast on Inspect and Settings, and a hit-region failure on the
Dashboard at accessibility text sizes.
Diffstat (limited to 'DomainDigUITests/AccessibilityAuditTests.swift')
| -rw-r--r-- | DomainDigUITests/AccessibilityAuditTests.swift | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/DomainDigUITests/AccessibilityAuditTests.swift b/DomainDigUITests/AccessibilityAuditTests.swift new file mode 100644 index 0000000..63b3d02 --- /dev/null +++ b/DomainDigUITests/AccessibilityAuditTests.swift @@ -0,0 +1,84 @@ +import XCTest + +/// One accessibility audit per primary screen, plus a Dynamic Type sweep. +/// +/// See `AccessibilityAuditHarness` for why these report rather than fail by +/// default, and how to make them enforcing. +@MainActor +final class AccessibilityAuditTests: XCTestCase { + override func setUp() { + // Keep going after a failure so an enforced audit still collects and + // attaches every finding. With this off, XCTest aborts at the first + // reported issue and the burndown list is lost precisely when a category + // is being enforced. + continueAfterFailure = true + } + + // MARK: Per-screen audits + + func testInspectScreen() throws { + let app = AccessibilityAuditHarness.launch() + app.selectRootTab("Inspect") + try AccessibilityAuditHarness.audit(app, screen: "inspect", test: self) + } + + func testDashboardScreen() throws { + let app = AccessibilityAuditHarness.launch() + app.selectRootTab("Dashboard") + try AccessibilityAuditHarness.audit(app, screen: "dashboard", test: self) + } + + func testAuditScreen() throws { + let app = AccessibilityAuditHarness.launch() + app.selectRootTab("Audit") + try AccessibilityAuditHarness.audit(app, screen: "audit", test: self) + } + + func testHistoryScreen() throws { + let app = AccessibilityAuditHarness.launch() + app.selectRootTab("History") + try AccessibilityAuditHarness.audit(app, screen: "history", test: self) + } + + func testSettingsScreen() throws { + let app = AccessibilityAuditHarness.launch() + app.selectRootTab("Settings") + try AccessibilityAuditHarness.audit(app, screen: "settings", test: self) + } + + func testTrackedDomainsScreen() throws { + let app = AccessibilityAuditHarness.launch() + app.selectRootTab("Settings") + + let trackedDomains = app.buttons["Tracked Domains"] + XCTAssertTrue( + trackedDomains.waitForExistence(timeout: 5), + "Settings no longer offers a Tracked Domains row" + ) + trackedDomains.tap() + + try AccessibilityAuditHarness.audit(app, screen: "tracked-domains", test: self) + } + + // MARK: Dynamic Type + + /// Re-audits every root screen at the largest accessibility content size. + /// + /// This is where clipped text and fixed-height containers surface — the + /// `.accessibility5`-class failures that the fixed geometry in + /// `AppDensityMetrics` is expected to produce until phase 3 of #21 lands. + func testAllScreensAtLargestAccessibilitySize() throws { + let app = AccessibilityAuditHarness.launch( + contentSizeCategory: "UICTContentSizeCategoryAccessibilityXXXL" + ) + + for tab in ["Inspect", "Dashboard", "Audit", "History", "Settings"] { + app.selectRootTab(tab) + try AccessibilityAuditHarness.audit( + app, + screen: "\(tab.lowercased())-accessibilityXXXL", + test: self + ) + } + } +} |
