1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
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 {
try auditRootTab("Inspect")
}
func testDashboardScreen() throws {
try auditRootTab("Dashboard")
}
func testAuditScreen() throws {
try auditRootTab("Audit")
}
func testHistoryScreen() throws {
try auditRootTab("History")
}
func testSettingsScreen() throws {
try auditRootTab("Settings")
}
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()
let audited = try AccessibilityAuditHarness.audit(app, screen: "tracked-domains", test: self)
try XCTSkipUnless(audited, "Tracked Domains audit did not complete in time")
}
// 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.
///
/// Every screen is attempted even if an earlier one times out, so one slow
/// screen cannot silently drop the rest; the skip is reported at the end.
func testAllScreensAtLargestAccessibilitySize() throws {
let app = AccessibilityAuditHarness.launch(
contentSizeCategory: "UICTContentSizeCategoryAccessibilityXXXL"
)
var unaudited: [String] = []
for tab in ["Inspect", "Dashboard", "Audit", "History", "Settings"] {
app.selectRootTab(tab)
let screen = "\(tab.lowercased())-accessibilityXXXL"
if try !AccessibilityAuditHarness.audit(app, screen: screen, test: self) {
unaudited.append(tab)
}
}
try XCTSkipUnless(
unaudited.isEmpty,
"Audit did not complete in time for: \(unaudited.joined(separator: ", "))"
)
}
// MARK: Seeded audits — dense rows that never render on an empty simulator
/// Dashboard with a populated portfolio: summary tiles, quick filters,
/// activity/attention/expiry rows, and the grouped portfolio list.
func testSeededDashboard() throws {
let app = AccessibilityAuditHarness.launch(seeded: true)
app.selectRootTab("Dashboard")
let audited = try AccessibilityAuditHarness.audit(app, screen: "seeded-dashboard", test: self, reportOnly: true)
try XCTSkipUnless(audited, "Audit did not complete in time for seeded Dashboard")
}
/// The watchlist's dense rows (up to nine text elements each).
func testSeededTrackedDomains() throws {
let app = AccessibilityAuditHarness.launch(seeded: true)
app.selectRootTab("Settings")
let trackedDomains = app.buttons["Tracked Domains"]
XCTAssertTrue(trackedDomains.waitForExistence(timeout: 5))
trackedDomains.tap()
let audited = try AccessibilityAuditHarness.audit(app, screen: "seeded-tracked-domains", test: self, reportOnly: true)
try XCTSkipUnless(audited, "Audit did not complete in time for seeded Tracked Domains")
}
/// Batch result rows on the Inspect tab, including a failed lookup.
func testSeededBatchResults() throws {
let app = AccessibilityAuditHarness.launch(seeded: true)
app.selectRootTab("Inspect")
let audited = try AccessibilityAuditHarness.audit(app, screen: "seeded-batch", test: self, reportOnly: true)
try XCTSkipUnless(audited, "Audit did not complete in time for seeded batch results")
}
/// The seeded screens again at the largest accessibility size — the case the
/// deferred ViewThatFits work exists for.
func testSeededScreensAtLargestAccessibilitySize() throws {
let app = AccessibilityAuditHarness.launch(
contentSizeCategory: "UICTContentSizeCategoryAccessibilityXXXL",
seeded: true
)
var unaudited: [String] = []
app.selectRootTab("Dashboard")
if try !AccessibilityAuditHarness.audit(app, screen: "seeded-dashboard-accessibilityXXXL", test: self, reportOnly: true) {
unaudited.append("Dashboard")
}
app.selectRootTab("Inspect")
if try !AccessibilityAuditHarness.audit(app, screen: "seeded-batch-accessibilityXXXL", test: self, reportOnly: true) {
unaudited.append("Inspect batch")
}
app.selectRootTab("Settings")
let trackedDomains = app.buttons["Tracked Domains"]
if trackedDomains.waitForExistence(timeout: 5) {
trackedDomains.tap()
if try !AccessibilityAuditHarness.audit(app, screen: "seeded-tracked-domains-accessibilityXXXL", test: self, reportOnly: true) {
unaudited.append("Tracked Domains")
}
}
try XCTSkipUnless(
unaudited.isEmpty,
"Audit did not complete in time for: \(unaudited.joined(separator: ", "))"
)
}
// MARK: Helpers
private func auditRootTab(_ tab: String) throws {
let app = AccessibilityAuditHarness.launch()
app.selectRootTab(tab)
let audited = try AccessibilityAuditHarness.audit(app, screen: tab.lowercased(), test: self)
try XCTSkipUnless(audited, "Audit did not complete in time for \(tab)")
}
}
|