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
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void testSelectTransferMethod_verifyCountrySelectionList() {
onView(allOf(instanceOf(TextView.class), withParent(withId(R.id.country_selection_toolbar)))).check(
matches(withText(R.string.mobileCountryRegion)));
onView(withId(R.id.search_button)).check(doesNotExist());
onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(5));
onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(6));
onView(allOf(withId(R.id.country_name), withText("Canada"))).check(matches(isDisplayed()));
onView(allOf(withId(R.id.country_name), withText("Croatia"))).check(matches(isDisplayed()));
onView(allOf(withId(R.id.country_name), withText("Mexico"))).check(matches(isDisplayed()));
Expand Down Expand Up @@ -207,21 +207,26 @@ public void testSelectTransferMethod_verifyTransferMethodsList() {
matches(atPosition(0, hasDescendant(withText(R.string.bank_account)))));

String bankCardFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "2.00", "1-2 Business days");
.getString(R.string.feeInformation, usdDollarSymbol + "2.00");
String bankCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "1-2 Business days");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText(bankCardFee)))));
matches(atPosition(0, hasDescendant(withText(bankCardFee+bankCardProcessingTime)))));

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText(R.string.bank_card_font_icon)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText(R.string.bank_card)))));

String debitCardFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "1.75", "IMMEDIATE");
.getString(R.string.feeInformation, usdDollarSymbol + "1.75");

String debitCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "IMMEDIATE");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText(debitCardFee)))));
matches(atPosition(1, hasDescendant(withText(debitCardFee+debitCardProcessingTime)))));


onView(withId(R.id.select_transfer_method_types_list)).check(
Expand All @@ -233,21 +238,25 @@ public void testSelectTransferMethod_verifyTransferMethodsList() {
matches(atPosition(2, hasDescendant(wireAccountViewMatchers))));

String wireTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "20.00", "1-3 Business days");
.getString(R.string.feeInformation, usdDollarSymbol + "20.00");
String wireTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "1-3 Business days");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(2, hasDescendant(withText(wireTransferFee)))));
matches(atPosition(2, hasDescendant(withText(wireTransferFee+wireTransferProcessingTime)))));

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(3, hasDescendant(withText(R.string.paypal_account_font_icon)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(3, hasDescendant(withText("PayPal")))));

String paypalFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.feeAndProcessingTimeInformation, usdDollarSymbol + "0.25", "IMMEDIATE");
.getString(R.string.feeInformation, usdDollarSymbol + "0.25");
String paypalProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "IMMEDIATE");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(3, hasDescendant(withText(paypalFee)))));
matches(atPosition(3, hasDescendant(withText(paypalFee+paypalProcessingTime)))));
}

@Test
Expand All @@ -268,7 +277,7 @@ public void testSelectTransferMethod_verifyTransferMethodsListEmptyFee() {
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText(R.string.bank_account)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText("1-2 Business days")))));
matches(atPosition(0, hasDescendant(withText("No fee \u2022 1-2 Business days")))));
}

@Test
Expand Down Expand Up @@ -318,21 +327,25 @@ public void testSelectTransferMethod_verifyTransferMethodsListUpdatedOnSelection
matches(atPosition(0, hasDescendant(withText(R.string.bank_account)))));

String bankAccountFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.feeAndProcessingTimeInformation, cdnDollarSymbol + "2.20", "1-2 Business days");
.getString(R.string.feeInformation, cdnDollarSymbol + "2.20");
String bankCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "1-2 Business days");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText(bankAccountFee)))));
matches(atPosition(0, hasDescendant(withText(bankAccountFee+bankCardProcessingTime)))));

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText(R.string.paypal_account_font_icon)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText("PayPal")))));

String paypalFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.feeAndProcessingTimeInformation, cdnDollarSymbol + "0.25", "IMMEDIATE");
.getString(R.string.feeInformation, cdnDollarSymbol + "0.25");
String paypalProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "IMMEDIATE");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText(paypalFee)))));
matches(atPosition(1, hasDescendant(withText(paypalFee+paypalProcessingTime)))));
}

@Test
Expand Down Expand Up @@ -445,4 +458,95 @@ public void testSelectTransferMethod_verifyDefaultsToUSWhenUserProfileDoesNotHav
onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD")));
}

@Test
public void testSelectTransferMethod_verifyNoFeeLabelsDisplayed() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("user_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.toolbar)).check(matches(isDisplayed()));
onView(withText(R.string.mobileAddTransferMethodHeader)).check(matches(withParent(withId(R.id.toolbar))));

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD")));
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(4));

onView(withId(R.id.select_transfer_method_country_value)).perform(click());
onView(allOf(withId(R.id.country_name), withText("CHINA"))).perform(click());

String bankAccountFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.noFee);
String bankAccountProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "1-2 Business days");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText(bankAccountFee+bankAccountProcessingTime)))));


String bankCardFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.noFee);
String bankCardProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "IMMEDIATE");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText(bankCardFee+bankCardProcessingTime)))));



String wireTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.noFee);
String wireTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "1-3 Business days");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(2, hasDescendant(withText(wireTransferFee+wireTransferProcessingTime)))));

String paypalTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.noFee);
String paypalTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "IMMEDIATE");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(3, hasDescendant(withText(paypalTransferFee+paypalTransferProcessingTime)))));


}

@Test
public void testSelectTransferMethod_verifyMixedFeeIsDisplayed() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("user_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_mixedfee_response.json")).mock();

mActivityTestRule.launchActivity(null);

onView(withId(R.id.toolbar)).check(matches(isDisplayed()));
onView(withText(R.string.mobileAddTransferMethodHeader)).check(matches(withParent(withId(R.id.toolbar))));

onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD")));
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(4));

onView(withId(R.id.select_transfer_method_country_value)).perform(click());
onView(allOf(withId(R.id.country_name), withText("CHINA"))).perform(click());

String mixedFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.fee_mix_formatter,usdDollarSymbol,"5.00","4.50","4.00","10.00");

String venmoTransferFee = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.feeInformation,mixedFee);

String venmoTransferProcessingTime = InstrumentationRegistry.getInstrumentation().getTargetContext()
.getString(R.string.processingTimeInformation, "1-2 Business days");

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(4, hasDescendant(withText(venmoTransferFee+venmoTransferProcessingTime)))));


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static com.hyperwallet.android.model.transfermethod.TransferMethod.TransferMethodTypes.WIRE_ACCOUNT;
import static com.hyperwallet.android.ui.common.intent.HyperwalletIntent.EXTRA_TRANSFER_METHOD_ADDED;
import static com.hyperwallet.android.ui.transfermethod.TransferMethodLocalBroadcast.TransferMethodLocalBroadcastAction.ACTION_HYPERWALLET_TRANSFER_METHOD_ADDED;
import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.getFormattedFeeAndProcessingTime;
import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isFeeAvailable;
import static com.hyperwallet.android.ui.transfermethod.view.FeeFormatter.isProcessingTimeAvailable;

Expand Down Expand Up @@ -408,22 +409,12 @@ public void showTransactionInformation(@NonNull final List<Fee> fees,
View container = getView().findViewById(R.id.add_transfer_method_static_container);
TextView feeAndProcessingTime = getView().findViewById(R.id.add_transfer_method_information);

if (isFeeAvailable(fees) && isProcessingTimeAvailable(processingTime)) {
String formattedFee = FeeFormatter.getFormattedFee(header.getContext(), fees);
feeAndProcessingTime.setVisibility(View.VISIBLE);
feeAndProcessingTime.setText(
feeAndProcessingTime.getContext().getString(R.string.feeAndProcessingTimeInformation, formattedFee,
processingTime.getValue()));
} else if (isFeeAvailable(fees) && !isProcessingTimeAvailable(processingTime)) {
String formattedFee = FeeFormatter.getFormattedFee(header.getContext(), fees);
if (!isFeeAvailable(fees) && !isProcessingTimeAvailable(processingTime)) {
feeAndProcessingTime.setVisibility(View.GONE);
} else {
feeAndProcessingTime.setVisibility(View.VISIBLE);
feeAndProcessingTime.setText(
feeAndProcessingTime.getContext().getString(R.string.feeInformation, formattedFee));
} else if (isProcessingTimeAvailable(processingTime) && !isFeeAvailable(fees)) {
feeAndProcessingTime.setVisibility(View.VISIBLE);
feeAndProcessingTime.setText(processingTime.getValue());
} else {
feeAndProcessingTime.setVisibility(View.GONE);
getFormattedFeeAndProcessingTime(feeAndProcessingTime.getContext(), fees, processingTime));
}

if (feeAndProcessingTime.getVisibility() == View.VISIBLE) {
Expand Down
Loading