Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSmartCell committed Aug 8, 2023
1 parent b316aa7 commit 5ed6db3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import static com.alphawallet.app.util.Helper.click;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.CoreMatchers.allOf;
import static org.junit.Assert.fail;

import android.os.Build;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static com.alphawallet.app.util.Helper.clickListItem;
import static com.alphawallet.app.util.Helper.clickStaticListItem;

import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.CoreMatchers.allOf;

import androidx.test.espresso.action.ViewActions;
import androidx.test.espresso.contrib.RecyclerViewActions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import static androidx.test.espresso.matcher.ViewMatchers.withSubstring;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static com.alphawallet.app.util.Helper.waitUntil;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.core.IsInstanceOf.instanceOf;

import android.widget.TextView;
Expand Down
7 changes: 4 additions & 3 deletions app/src/androidTest/java/com/alphawallet/app/steps/Steps.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import static com.alphawallet.app.util.Helper.waitUntil;
import static com.alphawallet.app.util.Helper.waitUntilThenBack;
import static com.alphawallet.app.util.RootUtil.isDeviceRooted;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.core.StringStartsWith.startsWith;

import android.view.KeyEvent;
Expand Down Expand Up @@ -64,7 +64,8 @@
public class Steps
{
//public static final String GANACHE_URL = "http://10.0.2.2:8545/";
public static final String GANACHE_URL = "http://192.168.50.128:8545/";
//public static final String GANACHE_URL = "http://192.168.50.128:8545/";
public static final String GANACHE_URL = "http://192.168.50.206:8545/";

public static void createNewWallet()
{
Expand Down
10 changes: 4 additions & 6 deletions app/src/androidTest/java/com/alphawallet/app/util/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@
import androidx.test.espresso.util.TreeIterables;

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.CoreMatchers;

import java.util.concurrent.TimeoutException;
import com.alphawallet.app.R;
import com.walletconnect.android.Core;

import junit.framework.AssertionFailedError;

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

import java.util.concurrent.TimeoutException;

public class Helper
Expand Down Expand Up @@ -175,14 +173,14 @@ public void perform(final UiController uiController, final View view)

public static void click(Matcher<View> matcher, int timeoutInSeconds)
{
onView(isRoot()).perform(Helper.waitUntil(Matchers.allOf(matcher, isDisplayed()), timeoutInSeconds));
onView(isRoot()).perform(Helper.waitUntil(CoreMatchers.allOf(matcher, isDisplayed()), timeoutInSeconds));
onView(matcher).perform(ViewActions.click(doNothing())); // if click executed as long press, do nothing and retry clicking
}

public static void click(Matcher<View> matcher)
{
// Helper.wait(1); //slight pause
onView(isRoot()).perform(Helper.waitUntil(Matchers.allOf(matcher, isDisplayed())));
onView(isRoot()).perform(Helper.waitUntil(CoreMatchers.allOf(matcher, isDisplayed())));
onView(matcher).perform(ViewActions.click(doNothing())); // if click executed as long press, do nothing and retry clicking
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayingAtLeast;
import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;

import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.anyOf;

import android.graphics.Rect;
import android.view.View;
Expand Down

0 comments on commit 5ed6db3

Please sign in to comment.