Skip to content

Commit 5f85ee0

Browse files
ampagenttmm
andcommitted
fix(zbugs-swift): issue numbers without separators, a badge that fits, and the picker the test taps
The navigation title formatted the issue number for the locale ("#3,000"). On an iPhone the connection badge shows only its dot. The UI test finds the filters' List picker by its label, which is its title and its value. Amp-Thread-ID: https://ampcode.com/threads/T-c513a037-a257-45e0-b9a9-15c15edfe859 Co-authored-by: tmm <tmm@tmm.dev>
1 parent 04de14f commit 5f85ee0

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

‎.github/workflows/zbugs-screenshots.yml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,14 @@ jobs:
7676
export TEST_RUNNER_ZBUGS_TOKEN
7777
device="$(xcrun simctl list devices available -j |
7878
python3 -c 'import json,sys; d=json.load(sys.stdin)["devices"]; print(next(x["udid"] for k,v in d.items() if "iOS" in k for x in v if x["name"].startswith("iPhone")))')"
79-
echo "DEVICE=$device" >> "$GITHUB_ENV"
8079
xcodebuild test -project ZBugs.xcodeproj -scheme ZBugsApp \
8180
-destination "id=$device" -resultBundlePath "$RUNNER_TEMP/screenshots.xcresult" \
8281
-skipPackagePluginValidation CODE_SIGNING_ALLOWED=NO
83-
# With the client's log (os.Logger, subsystem zero).
8482
- name: Export screenshots
8583
if: always()
8684
run: |
8785
xcrun xcresulttool export attachments \
8886
--path "$RUNNER_TEMP/screenshots.xcresult" --output-path "$RUNNER_TEMP/screenshots"
89-
xcrun simctl spawn "$DEVICE" log show --last 1h --info --style compact \
90-
--predicate 'subsystem == "zero"' > "$RUNNER_TEMP/screenshots/client.log" || true
9187
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
9288
if: always()
9389
with:

‎apps/zbugs-swift/App/UITests/ScreenshotTests.swift‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ final class ScreenshotTests: XCTestCase {
4949
if UIDevice.current.userInterfaceIdiom == .phone {
5050
back(app)
5151
}
52-
let listPicker = app.buttons["List"]
52+
// A menu picker's label is its title and its value.
53+
let listPicker = app.buttons.matching(NSPredicate(format: "label BEGINSWITH 'List,'")).firstMatch
5354
if expect(listPicker, "the filters' List picker") {
5455
settle()
5556
snapshot("4 Filters")

‎apps/zbugs-swift/Sources/ZBugsUI/IssueDetail.swift‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
.padding()
4646
.frame(maxWidth: 760, alignment: .leading)
4747
}
48-
.navigationTitle(issue.shortID.map { "Issue #\($0)" } ?? "Issue")
48+
// String(_:), or the title formats the number for the locale (3,000).
49+
.navigationTitle(issue.shortID.map { "Issue #" + String($0) } ?? "Issue")
4950
.toolbar {
5051
if canEdit {
5152
ToolbarItem {

‎apps/zbugs-swift/Sources/ZBugsUI/RootView.swift‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,21 @@
199199
case .connected: (.green, "Connected")
200200
case .connecting, .initializing: (.yellow, "Connecting")
201201
case .needsAuth: (.orange, "Log In Again")
202-
case .disconnected, .error, .closed: (.red, "Offline")
202+
case .disconnected, .closed: (.red, "Offline")
203+
case .error: (.red, "Error")
203204
}
204205
SwiftUI.Label {
205206
Text(text)
206207
} icon: {
207208
Image(systemName: "circle.fill").foregroundStyle(color)
208209
}
209-
.labelStyle(.titleAndIcon)
210+
#if os(iOS)
211+
// The text doesn't fit in an iPhone's navigation bar.
212+
.labelStyle(.iconOnly)
213+
.accessibilityLabel(text)
214+
#else
215+
.labelStyle(.titleAndIcon)
216+
#endif
210217
.font(.caption)
211218
.help(String(describing: connection.state))
212219
}

0 commit comments

Comments
 (0)