gpt4 book ai didi

ios - 用户界面测试 : Slider fails to adjust when nested in Table View Cell

转载 作者:可可西里 更新时间:2023-11-01 00:39:37 26 4
gpt4 key购买 nike

在 Xcode 9.0 (9A235) 上的 UI 测试中,当 UISlider 时,使用 adjust(toNormalizedSliderPosition:)UISlider 交互根本不起作用嵌套在 UITableViewCell 中。

我已经在许多不同的场景中进行了测试:- 未嵌入 UITableView 的普通 UISlider 可与 adjust 方法一起正常工作。- 与 UITableView 共存但不在 Table View Cell 中的 UISlider 继续与 adjust 配合使用- UITableView中的UISlider可以被唯一标识。- 在 UITableView 中标识的 UISlider 可以响应像 tap() 这样的简单事件- UITableView 中标识的 UISlider 根本无法与 adjust 方法一起使用,即使我将行数修改为 1。错误消息是:

Failure fetching attributes for element pid: 24415, elementOrHash.elementID: 106102876671744.43: Error Domain=XCTDaemonErrorDomain Code=13 "Fetching value for attribute 5011 returned AX error -25205." UserInfo={NSLocalizedDescription=Fetching value for attribute 5011 returned AX error -25205.}

我在网上找到的相关讨论: https://forums.developer.apple.com/thread/77445

我已经上传my code online如果有人有兴趣看的话。

我已经提交了 bug report就此向苹果公司。我要问的是,当 slider 嵌套在 UITableViewCell 中时,有人知道我可以用来调整 UISlider 值的可能解决方法吗?谢谢!

最佳答案

您可以使用此作为解决方法:

func testSliderAdjustsInTableView() {
let app = XCUIApplication()

app.staticTexts["Slider in Table View UI Test"].tap()

let cell = app.tables.element.cells["cell 0"]
let button = cell.buttons["Test Button"]
button.tap()

let slider = cell.sliders["value slider"]
XCTAssert(slider.exists)

let fiftyPercent = slider.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
let ninetyPercent = slider.coordinate(withNormalizedOffset: CGVector(dx: 0.9, dy: 0.5))

fiftyPercent.press(forDuration: 0.1, thenDragTo: ninetyPercent)

XCTAssertEqual(slider.value as! String, "90 %")
}

关于ios - 用户界面测试 : Slider fails to adjust when nested in Table View Cell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46785790/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com