litbe
litbe

Reputation: 507

XCUIElement.typeText() fails for iPhone 13 mini

Application's simplified logic:

struct Gigma30: View {
    @State private var clientName = ""
    var body: some View {
        TextField("Enter", text: $clientName)
            .accessibilityIdentifier("Username")
        
        ForEach (1...34, id: \.self) { number in
            Text("Payment \(number)")
        }
    } // body
} // Gigma30()

XCTest code:

func test_gigma30() throws {
        let app = XCUIApplication()
        app.launch()
        
        let fieldName = "Username"
        let field = app.textFields[fieldName] // testUtil.textFieldExist(app, "Username", true)
        app.scrollToElement(element: field)
        XCTAssertTrue(field.exists, "'\(fieldName)' does not exist|debug = \(app.debugDescription)")
        field.tap()
        field.typeText("User-1")
} // test_gigma30()

The above test fails with the following error:

Failed to scroll to visible (by AX action) TextField, {{0.0, 15.0}, {375.0, 24.0}}, identifier: 'Username', placeholderValue: 'Enter', error: Error kAXErrorCannotComplete performing AXAction kAXScrollToVisibleAction on element AX element pid: 49418, elementOrHash.elementID: 4312665600.16. (Underlying Error: Error kAXErrorCannotComplete performing AXAction kAXScrollToVisibleAction on element AX element pid: 49418, elementOrHash.elementID: 4312665600.16)

If I reduce the used space by changing the count in ForEach to 33 (from 34), the test succeeds. Also, the same original code succeeds with other version such as iPhone 16, 18.1.

Is this a known error with XCTest and iPhone 13 mini? Is there a workaround that allows the original code test to succeed?

Upvotes: 0

Views: 16

Answers (0)

Related Questions