Fran Sevillano
Fran Sevillano

Reputation: 8163

Double tap using KIF

How does one perform a double tap using KIF?

I've tried calling tapViewWithAccessibilityLabel: twice and also add a delay between the two calls, but nothing works. The test don't fail meaning KIF is able to perform the individual taps but I don't know how to get a double tap.

Any ideas?

Upvotes: 3

Views: 636

Answers (2)

krischu
krischu

Reputation: 229

If you don't want to specify the point at screen, you may use this approach

// Code sample in Swift 5.3
// access the view instance by identifier or label
let view = tester().waitForView(withAccessibilityIdentifier: "view-accessibility-identifier") 
view?.tap() // taps at center of the view
tester().wait(forTimeInterval: 0.1)
view?.tap()
tester().wait(forTimeInterval: 2)

Upvotes: 0

postmechanical
postmechanical

Reputation: 145

Try something like this:

[tester tapScreenAtPoint:CGPointMake(160.0, 284.0)];
[tester waitForTimeInterval:0.1];
[tester tapScreenAtPoint:CGPointMake(160.0, 284.0)];
[tester waitForTimeInterval:5.0];

The important parts are a short wait on the tester between taps and then a long wait on the tester after the taps in order for the gesture to be recognized and processed.

Upvotes: 5

Related Questions