File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
WordPress/UITestsFoundation Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,16 @@ public func pullToRefresh(app: XCUIApplication = XCUIApplication()) {
31
31
top. press ( forDuration: 0.01 , thenDragTo: bottom)
32
32
}
33
33
34
- public func waitAndTap( _ element: XCUIElement ) {
34
+ public func waitAndTap( _ element: XCUIElement , maxRetries: Int = 10 , timeout: TimeInterval = 10 ) {
35
+ guard element. waitForIsHittable ( timeout: timeout) else {
36
+ XCTFail ( " Expected element ( \( element) ) was not hittable after \( timeout) seconds. " )
37
+ return
38
+ }
39
+
35
40
var retries = 0
36
- let maxRetries = 10
37
- if element. waitForIsHittable ( timeout: 10 ) {
38
- while element. isHittable && retries < maxRetries {
39
- element. tap ( )
40
- retries += 1
41
- }
41
+ while element. isHittable && retries < maxRetries {
42
+ element. tap ( )
43
+ retries += 1
42
44
}
43
45
}
44
46
You can’t perform that action at this time.
0 commit comments