Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
03af8e2
test(swift-sdk): add wallet persistence UI tests + extract test helpers
llbartekll Apr 28, 2026
b3c85a2
test(swift-sdk): add testnet identity-discovery UI test
llbartekll Apr 28, 2026
7c0ae94
fix(swift-sdk): address PR #3560 review findings
llbartekll Apr 29, 2026
c08f9fa
fix(swift-sdk): address PR #3560 follow-up review
llbartekll Apr 29, 2026
52312a2
ci(swift-sdk): wire UI_TEST_MNEMONIC secret into smoke workflow
llbartekll Apr 29, 2026
e8eb123
ci(swift-sdk): run Swift Example App UI smoke nightly
llbartekll Apr 29, 2026
4e4cf1a
docs(swift-sdk): add UI test suite README
llbartekll Apr 29, 2026
296d966
fix(swift-sdk): address PR #3560 follow-up review (4e4cf1ad)
llbartekll Apr 29, 2026
3823ee4
Merge branch 'v3.1-dev' into claude/swift-xcuitest-wallet-persistence
QuantumExplorer May 1, 2026
33b6f3c
fix(swift-sdk): address PR #3560 follow-up review (3823ee4a)
llbartekll May 4, 2026
a228c04
Merge remote-tracking branch 'origin/v3.1-dev' into claude/swift-xcui…
llbartekll May 12, 2026
983f89c
fix(swift-sdk): address PR #3560 follow-up review
llbartekll May 12, 2026
4801f03
fix(swift-sdk): address PR #3560 follow-up review
llbartekll May 12, 2026
0e38b24
fix(swift-sdk): scrub stale Search Wallets selectors from runIdentity…
llbartekll May 12, 2026
92cddcd
savepoint
llbartekll May 12, 2026
8cfad23
fix(swift-sdk): tighten UI test helpers and network-status label
llbartekll May 18, 2026
be5f3fa
fix(swift-sdk): preserve identity balance sign through accessibility …
llbartekll May 18, 2026
a8ada7b
Merge remote-tracking branch 'origin/v3.1-dev' into claude/swift-xcui…
llbartekll May 18, 2026
d3503c8
fix(swift-sdk): scope discovery sheet's Done button to its nav bar
llbartekll May 19, 2026
2624335
fix(swift-sdk): build per-network SDK in activateManager to close sta…
llbartekll May 19, 2026
4fe6259
Merge remote-tracking branch 'origin/v3.1-dev' into claude/swift-xcui…
llbartekll May 19, 2026
19c4c49
Merge branch 'v3.1-dev' into claude/swift-xcuitest-wallet-persistence
QuantumExplorer Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/swift-example-app-ui-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ jobs:
-scheme SwiftExampleApp \
-destination "platform=iOS Simulator,id=$SIM_UDID" \
-only-testing:SwiftExampleAppUITests/SwiftExampleAppUITests/testCreateGeneratedWalletFlow \
-only-testing:SwiftExampleAppUITests/WalletPersistenceTests/testWalletPersistsAcrossRelaunch \
-only-testing:SwiftExampleAppUITests/WalletPersistenceTests/testWalletDeletionCleanupSurvivesRelaunch \
-parallel-testing-enabled NO \
-maximum-concurrent-test-simulator-destinations 1 \
-resultBundlePath "$RESULT_BUNDLE_PATH"
Comment thread
llbartekll marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ struct ContentView: View {

// Tab 3: Identities
IdentitiesTabView()
.accessibilityIdentifier("rootTab.identities")
.tabItem {
Label("Identities", systemImage: "person.crop.circle")
}
Expand All @@ -107,6 +108,7 @@ struct ContentView: View {

// Tab 5: Settings (includes Platform section)
SettingsView()
.accessibilityIdentifier("rootTab.settings")
.tabItem {
Label("Settings", systemImage: "gearshape")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct CreateWalletView: View {

Section {
Toggle("Import Existing Wallet", isOn: $showImportOption)
.accessibilityIdentifier("createWallet.importToggle")
} header: {
Text("Options")
}
Expand Down Expand Up @@ -164,6 +165,7 @@ struct CreateWalletView: View {
.autocorrectionDisabled()
.lineLimit(3...6)
.focused($focusedField, equals: .mnemonic)
.accessibilityIdentifier("createWallet.mnemonicField")
} header: {
Text("Recovery Phrase")
} footer: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ struct IdentitiesContentView: View {
} label: {
Label("Search Wallets for Identities", systemImage: "magnifyingglass")
}
.accessibilityIdentifier("identities.searchWalletsMenuItem")
} label: {
Image(systemName: "plus")
}
.accessibilityIdentifier("identities.addMenu")
}
}
.sheet(isPresented: $showingLoadIdentity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct IdentityRow: View {
}
.padding(.vertical, 4)
}
.accessibilityIdentifier("identities.row.\(identity.identityIdBase58)")
}

private func refreshBalance() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ struct IdentityDetailView: View {
Text(identity.formattedBalance)
.foregroundColor(.blue)
.fontWeight(.medium)
.accessibilityIdentifier("identityDetail.balanceLabel")
// Display string is "%.8f DASH" — rounding hides
// sub-1000-credit deltas. Expose the raw credit
// count via accessibilityValue for tests that
// need exact numbers.
.accessibilityValue("\(UInt64(bitPattern: identity.balance))")
Comment thread
llbartekll marked this conversation as resolved.
Outdated
Comment thread
llbartekll marked this conversation as resolved.
Outdated
}

// Top-up entry point. Hidden for purely-local rows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct OptionsView: View {
}
.pickerStyle(SegmentedPickerStyle())
.disabled(isSwitchingNetwork)
.accessibilityIdentifier("options.networkPicker")

if appState.currentNetwork == .regtest {
Toggle("Use Docker Setup", isOn: $appState.useDockerSetup)
Expand All @@ -84,23 +85,29 @@ struct OptionsView: View {
HStack {
Text("Network Status")
Spacer()
if isSwitchingNetwork {
HStack(spacing: 4) {
ProgressView()
.scaleEffect(0.8)
Text("Switching...")
Group {
if isSwitchingNetwork {
HStack(spacing: 4) {
ProgressView()
.scaleEffect(0.8)
Text("Switching...")
.font(.caption)
.foregroundColor(.secondary)
}
} else if appState.sdk != nil {
Label("Connected", systemImage: "checkmark.circle.fill")
.font(.caption)
.foregroundColor(.secondary)
.foregroundColor(.green)
} else {
Label("Disconnected", systemImage: "xmark.circle.fill")
.font(.caption)
.foregroundColor(.red)
}
} else if appState.sdk != nil {
Label("Connected", systemImage: "checkmark.circle.fill")
.font(.caption)
.foregroundColor(.green)
} else {
Label("Disconnected", systemImage: "xmark.circle.fill")
.font(.caption)
.foregroundColor(.red)
}
// Tests wait on this label transitioning to "Connected"
// after a network switch (signal-based, not sleep-based).
.accessibilityElement(children: .combine)
.accessibilityIdentifier("options.networkStatusLabel")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ struct SearchWalletsForIdentitiesView: View {
}
.pickerStyle(.menu)
.disabled(isSearching || hdWallets.count < 1)
.accessibilityIdentifier("searchWallets.walletPicker")
}
}
}
Expand All @@ -169,6 +170,7 @@ struct SearchWalletsForIdentitiesView: View {
Text("+\(finding.foundCount)")
.fontWeight(.semibold)
.foregroundColor(finding.foundCount > 0 ? .green : .secondary)
.accessibilityIdentifier("searchWallets.foundCountLabel")
}
if let err = finding.error {
// No `.lineLimit` — identity-derivation errors can
Expand Down Expand Up @@ -298,6 +300,7 @@ struct SearchWalletsForIdentitiesView: View {
|| selectedWalletId == nil
|| selectedManagedWallet == nil
)
.accessibilityIdentifier("searchWallets.searchButton")
if selectedWalletId != nil && selectedManagedWallet == nil {
Text("This wallet isn't loaded in the wallet manager yet. "
+ "Restore it from the Wallets tab and try again.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@ struct TransitionDetailView: View {
ForEach(identities, id: \.identityIdBase58) { identity in
Text(identity.displayName)
.tag(identity.identityIdBase58)
.accessibilityIdentifier("transition.senderIdentityOption.\(identity.identityIdBase58)")
}
}
.pickerStyle(MenuPickerStyle())
.padding()
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.gray.opacity(0.1))
.cornerRadius(8)
.accessibilityIdentifier("transition.senderIdentityPicker")
}
}
}
Expand All @@ -188,6 +190,7 @@ struct TransitionDetailView: View {
.foregroundColor(.white)
.cornerRadius(10)
.disabled(!enabled)
.accessibilityIdentifier("transition.executeButton")
}

private var resultView: some View {
Expand All @@ -197,6 +200,7 @@ struct TransitionDetailView: View {
.foregroundColor(isError ? .red : .green)
Text(isError ? "Error" : "Success")
.font(.headline)
.accessibilityIdentifier("transition.resultStatusLabel")
Spacer()
Button("Copy") {
UIPasteboard.general.string = resultText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ struct TransitionInputView: View {
}
}
.padding(.vertical, 4)
.accessibilityIdentifier("transition.input.\(input.name)")
}

@ViewBuilder
Expand Down Expand Up @@ -539,6 +540,7 @@ struct TransitionInputView: View {
.foregroundColor(.white)
.cornerRadius(8)
}
.accessibilityIdentifier("transition.input.\(input.name).manualEntryButton")
}
} else {
Picker("Select Identity", selection: $value) {
Expand All @@ -560,11 +562,13 @@ struct TransitionInputView: View {
useManualEntry = true
}
}
.accessibilityIdentifier("transition.input.\(input.name).recipientPicker")
}
} else {
VStack(alignment: .leading, spacing: 8) {
TextField("Enter recipient identity ID", text: $value)
.textFieldStyle(RoundedBorderTextFieldStyle())
.accessibilityIdentifier("transition.input.\(input.name).manualEntryField")

if !identities.isEmpty {
Button(action: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
//
// CreditTransferTest.swift
// SwiftExampleAppUITests
//
// Imports a wallet from a known testnet mnemonic that already has a
// registered identity, runs identity discovery, and asserts that the
// expected identity surfaces with a non-zero balance. The credit-
// transfer assertion is deferred to a follow-up.
Comment thread
llbartekll marked this conversation as resolved.
Outdated
//
// Skipped automatically when the env var is unset, so the rest of the
// suite can run locally without test-network credentials.
//
// Env var:
// * UI_TEST_TESTNET_MNEMONIC — sender wallet's 12-word phrase
//
// Note on env var forwarding: a previous run on this branch showed that
// `xcodebuild test ENV=...` did not propagate env vars to the XCUITest
// runner — only the prefix form `TEST_RUNNER_<NAME>` reached the test
Comment thread
llbartekll marked this conversation as resolved.
Comment thread
llbartekll marked this conversation as resolved.
// process (Xcode strips the prefix). Try the unprefixed form first; if
// the env var doesn't reach the test, use the prefixed form.
Comment thread
llbartekll marked this conversation as resolved.
//

import XCTest

final class CreditTransferTest: XCTestCase {
/// The pre-registered identity behind the sender mnemonic. Discovery
/// must surface this exact ID — that's the regression check on the
/// discovery path.
private let expectedSenderIdentityIdBase58 = "3ou98WEERy6ExmmHWYWsFtyhgW8rmr1giceZYTFqdAAA"

/// walletId derived from the test mnemonic (deterministic). Lets us
/// detect an already-imported wallet from a prior run and reuse it
/// instead of failing on `Wallet operation: Wallet already exists`.
private let expectedSenderWalletIdHex = "2450ec6b6dc2b1b0476875305a6870dee743d47474e3838642b655b68a600793"
Comment thread
llbartekll marked this conversation as resolved.

override func setUpWithError() throws {
continueAfterFailure = false
}

@MainActor
func testImportWalletAndDiscoverIdentity() throws {
guard let mnemonic = ProcessInfo.processInfo.environment["UI_TEST_TESTNET_MNEMONIC"],
!mnemonic.isEmpty
else {
throw XCTSkip("Set UI_TEST_TESTNET_MNEMONIC to run this test.")
}
XCTAssertEqual(
mnemonic.split(separator: " ").count,
12,
"UI_TEST_TESTNET_MNEMONIC must be a 12-word phrase."
)
Comment thread
llbartekll marked this conversation as resolved.
Comment on lines +70 to +74
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Nitpick: Carried-forward prior finding (STILL VALID): Mnemonic word-count check still splits on literal U+0020 only

Prior finding from review at 4fe6259 — STILL VALID at 19c4c49. The env var name moved to UI_TEST_MNEMONIC, but the validation still uses mnemonic.split(separator: " ").count == 12, which only splits on a literal U+0020. A future rotation that introduces a trailing newline, tab, or NBSP would either fail a valid phrase unexpectedly or pass an unsanitized string straight through to importWallet/typeText. Normalize with split(whereSeparator: { $0.isWhitespace }) before asserting and importing so a single canonical form reaches both the assertion and the type-into-field call.

Suggested change
XCTAssertEqual(
mnemonic.split(separator: " ").count,
12,
"UI_TEST_MNEMONIC must be a 12-word phrase."
)
let words = mnemonic.split(whereSeparator: { $0.isWhitespace }).map(String.init)
XCTAssertEqual(
words.count,
12,
"UI_TEST_MNEMONIC must be a 12-word phrase."
)
let normalizedMnemonic = words.joined(separator: " ")

source: ['claude']


let app = XCUIApplication()
app.launch()
failIfRecoveryPromptVisible(in: app, timeout: 2)

// Force testnet — the simulator may have been left on a non-testnet
// network by previous runs. Idempotent if already on Testnet.
switchAppNetworkToTestnet(in: app)
Comment thread
llbartekll marked this conversation as resolved.

openWalletsTab(in: app)

// Wallets restored from the persister on cold launch come back
// watch-only — the SwiftExampleApp comment in SwiftExampleAppApp.swift
// notes that biometric unlock to rehydrate signing keys is "future
// work". Identity discovery needs private keys, so a leftover
// wallet from a prior run is unusable. Delete it (if present) and
// re-import to get a hot, signing-capable wallet.
let existingRow = app.descendants(matching: .any)
.matching(identifier: "wallets.walletRow.\(expectedSenderWalletIdHex)")
.firstMatch
if existingRow.waitForExistence(timeout: 5) {
// accessibilityLabel == wallet.label, so .label gives us the name.
let staleName = existingRow.label
bestEffortDeleteWallet(named: staleName, in: app)
}
Comment thread
llbartekll marked this conversation as resolved.

let walletName = "ImportTransfer-\(UUID().uuidString.prefix(6))"
addTeardownBlock {
MainActor.assumeIsolated {
let cleanupApp = XCUIApplication()
cleanupApp.launch()
bestEffortDeleteWallet(named: walletName, in: cleanupApp)
cleanupApp.terminate()
}
}
importWallet(named: walletName, mnemonic: mnemonic, in: app)
assertWalletRowVisible(named: walletName, in: app, exists: true, timeout: 30)

openIdentitiesTab(in: app)
runIdentityDiscovery(forWalletNamed: walletName, in: app)

let senderRow = waitForIdentityRow(idBase58: expectedSenderIdentityIdBase58, in: app)
senderRow.tap()

let balance = readIdentityBalanceCredits(in: app)
XCTAssertGreaterThan(
balance,
0,
"Discovered identity should have a non-zero balance."
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}
}
Loading
Loading