无法从字段XCUITest删除文本

时间:2020-06-12 16:46:30

标签: swift ios13 xctest xcode-ui-testing xcuitest

我有一个看起来像这样的函数:

func clearText() {
        guard let stringValue = self.value as? String else {
            XCTFail("Tried to clear and enter text into a non string value")
            return
        }

        let deleteString: String = stringValue.map { _ in XCUIKeyboardKey.delete.rawValue }.joined(separator: "")
        self.typeText(deleteString)
    }

这将删除除出生日期字段以外的所有字段的当前焦点/点击字段上的文本。 我没有收到任何错误,但它不会删除文本。

这是在调试模式下发生的情况:

    t =    48.41s Tap TextField
    t =    48.41s     Wait for com.xxx to idle
    t =    48.43s     Find the TextField
    t =    48.57s     Check for interrupting elements affecting "01.01.1988" TextField
    t =    48.60s     Synthesize event
    t =    48.68s     Wait for com.xxx to idle
    t =    52.26s Find the "01.01.1988" TextField
    t =    76.21s Type '' into "01.01.1988" TextField
    t =    76.21s     Wait for com.xxx to idle
    t =    76.24s     Find the "01.01.1988" TextField
    t =    76.42s     Check for interrupting elements affecting "01.01.1988" TextField
    t =    76.46s     Synthesize event
    t =    76.66s     Wait for com.xxx to idle

应用程序/模拟器的屏幕截图。

enter image description here

有什么办法解决这个问题吗?

0 个答案:

没有答案