-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase RN-timers idling resources look-ahead to 1.5sec
- Loading branch information
Showing
4 changed files
with
111 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxViewActions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.wix.detox.espresso; | ||
|
||
import android.support.test.espresso.UiController; | ||
import android.support.test.espresso.ViewAction; | ||
import android.support.test.espresso.action.ViewActions; | ||
import android.view.View; | ||
|
||
import com.wix.detox.ReactNativeSupport; | ||
|
||
import org.hamcrest.Matcher; | ||
|
||
/** | ||
* An alternative to {@link ViewActions} - providing alternative implementations, where needed. | ||
*/ | ||
public class DetoxViewActions { | ||
private static class BusyViewActionWrapper implements ViewAction { | ||
private final ViewAction espressoViewAction; | ||
|
||
BusyViewActionWrapper(ViewAction clickAction) { | ||
this.espressoViewAction = clickAction; | ||
} | ||
|
||
@Override | ||
public Matcher<View> getConstraints() { | ||
return espressoViewAction.getConstraints(); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return espressoViewAction.getDescription(); | ||
} | ||
|
||
@Override | ||
public void perform(UiController uiController, View view) { | ||
ReactNativeSupport.pauseRNTimersIdlingResource(); | ||
espressoViewAction.perform(uiController, view); | ||
ReactNativeSupport.resumeRNTimersIdlingResource(); | ||
uiController.loopMainThreadUntilIdle(); | ||
} | ||
} | ||
|
||
public static ViewAction click() { | ||
final ViewAction clickAction = ViewActions.click(); | ||
return new BusyViewActionWrapper(clickAction); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters