Skip to content
Draft
Changes from all commits
Commits
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
23 changes: 9 additions & 14 deletions BitkitUITests/TrezorBridgeDashboardUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,23 @@ final class TrezorBridgeDashboardUITests: XCTestCase {
app.buttons["TrezorTestHook-Pin"].tap()
XCTAssertTrue(app.otherElements["TrezorPinSheet"].waitForExistence(timeout: 5))
app.buttons["TrezorPinCancel"].tap()
XCTAssertTrue(app.otherElements["TrezorPinSheet"].waitForNonExistence(timeout: 5))

app.buttons["TrezorTestHook-Passphrase"].tap()
XCTAssertTrue(app.otherElements["TrezorPassphraseSheet"].waitForExistence(timeout: 5))
app.buttons["TrezorPassphraseCancel"].tap()
XCTAssertTrue(app.otherElements["TrezorPassphraseSheet"].waitForNonExistence(timeout: 5))

app.buttons["TrezorTestHook-Pairing"].tap()
XCTAssertTrue(app.otherElements["TrezorPairingSheet"].waitForExistence(timeout: 5))
app.buttons["TrezorPairingCancel"].tap()
let pairingSheet = app.descendants(matching: .any)["HwPairSheet"]
XCTAssertTrue(pairingSheet.waitForExistence(timeout: 5))
pairingSheet.swipeDown(velocity: .fast)
XCTAssertTrue(pairingSheet.waitForNonExistence(timeout: 5))

app.buttons["TrezorTestHook-Confirm"].tap()
XCTAssertTrue(app.otherElements["TrezorConfirmOnDeviceOverlay"].waitForExistence(timeout: 5))
app.buttons["TrezorConfirmOnDeviceCancel"].tap()
XCTAssertTrue(app.otherElements["TrezorConfirmOnDeviceOverlay"].waitForNonExistence(timeout: 5))

app.buttons["TrezorDebugLogToggle"].tap()
XCTAssertTrue(app.buttons["TrezorDebugLogClear"].waitForExistence(timeout: 5))
Expand Down Expand Up @@ -434,10 +439,8 @@ final class TrezorBridgeDashboardUITests: XCTestCase {
XCTAssertTrue(element.waitForExistence(timeout: 10), "Missing text input \(element)")
scrollTo(element)
element.tap()
if let currentValue = element.value as? String, !currentValue.isEmpty {
element.press(forDuration: 1.0)
app.menuItems["Select All"].tapIfExists()
element.typeText(XCUIKeyboardKey.delete.rawValue)
if let currentValue = element.value as? String, !currentValue.isEmpty, currentValue != element.placeholderValue {
element.typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: currentValue.count))
}
element.typeText(text)
}
Expand Down Expand Up @@ -587,11 +590,3 @@ private final class RegtestRpcClient {
case rpc([String: Any])
}
}

private extension XCUIElement {
func tapIfExists() {
if waitForExistence(timeout: 2), isHittable {
tap()
}
}
}
Loading