mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Fix flakey app lock setup pin screen pin entry typing
This commit is contained in:
committed by
Stefan Ceriu
parent
e80b43f148
commit
ffbfdfa96e
@@ -62,6 +62,7 @@ enum A11yIdentifiers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct AppLockSetupPINScreen {
|
struct AppLockSetupPINScreen {
|
||||||
|
let textField = "app_lock_setup_pin-text_field"
|
||||||
let cancel = "app_lock_setup_pin-cancel"
|
let cancel = "app_lock_setup_pin-cancel"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ struct PINTextField: View {
|
|||||||
textField
|
textField
|
||||||
.textFieldStyle(PINTextFieldStyle(pinCode: pinCode, isSecure: isSecure))
|
.textFieldStyle(PINTextFieldStyle(pinCode: pinCode, isSecure: isSecure))
|
||||||
.keyboardType(.numberPad)
|
.keyboardType(.numberPad)
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.appLockSetupPINScreen.textField)
|
||||||
.onChange(of: pinCode) { newValue in
|
.onChange(of: pinCode) { newValue in
|
||||||
let sanitized = sanitize(newValue)
|
let sanitized = sanitize(newValue)
|
||||||
if sanitized != newValue {
|
if sanitized != newValue {
|
||||||
@@ -67,7 +68,8 @@ private struct PINTextFieldStyle: TextFieldStyle {
|
|||||||
.overlay {
|
.overlay {
|
||||||
configuration
|
configuration
|
||||||
.focused($isFocussed)
|
.focused($isFocussed)
|
||||||
.opacity(0.0)
|
// Textfield isn't accessible for UI tests otherwise
|
||||||
|
.opacity(0.01)
|
||||||
}
|
}
|
||||||
.onTapGesture { isFocussed = true }
|
.onTapGesture { isFocussed = true }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,16 +137,16 @@ class AppLockSetupUITests: XCTestCase {
|
|||||||
// MARK: - Helpers
|
// MARK: - Helpers
|
||||||
|
|
||||||
private func enterPIN() {
|
private func enterPIN() {
|
||||||
app.keys["2"].tap()
|
let textField = app.secureTextFields[A11yIdentifiers.appLockSetupPINScreen.textField]
|
||||||
app.keys["0"].tap()
|
XCTAssert(textField.waitForExistence(timeout: 10))
|
||||||
app.keys["2"].tap()
|
|
||||||
app.keys["3"].tap()
|
textField.clearAndTypeText("2023")
|
||||||
}
|
}
|
||||||
|
|
||||||
private func enterDifferentPIN() {
|
private func enterDifferentPIN() {
|
||||||
app.keys["2"].tap()
|
let textField = app.secureTextFields[A11yIdentifiers.appLockSetupPINScreen.textField]
|
||||||
app.keys["2"].tap()
|
XCTAssert(textField.waitForExistence(timeout: 10))
|
||||||
app.keys["3"].tap()
|
|
||||||
app.keys["3"].tap()
|
textField.clearAndTypeText("2233")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user