Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog
=========
[1.0.0-beta13](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta13)
-------------------
* Handle HTTP 401

[1.0.0-beta12](https://github.com/hyperwallet/hyperwallet-android-ui-sdk/releases/tag/1.0.0-beta12)
-------------------
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ allprojects {

}

project.version = "1.0.0-beta12"
project.version = "1.0.0-beta13"

}

Expand All @@ -38,7 +38,7 @@ subprojects {
targetVersion = 30
codeVersion = 1

hyperwalletCoreVersion = '1.0.0-beta10'
hyperwalletCoreVersion = '1.0.0-beta12'
hyperwalletInsightVersion = '1.0.0-beta02'
//
androidMaterialVersion = '1.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static androidx.test.espresso.action.ViewActions.replaceText;
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.isDialog;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.isEnabled;
import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
Expand All @@ -21,6 +22,7 @@
import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
import static java.net.HttpURLConnection.HTTP_CREATED;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
import static java.util.concurrent.TimeUnit.SECONDS;

import static com.hyperwallet.android.model.transfermethod.BankAccount.Purpose.SAVINGS;
Expand Down Expand Up @@ -429,6 +431,25 @@ public void testAddTransferMethod_displaysErrorOnInvalidRoutingNumber() {
+ "branch of your bank.")));
}

@Test
public void testAddTransferMethod_displaysErrorOnUnauthorizedOnRestRequest() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_UNAUTHORIZED).withBody(sResourceManager
.getResourceContent("error_jwt_token_revoked.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.branchId)).perform(nestedScrollTo(), replaceText(INVALID_ROUTING_NUMBER));
onView(withId(R.id.bankAccountId)).perform(nestedScrollTo(), replaceText(ACCOUNT_NUMBER));
onView(withId(R.id.bankAccountPurpose)).perform(nestedScrollTo(), click());
onView(allOf(withId(R.id.select_name), withText("Checking"))).perform(click());

onView(withId(R.id.add_transfer_method_button)).perform(nestedScrollTo(), click());

onView(withText(R.string.authentication_error_header))
.inRoot(isDialog())
.check(matches(isDisplayed()));
}

@Test
public void testAddTransferMethod_verifyFieldFormatting() throws Exception {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_CREATED).withBody(sResourceManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.replaceText;
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.isDialog;
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
import static androidx.test.espresso.matcher.ViewMatchers.hasSibling;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
Expand All @@ -17,10 +19,12 @@

import static java.net.HttpURLConnection.HTTP_NO_CONTENT;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
import static java.util.concurrent.TimeUnit.SECONDS;

import static com.hyperwallet.android.model.StatusTransition.StatusDefinition.DE_ACTIVATED;
import static com.hyperwallet.android.ui.testutils.util.EspressoUtils.atPosition;
import static com.hyperwallet.android.ui.testutils.util.EspressoUtils.nestedScrollTo;
import static com.hyperwallet.android.ui.testutils.util.EspressoUtils.withDrawable;

import android.content.BroadcastReceiver;
Expand Down Expand Up @@ -195,6 +199,20 @@ public void testListTransferMethod_userHasSingleTransferMethod() {

}

@Test
public void testListTransferMethod_displaysErrorOnUnauthorizedOnGraphQLRequest() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_UNAUTHORIZED).withBody(sResourceManager
.getResourceContent("error_jwt_token_revoked.json")).mock();

// run test
mActivityTestRule.launchActivity(null);

// assert
onView(withText(R.string.authentication_error_header))
.inRoot(isDialog())
.check(matches(isDisplayed()));
}

@Test
public void testListTransferMethod_userHasNoTransferMethods() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_NO_CONTENT).withBody("").mock();
Expand All @@ -213,6 +231,7 @@ public void testListTransferMethod_userHasNoTransferMethods() {

}


@Test
public void testListTransferMethod_removeBankAccount() throws InterruptedException {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"errors":[
{
"message":"JWT expired",
"code":"JWT_EXPIRED"
}
]
}