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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import XCTest
extension OldFellaUITests {
func testAltTextUnavailableAndFailureKeepManualText() {
for mode in ["-ui-testing-alt-unavailable", "-ui-testing-alt-failure"] {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-compose-images", mode]
app.launch()
XCTAssertTrue(app.buttons["postText-post-1"].waitForExistence(timeout: 10))
app.tabBars.buttons["New post"].tap()
let attachment = app.buttons["editAltText-0"]
XCTAssertTrue(attachment.waitForExistence(timeout: 5))
attachment.tap()
XCTAssertTrue(app.navigationBars["Alt text editor"].waitForExistence(timeout: 5))
let editor = app.textViews["altTextEditor"]
XCTAssertTrue(editor.waitForExistence(timeout: 5))
if mode == "-ui-testing-alt-unavailable" {
XCTAssertFalse(app.buttons["generateAltText-0"].exists)
} else {
let generate = app.buttons["generateAltText-0"]
XCTAssertTrue(generate.waitForExistence(timeout: 5))
generate.tap()
XCTAssertTrue(app.navigationBars["Alt text editor"].exists)
let alert = app.alerts["Alt text unavailable"]
XCTAssertTrue(alert.waitForExistence(timeout: 5))
alert.buttons["OK"].tap()
XCTAssertTrue(app.navigationBars["Alt text editor"].exists)
}
XCTAssertEqual(editor.value as? String, "A photo")
app.navigationBars["Alt text editor"].buttons["Cancel"].tap()
app.buttons["publishButton"].tap()
XCTAssertTrue(app.alerts["Add alt text?"].waitForExistence(timeout: 5))
app.terminate()
}
}
func testMissingAltTextReminderAllowsEditingAndPosting() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-compose-images"]
app.launch()
XCTAssertTrue(app.buttons["postText-post-1"].waitForExistence(timeout: 10))
app.tabBars.buttons["New post"].tap()
XCTAssertTrue(app.scrollViews["imageAttachments"].waitForExistence(timeout: 5))
app.buttons["publishButton"].tap()
let alert = app.alerts["Add alt text?"]
XCTAssertTrue(alert.waitForExistence(timeout: 5))
alert.buttons["Keep editing"].tap()
XCTAssertTrue(app.textViews["composeTextField"].exists)
app.buttons["publishButton"].tap()
XCTAssertTrue(alert.waitForExistence(timeout: 5))
alert.buttons["Post without alt text"].tap()
XCTAssertTrue(app.navigationBars["Following"].waitForExistence(timeout: 10))
}
func testDisabledMissingAltTextReminderPostsDirectly() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-compose-images"]
app.launch()
XCTAssertTrue(app.buttons["postText-post-1"].waitForExistence(timeout: 10))
app.openSettings()
let toggle = app.switches["remindMissingAltText"]
XCTAssertTrue(toggle.waitForExistence(timeout: 5))
XCTAssertEqual(toggle.value as? String, "1")
toggle.coordinate(withNormalizedOffset: CGVector(dx: 0.95, dy: 0.5)).tap()
XCTAssertEqual(toggle.value as? String, "0")
app.closeSettings()
app.tabBars.buttons["New post"].tap()
XCTAssertTrue(app.scrollViews["imageAttachments"].waitForExistence(timeout: 5))
app.buttons["publishButton"].tap()
XCTAssertTrue(app.navigationBars["Following"].waitForExistence(timeout: 10))
XCTAssertFalse(app.alerts["Add alt text?"].exists)
}
func testLinkOnlyPostOmitsEmptyTextAndMediaSpace() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-link-only"]
app.launch()
let link = app.links["externalTextLink"].firstMatch
XCTAssertTrue(link.waitForExistence(timeout: 10))
XCTAssertFalse(app.buttons["postText-link-only"].exists)
XCTAssertFalse(app.staticTexts["postText-link-only"].exists)
let author = app.buttons["profileLink-mae"].firstMatch
XCTAssertTrue(author.exists)
XCTAssertGreaterThanOrEqual(link.frame.minY, author.frame.maxY)
XCTAssertLessThanOrEqual(link.frame.minY - author.frame.maxY, 20)
}
func testReplyContextNamesItsAuthorAndOpensItsPost() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-reply-attribution"]
app.launch()
app.openSettings()
let override = app.switches["filterReplies"]
XCTAssertTrue(override.waitForExistence(timeout: 5))
override.coordinate(withNormalizedOffset: CGVector(dx: 0.95, dy: 0.5)).tap()
app.closeSettings()
let reply = app.buttons.matching(NSPredicate(format: "label == %@", "Reply by Alex Kim")).firstMatch
XCTAssertTrue(reply.waitForExistence(timeout: 5))
XCTAssertFalse(
app.buttons.matching(NSPredicate(format: "label CONTAINS %@", "Replying to Mae Rivers")).firstMatch.exists)
reply.tap()
XCTAssertTrue(app.navigationBars["Post"].waitForExistence(timeout: 5))
XCTAssertTrue(app.buttons["postText-post-2"].exists)
}
func testThreadFilterSettingsPersistAndOverride() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in"]
app.launch()
app.openSettings()
let override = app.switches["filterReplies"]
XCTAssertTrue(override.waitForExistence(timeout: 5))
XCTAssertFalse(app.switches["filterThreadsByFollowing"].exists)
XCTAssertEqual(override.value as? String, "1")
override.coordinate(withNormalizedOffset: CGVector(dx: 0.95, dy: 0.5)).tap()
app.terminate()
app.launchArguments.append("-ui-testing-preserve-defaults")
app.launch()
app.openSettings()
XCTAssertTrue(override.waitForExistence(timeout: 5))
XCTAssertEqual(override.value as? String, "0")
XCTAssertFalse(app.switches["filterThreadsByFollowing"].exists)
override.coordinate(withNormalizedOffset: CGVector(dx: 0.95, dy: 0.5)).tap()
XCTAssertEqual(override.value as? String, "1")
}
func testSettingsShowsOpenSourceLicensesAndRepository() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in"]
app.launch()
app.openSettings()
let licenses = app.buttons["openSourceLicenses"]
XCTAssertTrue(licenses.waitForExistence(timeout: 5))
XCTAssertTrue(app.links["sourceRepository"].exists || app.buttons["sourceRepository"].exists)
licenses.tap()
XCTAssertTrue(app.navigationBars["Open Source Licenses"].waitForExistence(timeout: 5))
XCTAssertTrue(app.staticTexts["Old Fella"].exists)
XCTAssertTrue(app.staticTexts["ATProtoKit"].exists)
XCTAssertTrue(app.staticTexts["swift-log"].exists)
XCTAssertTrue(app.staticTexts["Copyright (c) 2026 Christopher Jr Riley"].exists)
}
func testAdultMediaCanBeHiddenAndShown() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-adult-media"]
app.launch()
let hide = app.buttons["hideMedia-post-1"]
let show = app.buttons["showMedia-post-1"]
XCTAssertTrue(hide.waitForExistence(timeout: 5))
hide.tap()
XCTAssertTrue(show.waitForExistence(timeout: 5))
show.tap()
XCTAssertTrue(hide.waitForExistence(timeout: 5))
}
func testQuotedAdultMediaWarningCanBeShownAndHidden() {
let app = XCUIApplication()
app.launchArguments = [
"-ui-testing", "-ui-testing-signed-in", "-ui-testing-adult-media", "-ui-testing-adult-warn"
]
app.launch()
app.tabBars.buttons["Notifications"].tap()
let show = app.buttons["showMedia-quote-post-1"].firstMatch
let hide = app.buttons["hideMedia-quote-post-1"].firstMatch
XCTAssertTrue(show.waitForExistence(timeout: 5))
show.tap()
XCTAssertTrue(hide.waitForExistence(timeout: 5))
hide.tap()
XCTAssertTrue(show.waitForExistence(timeout: 5))
}
func testAdultMediaProhibitedByPreferencesHasNoReveal() {
for setting in ["-ui-testing-adult-disabled", "-ui-testing-adult-hide"] {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-adult-media", setting]
app.launch()
XCTAssertTrue(app.buttons["postText-post-2"].waitForExistence(timeout: 5))
XCTAssertFalse(app.buttons["postText-post-1"].exists)
XCTAssertFalse(app.buttons["showMedia-post-1"].exists)
app.terminate()
}
}
func testMutedWordHidesMatchingPost() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-muted-word"]
app.launch()
app.buttons["demoSignInButton"].tap()
XCTAssertTrue(app.buttons["postText-post-2"].waitForExistence(timeout: 5))
XCTAssertFalse(app.buttons["postText-post-1"].exists)
}
func testTimelineHidesPostWithQuotedContentWarning() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-content-warnings"]
app.launch()
app.buttons["demoSignInButton"].tap()
XCTAssertTrue(app.buttons["postText-post-2"].waitForExistence(timeout: 5))
XCTAssertFalse(app.buttons["postText-post-1"].exists)
XCTAssertFalse(app.buttons["revealQuotedPost-warning-quote"].exists)
}
func testNotificationPostWarningRevealsContent() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-content-warnings", "-ui-testing-notification-warning"]
app.launch()
app.buttons["demoSignInButton"].tap()
app.tabBars.buttons["Notifications"].tap()
let reveal = app.buttons["revealQuotedPost-post-1"].firstMatch
XCTAssertTrue(reveal.waitForExistence(timeout: 5))
XCTAssertFalse(app.buttons["quotedPostText-post-1"].exists)
reveal.tap()
XCTAssertTrue(app.buttons["quotedPostText-post-1"].firstMatch.waitForExistence(timeout: 5))
}
}