a native ios client for gitbay

client ios swift

https://gitbay.org

Commit 530c076c61

530c076c6119590a9e8a645bd58b75ba5b531ca4

parent: 4cb7a356bb

Verified · cmc

cmc <hello@cleberg.net> · 2026-08-27T14:30:15Z

ui tests: live smoke flows by accessibility, compose autocorrect off

gitbayUITests drives the flows the coordinate-based simulator input
could not be trusted to verify: milestone assignment, edit-sheet save,
MR create against a real branch, MR close through its confirmation
dialog. The suite writes to the live instance, so it is opt-in behind
TEST_RUNNER_GITBAY_UITEST_LIVE=1 and assumes a signed-in simulator.
Interactive controls carry accessibility identifiers.

Compose fields disable autocorrection: issue and MR text names code —
paths, branches, commands — and the keyboard rewrote krz/ to its/ in a
live body.

First pass of #5.

Ref #11
gitbay.xcodeproj/project.pbxproj +110
@@ -18,11 +18,19 @@
1818 remoteGlobalIDString = 8B289811303FF3E5001BF44A;
1919 remoteInfo = gitbay;
2020 };
21 8B2898C7303FF3E5001BF44A /* PBXContainerItemProxy */ = {
22 isa = PBXContainerItemProxy;
23 containerPortal = 8B28980A303FF3E5001BF44A /* Project object */;
24 proxyType = 1;
25 remoteGlobalIDString = 8B289811303FF3E5001BF44A;
26 remoteInfo = gitbay;
27 };
2128/* End PBXContainerItemProxy section */
2229
2330/* Begin PBXFileReference section */
2431 8B289812303FF3E5001BF44A /* gitbay.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = gitbay.app; sourceTree = BUILT_PRODUCTS_DIR; };
2532 8B2898A2303FF3E5001BF44A /* gitbayTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = gitbayTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
33 8B2898C2303FF3E5001BF44A /* gitbayUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = gitbayUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2634/* End PBXFileReference section */
2735
2836/* Begin PBXFileSystemSynchronizedRootGroup section */
@@ -36,6 +44,11 @@
3644 path = gitbayTests;
3745 sourceTree = "<group>";
3846 };
47 8B2898C0303FF3E5001BF44A /* gitbayUITests */ = {
48 isa = PBXFileSystemSynchronizedRootGroup;
49 path = gitbayUITests;
50 sourceTree = "<group>";
51 };
3952/* End PBXFileSystemSynchronizedRootGroup section */
4053
4154/* Begin PBXFrameworksBuildPhase section */
@@ -54,6 +67,13 @@
5467 );
5568 runOnlyForDeploymentPostprocessing = 0;
5669 };
70 8B2898C4303FF3E5001BF44A /* Frameworks */ = {
71 isa = PBXFrameworksBuildPhase;
72 buildActionMask = 2147483647;
73 files = (
74 );
75 runOnlyForDeploymentPostprocessing = 0;
76 };
5777/* End PBXFrameworksBuildPhase section */
5878
5979/* Begin PBXGroup section */
@@ -62,6 +82,7 @@
6282 children = (
6383 8B289814303FF3E5001BF44A /* gitbay */,
6484 8B2898A0303FF3E5001BF44A /* gitbayTests */,
85 8B2898C0303FF3E5001BF44A /* gitbayUITests */,
6586 8B289813303FF3E5001BF44A /* Products */,
6687 );
6788 sourceTree = "<group>";
@@ -71,6 +92,7 @@
7192 children = (
7293 8B289812303FF3E5001BF44A /* gitbay.app */,
7394 8B2898A2303FF3E5001BF44A /* gitbayTests.xctest */,
95 8B2898C2303FF3E5001BF44A /* gitbayUITests.xctest */,
7496 );
7597 name = Products;
7698 sourceTree = "<group>";
@@ -124,6 +146,29 @@
124146 productReference = 8B2898A2303FF3E5001BF44A /* gitbayTests.xctest */;
125147 productType = "com.apple.product-type.bundle.unit-test";
126148 };
149 8B2898C1303FF3E5001BF44A /* gitbayUITests */ = {
150 isa = PBXNativeTarget;
151 buildConfigurationList = 8B2898CA303FF3E5001BF44A /* Build configuration list for PBXNativeTarget "gitbayUITests" */;
152 buildPhases = (
153 8B2898C3303FF3E5001BF44A /* Sources */,
154 8B2898C4303FF3E5001BF44A /* Frameworks */,
155 8B2898C5303FF3E5001BF44A /* Resources */,
156 );
157 buildRules = (
158 );
159 dependencies = (
160 8B2898C6303FF3E5001BF44A /* PBXTargetDependency */,
161 );
162 fileSystemSynchronizedGroups = (
163 8B2898C0303FF3E5001BF44A /* gitbayUITests */,
164 );
165 name = gitbayUITests;
166 packageProductDependencies = (
167 );
168 productName = gitbayUITests;
169 productReference = 8B2898C2303FF3E5001BF44A /* gitbayUITests.xctest */;
170 productType = "com.apple.product-type.bundle.ui-testing";
171 };
127172/* End PBXNativeTarget section */
128173
129174/* Begin PBXProject section */
@@ -141,6 +186,10 @@
141186 CreatedOnToolsVersion = 26.6;
142187 TestTargetID = 8B289811303FF3E5001BF44A;
143188 };
189 8B2898C1303FF3E5001BF44A = {
190 CreatedOnToolsVersion = 26.6;
191 TestTargetID = 8B289811303FF3E5001BF44A;
192 };
144193 };
145194 };
146195 buildConfigurationList = 8B28980D303FF3E5001BF44A /* Build configuration list for PBXProject "gitbay" */;
@@ -162,6 +211,7 @@
162211 targets = (
163212 8B289811303FF3E5001BF44A /* gitbay */,
164213 8B2898A1303FF3E5001BF44A /* gitbayTests */,
214 8B2898C1303FF3E5001BF44A /* gitbayUITests */,
165215 );
166216 };
167217/* End PBXProject section */
@@ -181,6 +231,13 @@
181231 );
182232 runOnlyForDeploymentPostprocessing = 0;
183233 };
234 8B2898C5303FF3E5001BF44A /* Resources */ = {
235 isa = PBXResourcesBuildPhase;
236 buildActionMask = 2147483647;
237 files = (
238 );
239 runOnlyForDeploymentPostprocessing = 0;
240 };
184241/* End PBXResourcesBuildPhase section */
185242
186243/* Begin PBXSourcesBuildPhase section */
@@ -198,6 +255,13 @@
198255 );
199256 runOnlyForDeploymentPostprocessing = 0;
200257 };
258 8B2898C3303FF3E5001BF44A /* Sources */ = {
259 isa = PBXSourcesBuildPhase;
260 buildActionMask = 2147483647;
261 files = (
262 );
263 runOnlyForDeploymentPostprocessing = 0;
264 };
201265/* End PBXSourcesBuildPhase section */
202266
203267/* Begin PBXTargetDependency section */
@@ -206,6 +270,11 @@
206270 target = 8B289811303FF3E5001BF44A /* gitbay */;
207271 targetProxy = 8B2898A7303FF3E5001BF44A /* PBXContainerItemProxy */;
208272 };
273 8B2898C6303FF3E5001BF44A /* PBXTargetDependency */ = {
274 isa = PBXTargetDependency;
275 target = 8B289811303FF3E5001BF44A /* gitbay */;
276 targetProxy = 8B2898C7303FF3E5001BF44A /* PBXContainerItemProxy */;
277 };
209278/* End PBXTargetDependency section */
210279
211280/* Begin XCBuildConfiguration section */
@@ -434,6 +503,38 @@
434503 };
435504 name = Release;
436505 };
506 8B2898C8303FF3E5001BF44A /* Debug */ = {
507 isa = XCBuildConfiguration;
508 buildSettings = {
509 CURRENT_PROJECT_VERSION = 1;
510 DEVELOPMENT_TEAM = ZCNAX3VL9D;
511 GENERATE_INFOPLIST_FILE = YES;
512 MARKETING_VERSION = 1.0;
513 PRODUCT_BUNDLE_IDENTIFIER = org.gitbay.gitbayUITests;
514 PRODUCT_NAME = "$(TARGET_NAME)";
515 SWIFT_EMIT_LOC_STRINGS = NO;
516 SWIFT_VERSION = 6.0;
517 TARGETED_DEVICE_FAMILY = "1,2";
518 TEST_TARGET_NAME = gitbay;
519 };
520 name = Debug;
521 };
522 8B2898C9303FF3E5001BF44A /* Release */ = {
523 isa = XCBuildConfiguration;
524 buildSettings = {
525 CURRENT_PROJECT_VERSION = 1;
526 DEVELOPMENT_TEAM = ZCNAX3VL9D;
527 GENERATE_INFOPLIST_FILE = YES;
528 MARKETING_VERSION = 1.0;
529 PRODUCT_BUNDLE_IDENTIFIER = org.gitbay.gitbayUITests;
530 PRODUCT_NAME = "$(TARGET_NAME)";
531 SWIFT_EMIT_LOC_STRINGS = NO;
532 SWIFT_VERSION = 6.0;
533 TARGETED_DEVICE_FAMILY = "1,2";
534 TEST_TARGET_NAME = gitbay;
535 };
536 name = Release;
537 };
437538/* End XCBuildConfiguration section */
438539
439540/* Begin XCConfigurationList section */
@@ -464,6 +565,15 @@
464565 defaultConfigurationIsVisible = 0;
465566 defaultConfigurationName = Release;
466567 };
568 8B2898CA303FF3E5001BF44A /* Build configuration list for PBXNativeTarget "gitbayUITests" */ = {
569 isa = XCConfigurationList;
570 buildConfigurations = (
571 8B2898C8303FF3E5001BF44A /* Debug */,
572 8B2898C9303FF3E5001BF44A /* Release */,
573 );
574 defaultConfigurationIsVisible = 0;
575 defaultConfigurationName = Release;
576 };
467577/* End XCConfigurationList section */
468578
469579/* Begin XCRemoteSwiftPackageReference section */
gitbay/Views/Issues/IssueListView.swift +1
@@ -41,6 +41,7 @@ struct IssueListView: View {
4141 } label: {
4242 Image(systemName: "plus")
4343 }
44 .accessibilityIdentifier("issue-create-button")
4445 }
4546 }
4647 .sheet(isPresented: $composing) {
gitbay/Views/Issues/IssueView.swift +2
@@ -147,6 +147,7 @@ struct IssueView: View {
147147 }
148148 .disabled(model.working)
149149 .task { await model.loadMilestones() }
150 .accessibilityIdentifier("milestone-menu")
150151 }
151152 }
152153
@@ -232,6 +233,7 @@ struct IssueView: View {
232233 }
233234 }
234235 .disabled(model.working)
236 .accessibilityIdentifier("issue-actions-menu")
235237 }
236238 }
237239 }
gitbay/Views/MRs/MRListView.swift +8
@@ -39,6 +39,7 @@ struct MRListView: View {
3939 } label: {
4040 Image(systemName: "plus")
4141 }
42 .accessibilityIdentifier("mr-create-button")
4243 }
4344 }
4445 .sheet(isPresented: $composing) {
@@ -72,17 +73,23 @@ private struct MRCreateSheet: View {
7273 TextField("Source branch", text: $source)
7374 .autocorrectionDisabled()
7475 .textInputAutocapitalization(.never)
76 .accessibilityIdentifier("mr-source")
7577 TextField("Target branch", text: $target)
7678 .autocorrectionDisabled()
7779 .textInputAutocapitalization(.never)
80 .accessibilityIdentifier("mr-target")
7881 }
7982 Section("Title") {
8083 TextField("Title", text: $title, axis: .vertical)
8184 .lineLimit(1...3)
85 .autocorrectionDisabled()
86 .accessibilityIdentifier("mr-title")
8287 }
8388 Section("Body") {
8489 TextEditor(text: $bodyText)
8590 .frame(minHeight: 120)
91 .autocorrectionDisabled()
92 .accessibilityIdentifier("mr-body")
8693 }
8794 if let error = model.errorMessage {
8895 Section {
@@ -117,6 +124,7 @@ private struct MRCreateSheet: View {
117124 || target.trimmingCharacters(in: .whitespaces).isEmpty
118125 || title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
119126 )
127 .accessibilityIdentifier("mr-submit")
120128 }
121129 }
122130 }
gitbay/Views/MRs/MRView.swift +1
@@ -274,6 +274,7 @@ struct MRView: View {
274274 }
275275 }
276276 .disabled(model.working)
277 .accessibilityIdentifier("mr-actions-menu")
277278 }
278279 }
279280 }
gitbay/Views/Shared/ComposeSheet.swift +7
@@ -19,11 +19,17 @@ struct ComposeSheet: View {
1919 Section("Title") {
2020 TextField("Title", text: $title, axis: .vertical)
2121 .lineLimit(1...3)
22 // Titles name code: paths, commands, branch names.
23 // Autocorrection rewrites them.
24 .autocorrectionDisabled()
25 .accessibilityIdentifier("compose-title")
2226 }
2327 Section("Body") {
2428 TextEditor(text: $bodyText)
2529 .frame(minHeight: 160)
2630 .font(.body)
31 .autocorrectionDisabled()
32 .accessibilityIdentifier("compose-body")
2733 }
2834 if let errorMessage {
2935 Section {
@@ -45,6 +51,7 @@ struct ComposeSheet: View {
4551 } else {
4652 Button(submitLabel, action: onSubmit)
4753 .disabled(title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
54 .accessibilityIdentifier("compose-submit")
4855 }
4956 }
5057 }
gitbayUITests/LiveSmokeUITests.swift added +142
@@ -0,0 +1,142 @@
1import XCTest
2
3/// Live smoke flows against gitbay.org, driven by accessibility the
4/// coordinate-free verification the simulator's input pipeline cannot be
5/// trusted to do (krz/gitbay-ios#5).
6///
7/// These WRITE to the live instance (an MR is opened and closed, a
8/// milestone assigned), so they only run when explicitly asked:
9///
10/// TEST_RUNNER_GITBAY_UITEST_LIVE=1 xcodebuild test \
11/// -only-testing:gitbayUITests ...
12///
13/// They assume the simulator is already signed in as an account that can
14/// write to krz/gitbay-ios, and that branch `ui-smoke` exists.
15final class LiveSmokeUITests: XCTestCase {
16
17 private var app: XCUIApplication!
18
19 override func setUpWithError() throws {
20 try XCTSkipUnless(
21 ProcessInfo.processInfo.environment["GITBAY_UITEST_LIVE"] == "1",
22 "live UI smoke is opt-in; set TEST_RUNNER_GITBAY_UITEST_LIVE=1"
23 )
24 continueAfterFailure = false
25 app = XCUIApplication()
26 app.launch()
27 }
28
29 /// Everything in one ordered pass: milestone assign, edit-save,
30 /// MR create, MR close. One test so the flows share navigation and
31 /// the writes happen exactly once.
32 func testCreationAndEditingFlows() throws {
33 openRepo("krz/gitbay-ios")
34
35 // --- Issue #4: milestone picker assigns v1.0.0 ---
36 app.staticTexts["Issues"].firstMatch.tap()
37 let issueRow = app.staticTexts
38 .containing(NSPredicate(format: "label CONTAINS 'README.org'")).firstMatch
39 XCTAssertTrue(issueRow.waitForExistence(timeout: 10), "issue #4 not in the list")
40 issueRow.tap()
41
42 let milestoneMenu = app.descendants(matching: .any)
43 .matching(identifier: "milestone-menu").firstMatch
44 XCTAssertTrue(milestoneMenu.waitForExistence(timeout: 10))
45 milestoneMenu.tap()
46 let milestoneChoice = app.buttons
47 .containing(NSPredicate(format: "label BEGINSWITH 'v1.0.0'")).firstMatch
48 XCTAssertTrue(milestoneChoice.waitForExistence(timeout: 5), "milestone menu did not open")
49 milestoneChoice.tap()
50 // The reload renders the assigned milestone in the header row.
51 XCTAssertTrue(app.staticTexts["v1.0.0"].firstMatch
52 .waitForExistence(timeout: 10), "milestone not shown after assign")
53
54 // --- Issue #4: edit sheet saves (content unchanged) ---
55 app.descendants(matching: .any).matching(identifier: "issue-actions-menu")
56 .firstMatch.tap()
57 let edit = app.buttons["Edit"].firstMatch
58 XCTAssertTrue(edit.waitForExistence(timeout: 5))
59 edit.tap()
60 let title = app.descendants(matching: .any)
61 .matching(identifier: "compose-title").firstMatch
62 XCTAssertTrue(title.waitForExistence(timeout: 5), "edit sheet did not open")
63 XCTAssertTrue((title.value as? String)?.contains("README.org") == true,
64 "edit sheet did not prefill")
65 app.descendants(matching: .any).matching(identifier: "compose-submit")
66 .firstMatch.tap()
67 // Sheet dismissal proves the save round-tripped without error.
68 XCTAssertTrue(waitForDisappearance(title, timeout: 15), "edit save did not dismiss")
69
70 back() // to issues list
71 back() // to repo screen
72
73 // --- MR: create from ui-smoke, then close it ---
74 app.staticTexts["Merge Requests"].firstMatch.tap()
75 app.descendants(matching: .any).matching(identifier: "mr-create-button")
76 .firstMatch.tap()
77
78 let source = app.descendants(matching: .any)
79 .matching(identifier: "mr-source").firstMatch
80 XCTAssertTrue(source.waitForExistence(timeout: 5), "MR create sheet did not open")
81 source.tap()
82 source.typeText("ui-smoke")
83
84 let target = app.descendants(matching: .any)
85 .matching(identifier: "mr-target").firstMatch
86 // The default branch prefilled while the sheet loaded.
87 XCTAssertEqual(target.value as? String, "main", "target did not prefill")
88
89 let mrTitle = app.descendants(matching: .any)
90 .matching(identifier: "mr-title").firstMatch
91 mrTitle.tap()
92 mrTitle.typeText("UI smoke: mr create from the app")
93
94 app.descendants(matching: .any).matching(identifier: "mr-submit")
95 .firstMatch.tap()
96
97 let createdRow = app.staticTexts
98 .containing(NSPredicate(format: "label CONTAINS 'UI smoke'")).firstMatch
99 XCTAssertTrue(createdRow.waitForExistence(timeout: 15), "created MR not in the list")
100 createdRow.tap()
101
102 app.descendants(matching: .any).matching(identifier: "mr-actions-menu")
103 .firstMatch.tap()
104 let close = app.buttons["Close"].firstMatch
105 XCTAssertTrue(close.waitForExistence(timeout: 5))
106 close.tap()
107 // The confirmation dialog's destructive Close.
108 let confirm = app.buttons["Close"].firstMatch
109 XCTAssertTrue(confirm.waitForExistence(timeout: 5), "close confirmation missing")
110 confirm.tap()
111
112 XCTAssertTrue(app.staticTexts["closed"].firstMatch
113 .waitForExistence(timeout: 15), "MR did not show closed after close")
114 }
115
116 // MARK: - Helpers
117
118 private func openRepo(_ path: String) {
119 let tab = app.buttons["Repositories"].firstMatch
120 XCTAssertTrue(tab.waitForExistence(timeout: 10))
121 tab.tap()
122 let search = app.searchFields.firstMatch
123 XCTAssertTrue(search.waitForExistence(timeout: 10))
124 search.tap()
125 search.typeText(path)
126 let row = app.staticTexts[path].firstMatch
127 XCTAssertTrue(row.waitForExistence(timeout: 15), "\(path) not in the repo list")
128 row.tap()
129 // Repo screen is loaded once its links render.
130 XCTAssertTrue(app.staticTexts["Files"].firstMatch.waitForExistence(timeout: 10))
131 }
132
133 private func back() {
134 app.navigationBars.buttons.firstMatch.tap()
135 }
136
137 private func waitForDisappearance(_ element: XCUIElement, timeout: TimeInterval) -> Bool {
138 let predicate = NSPredicate(format: "exists == false")
139 let expectation = XCTNSPredicateExpectation(predicate: predicate, object: element)
140 return XCTWaiter().wait(for: [expectation], timeout: timeout) == .completed
141 }
142}