Frage

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?

War es hilfreich?

Lösung

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.

Andere Tipps

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)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top