My UI testing has started failing when testing 2 sliders on 1 view in my application (All the other work). It's not an error in my code causing the problem, the slider can be adjusted manualy, and the underlying code is tested too. This only started happening after a recent XCode update, (I think 1 or 2 releases ago). Before that the testing executed without error.
These 2 slider sit in 2 seperate uitableviewcells in a static UITableview, which I suspect to be the problem somehow. All the other sliders in the application are built straight into their views with no tableview.
The error is : failed: Failure fetching attributes for element <XCAccessibilityElement: 0x6100002402d0> Device element: Error Domain=XCTDaemonErrorDomain Code=13 "Value for attribute 5011 is an error." UserInfo={NSLocalizedDescription=Value for attribute 5011 is an error.}
The offending testing code is :
XCUIElementQuery *tablesQuery = app.tables;
->[tablesQuery.sliders[@"Mask threshold slider"] adjustToNormalizedSliderPosition:0.2];
If I set a breakpoint on the error line, I can go into lddb and see that indeed the slider can be found :
(lldb) po tablesQuery.sliders[@"Mask threshold slider"]
t = 31.84s Snapshot accessibility hierarchy for Serious-Cyrus.Reality-Augmenter-iOS
t = 32.21s Find: Descendants matching type Table
t = 32.21s Find: Descendants matching type Slider
t = 32.22s Find: Elements matching predicate '"Mask threshold slider" IN identifiers'
Attributes: Slider 0x60800017de80: traits: 8589938688, {{100.0, 424.5}, {254.0, 31.0}}, label: 'Mask threshold slider', value: 50%
Element subtree:
→Slider 0x60800017de80: traits: 8589938688, {{100.0, 424.5}, {254.0, 31.0}}, label: 'Mask threshold slider', value: 50%
Path to element:
→Application 0x600000176a40: {{0.0, 0.0}, {375.0, 667.0}}, label: 'Reality Augmenter iOS'
↳Window 0x618000361f80: Main Window, {{0.0, 0.0}, {375.0, 667.0}}
↳Other 0x618000362100: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
↳Other 0x618000362280: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
↳Other 0x618000362340: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
↳Other 0x6180003624c0: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
↳Other 0x60800017da00: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
↳Other 0x60800017d7c0: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
↳Table 0x600000175900: traits: 35192962023424, {{0.0, 64.0}, {375.0, 554.0}}
↳Cell 0x60000017a580: traits: 8589934592, {{0.0, 417.5}, {375.0, 44.0}}, label: 'Mask threshold cell'
↳Slider 0x60800017de80: traits: 8589938688, {{100.0, 424.5}, {254.0, 31.0}}, label: 'Mask threshold slider', value: 50%
Query chain:
→Find: Target Application 0x6100000b3320
Output: {
Application 0x600000176a40: {{0.0, 0.0}, {375.0, 667.0}}, label: 'Reality Augmenter iOS'
}
↪︎Find: Descendants matching type Table
Output: {
Table 0x600000175900: traits: 35192962023424, {{0.0, 64.0}, {375.0, 554.0}}
}
↪︎Find: Descendants matching type Slider
Output: {
Slider 0x60800017de80: traits: 8589938688, {{100.0, 424.5}, {254.0, 31.0}}, label: 'Mask threshold slider', value: 50%
Slider 0x618000362580: traits: 8589938688, {{100.0, 551.5}, {261.0, 31.0}}, label: 'Overlay opacity slider', value: 100%
}
↪︎Find: Elements matching predicate '"Mask threshold slider" IN identifiers'
Output: {
Slider 0x60800017de80: traits: 8589938688, {{100.0, 424.5}, {254.0, 31.0}}, label: 'Mask threshold slider', value: 50%
}
Like I said, this used to work, in previous versions of xcode. It's really frustrating as it's the only error left that I can't get rid of without turning off the test, which I don't feel I should have to do.