I get this error from time to time in UI tests when they are run on CI. Any ideas what might be causing this error?
Post
Replies
Boosts
Views
Activity
We run our UI tests in parallel on 3 simulators, and I noticed, that the first one starts executing tests way faster then the rest (because others are still booting, I guess). Also we have our backend server running locally which is used in UI tests. And here comes the problem - I noticed that tests on first simulator are often failing because of the problems with local backend(requests take much more time than usual) exactly in period when other simulators are still booting(tests stop failing when all 3 simulators started running tests). When I tried running tests without parallel simulators problems with backend disappear. So my guess is that simulators booting they take some resources(CPU, memory) which interferes with backend. So my question is there some way to start executing tests only when all parallel simulators are booted?
I have some view which contents I want to interact with in UI test. In the first case, when view is added to view controller everything is fine - I can access all its contents. However, when the same view is added to table view cell, some of its content become unaccessible.
Here is view example
class SomeView: UIView {
required init?(coder: NSCoder) {
fatalError()
}
override init(frame: CGRect) {
super.init(frame: frame)
let label = UILabel(frame: .init(x: 5, y: 5, width: 100, height: 20))
label.text = "Label"
label.accessibilityIdentifier = "label"
addSubview(label)
let button = UIButton(frame: .init(x: 5, y: 35, width: 100, height: 20))
button.setTitle("Button", for: .normal)
button.accessibilityIdentifier = "button"
button.setTitleColor(.black, for: .normal)
addSubview(button)
let view = UIView(frame: .init(x: 5, y: 65, width: 100, height: 20))
view.backgroundColor = .red
view.accessibilityIdentifier = "container"
addSubview(view)
let view2 = UIView(frame: .init(x: 0, y: 0, width: 100, height: 20))
view2.backgroundColor = .red
view2.accessibilityIdentifier = "inner_view"
view.addSubview(view2)
let label2 = UILabel(frame: .init(x: 0, y: 0, width: 100, height: 20))
label2.text = "Label2"
label2.accessibilityIdentifier = "inner_label"
view2.addSubview(label2)
accessibilityIdentifier = "some_view"
}
}
And output from UI test
Attributes: Application, 0x7fb4b9d0e680, pid: 71041, label: 'UITest'
Element subtree:
→Application, 0x7fb4b9d0e680, pid: 71041, label: 'UITest'
Window (Main), 0x7fb4b9d0ae20, {{0.0, 0.0}, {390.0, 844.0}}
Other, 0x7fb4b9b08bc0, {{0.0, 0.0}, {390.0, 844.0}}
Other, 0x7fb4b9b0b040, {{0.0, 0.0}, {390.0, 844.0}}
Other, 0x7fb4b9b0ac80, {{0.0, 0.0}, {390.0, 844.0}}
Other, 0x7fb4b9b09960, {{0.0, 50.0}, {200.0, 100.0}}, identifier: 'some_view'
StaticText, 0x7fb4b9b0ec80, {{5.0, 55.0}, {100.0, 20.0}}, identifier: 'label', label: 'Label'
Button, 0x7fb4b9b10770, {{5.0, 85.0}, {100.0, 20.0}}, identifier: 'button', label: 'Button'
StaticText, 0x7fb4b9b0bbf0, {{28.0, 84.0}, {54.0, 22.0}}, label: 'Button'
Other, 0x7fb4b981b1d0, {{5.0, 115.0}, {100.0, 20.0}}, identifier: 'container'
Other, 0x7fb4b981b2e0, {{5.0, 115.0}, {100.0, 20.0}}, identifier: 'inner_view'
StaticText, 0x7fb4b981c0d0, {{5.0, 115.0}, {100.0, 20.0}}, identifier: 'inner_label', label: 'Label2'
Table, 0x7fb4b981c1e0, {{16.0, 343.0}, {361.0, 244.0}}
Cell, 0x7fb4b981c2f0, {{16.0, 343.0}, {361.0, 100.0}}
StaticText, 0x7fb4b981c420, {{21.0, 348.0}, {100.0, 20.0}}, identifier: 'label', label: 'Label'
StaticText, 0x7fb4b981c530, {{21.0, 408.0}, {100.0, 20.0}}, identifier: 'inner_label', label: 'Label2'
Button, 0x7fb4b981c640, {{21.0, 378.0}, {100.0, 20.0}}, identifier: 'button', label: 'Button'
StaticText, 0x7fb4b981c750, {{44.0, 377.0}, {54.0, 22.0}}, label: 'Button'
Other, 0x7fb4b981c860, {{16.0, 343.0}, {361.0, 100.0}}
Other, 0x7fb4b981c970, {{16.0, 343.0}, {361.0, 100.0}}
Other, 0x7fb4b9b05400, {{36.0, 442.7}, {341.0, 0.3}}
Path to element:
→Application, 0x7fb4b9d0e680, pid: 71041, label: 'UITest'
Query chain:
→Find: Target Application 'com.temp.temp.UITest'
Output: {
Application, 0x7fb4b981ce80, pid: 71041, label: 'UITest'
}
As you can see, in table view I am missing some_view, container and inner_view views. Is there a way to access these elements in table view?