Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bbf223c
initial gql integration code compilation and test passed state
May 6, 2019
b6ebf34
fixed fee integration
May 6, 2019
aa9d31f
added initial grouping
May 10, 2019
6b8d0a8
Merge remote-tracking branch 'remotes/origin/feature/HW-52169-gql-ver…
May 13, 2019
2ab68d2
added section header title information
May 13, 2019
d3b30d4
added search capability
May 13, 2019
9713c72
Support editability enabled / disabled
May 14, 2019
174df11
Merge remote-tracking branch 'remotes/origin/feature/HW-52169-gql-ver…
May 15, 2019
16d8031
enabled visibility
May 15, 2019
d0f5f64
Merge remote-tracking branch 'remotes/origin/task/HW-52170-key-and-fi…
May 15, 2019
92cff51
improved style sequencing
May 15, 2019
693dc5b
improved getting the context resource
May 16, 2019
36a1199
added pr fix
May 17, 2019
59b5c86
added pr fix
May 17, 2019
ce488ac
simplified
May 17, 2019
a22661a
HW-50743 External Account Profile Information (#20)
May 17, 2019
4e4a050
HW-51715 pre-set values profile (#21)
May 17, 2019
4b063e6
Merge remote-tracking branch 'remotes/origin/task/HW-52170-key-and-fi…
May 17, 2019
4281381
update ids and add default selection
May 17, 2019
4e5183c
fixed country labels using gql response
May 17, 2019
45c1660
selection value is not persisted fix
May 17, 2019
e9ee5cd
Updating gql responses
skoong May 18, 2019
2e8f30b
fix on naming and code cleanup
May 21, 2019
ebd16d6
Merge branches 'feature/HW-52575-updating-ui-tests' and 'task/HW-5204…
skoong May 21, 2019
e3c04fa
Adding tests for editablitity and default values
skoong May 21, 2019
45e6300
Merge branches 'epic/HW-52169-gql-version-two-integration' and 'featu…
skoong May 21, 2019
be3e29b
Adding id and reorganizing
skoong May 21, 2019
638655c
Code review comments, adding check for label display
skoong May 22, 2019
96943bb
Adding additional ids
skoong May 22, 2019
bf3e9ee
Minor edit
skoong May 22, 2019
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 @@ -124,7 +124,7 @@ public void testAddTransferMethod_accountDetailsHiddenOnEmptyFeeAndProcessingRes
@Test
public void testAddTransferMethod_displaysErrorDialogOnDuplicateAccountFailure() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_BAD_REQUEST).withBody(sResourceManager
.getResourceContent("bank_account_duplicate_routing_response.json")).mock();

Expand Down Expand Up @@ -159,7 +159,7 @@ public void testAddTransferMethod_displaysErrorDialogOnDuplicateAccountFailure()
@Test
public void testAddTransferMethod_displaysUnexpectedErrorDialogOnException() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_BAD_REQUEST).withBody(sResourceManager
.getResourceContent("invalid_json_response.json")).mock();

Expand Down Expand Up @@ -189,7 +189,7 @@ public void testAddTransferMethod_displaysUnexpectedErrorDialogOnException() {
@Test
public void testAddTransferMethod_displaysNetworkErrorDialogOnConnectionTimeout() throws IOException {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();

mActivityTestRule.launchActivity(null);

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
Expand Down Expand Up @@ -35,6 +36,7 @@
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.espresso.IdlingRegistry;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;

Expand Down Expand Up @@ -98,7 +100,7 @@ public void setup() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("authentication_token_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_bank_card_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_card_response.json")).mock();
}

@After
Expand All @@ -124,12 +126,14 @@ public void testAddTransferMethod_displaysElementsOnTmcResponse() {
matches(withText(R.string.title_add_bank_card)));

onView(withId(R.id.cardNumber)).check(matches(isDisplayed()));
onView(withId(R.id.cardNumberLabel)).check(matches(isDisplayed()));
onView(withId(R.id.cardNumberLabel)).check(matches(withHint(CARD_NUMBER_LABEL)));
onView(withId(R.id.dateOfExpiry)).check(matches(isDisplayed()));
onView(withId(R.id.dateOfExpiryLabel)).check(matches(isDisplayed()));
onView(withId(R.id.dateOfExpiryLabel)).check(matches(withHint(EXPIRY_DATE_LABEL)));
onView(withId(R.id.cvv)).check(matches(isDisplayed()));
onView(withId(R.id.cvvLabel)).check(
matches(withHint(CVV_LABEL)));
onView(withId(R.id.cvvLabel)).check(matches(isDisplayed()));
onView(withId(R.id.cvvLabel)).check(matches(withHint(CVV_LABEL)));

onView(withId(R.id.add_transfer_method_button)).perform(nestedScrollTo()).check(
matches(withText(R.string.button_create_transfer_method)));
Expand All @@ -139,11 +143,21 @@ public void testAddTransferMethod_displaysElementsOnTmcResponse() {
public void testAddTransferMethod_displaysFeeElementsOnTmcResponse() {
mActivityTestRule.launchActivity(null);

onView(withId(R.id.add_transfer_method_static_container)).check(
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));

onView(withId(R.id.add_transfer_method_fee_label)).check(
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
onView(withId(R.id.add_transfer_method_fee_label)).check(
matches(withText(R.string.add_transfer_method_fee_label)));
onView(withId(R.id.add_transfer_method_processing_label)).check(
matches(withText(R.string.add_transfer_method_processing_time_label)));
onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("USD 1.75")));

//TODO: Uncomment when processing time node is implemented
// onView(withId(R.id.add_transfer_method_processing_label)).check(
// matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
// onView(withId(R.id.add_transfer_method_processing_label)).check(
// matches(withText(R.string.add_transfer_method_processing_time_label)));
// onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("1 - 2 Business Days")));
}

@Test
Expand Down Expand Up @@ -211,11 +225,11 @@ public void testAddTransferMethod_returnsErrorOnInvalidPresence() {
onView(withId(R.id.add_transfer_method_button)).perform(nestedScrollTo(), click());

onView(withId(R.id.cardNumberLabel))
.check(matches(hasErrorText("You must provide a value for this field.")));
.check(matches(hasErrorText("You must provide a value for this field")));
onView(withId(R.id.dateOfExpiryLabel))
.check(matches(hasErrorText("You must provide a value for this field.")));
.check(matches(hasErrorText("You must provide a value for this field")));
onView(withId(R.id.cvvLabel))
.check(matches(hasErrorText("You must provide a value for this field.")));
.check(matches(hasErrorText("You must provide a value for this field")));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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.withEffectiveVisibility;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
Expand Down Expand Up @@ -37,6 +38,7 @@
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.espresso.IdlingRegistry;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;

Expand Down Expand Up @@ -88,7 +90,7 @@ public void setup() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("authentication_token_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_paypal_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_paypal_response.json")).mock();
}

@After
Expand All @@ -114,6 +116,7 @@ public void testAddTransferMethod_displaysElementsOnTmcResponse() {
matches(withText(R.string.paypal_account)));

onView(withId(R.id.email)).check(matches(isDisplayed()));
onView(withId(R.id.emailLabel)).check(matches(isDisplayed()));
onView(withId(R.id.emailLabel)).check(matches(withHint("Email")));

onView(withId(R.id.add_transfer_method_button)).perform(nestedScrollTo()).check(
Expand All @@ -124,12 +127,22 @@ public void testAddTransferMethod_displaysElementsOnTmcResponse() {
public void testAddTransferMethod_displaysFeeElementsOnTmcResponse() {
mActivityTestRule.launchActivity(null);

onView(withId(R.id.add_transfer_method_static_container)).check(
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));

onView(withId(R.id.add_transfer_method_fee_label)).check(
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
onView(withId(R.id.add_transfer_method_fee_label)).check(
matches(withText(R.string.add_transfer_method_fee_label)));
onView(withId(R.id.add_transfer_method_processing_label)).check(
matches(withText(R.string.add_transfer_method_processing_time_label)));
onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("USD 0.25")));
onView(withId(R.id.add_transfer_method_processing_time_value)).check(matches(withText("IMMEDIATE")));

//TODO: Uncomment when processing time node is implemented
// onView(withId(R.id.add_transfer_method_processing_label)).check(
// matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
// onView(withId(R.id.add_transfer_method_processing_label)).check(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be a good idea adding a "todo" here as it's done in BankAccountTest.java. Also in BankCardTest.java (same test case, testAddTransferMethod_displaysFeeElementsOnTmcResponse) I don't see any changes. Is that test going to fail too, correct? If not I think we missed something there

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated. If a view is has visibility GONE, the value can still be checked and the test will not fail. Added an additional matcher for visibility.

// matches(withText(R.string.add_transfer_method_processing_time_label)));
// onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("IMMEDIATE")));

}

@Test
Expand Down Expand Up @@ -178,7 +191,7 @@ public void testAddTransferMethod_returnsErrorOnInvalidPattern() {
onView(withId(R.id.add_transfer_method_button)).perform(nestedScrollTo(), click());

onView(withId(R.id.emailLabel))
.check(matches(hasErrorText("accountNumber is invalid")));
.check(matches(hasErrorText("is invalid length or format.")));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ public void testSelectTransferMethod_verifyCountrySelectionList() {
onView(allOf(instanceOf(TextView.class), withParent(withId(R.id.country_selection_toolbar)))).check(
matches(withText(R.string.select_transfer_method_country)));
onView(withId(R.id.search_button)).check(doesNotExist());
onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(2));
onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(5));
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()));
onView(allOf(withId(R.id.country_name), withText("United Kingdom"))).check(matches(isDisplayed()));
onView(allOf(withId(R.id.country_name), withText("United States"))).check(matches(isDisplayed()));

onView(allOf(withId(R.id.country_item_selected_image),
hasSibling(allOf(withId(R.id.country_name), withText("United States"))))).check(matches(isDisplayed()));

Expand Down Expand Up @@ -185,11 +189,12 @@ public void testSelectTransferMethod_verifyCurrencySelectionList() {
matches(withText(R.string.select_transfer_method_currency)));
onView(withId(R.id.search_button)).check(doesNotExist());
onView(withId(R.id.currency_selection_list)).check(new RecyclerViewCountAssertion(1));
onView(allOf(withId(R.id.currency_name), withText("US Dollar"))).check(matches(isDisplayed()));
onView(allOf(withId(R.id.currency_name), withText("United States Dollar"))).check(matches(isDisplayed()));
onView(allOf(withId(R.id.currency_item_selected_image),
hasSibling(allOf(withId(R.id.currency_name), withText("US Dollar"))))).check(matches(isDisplayed()));
hasSibling(allOf(withId(R.id.currency_name), withText("United States Dollar"))))).check(
matches(isDisplayed()));

onView(allOf(withId(R.id.currency_name), withText("US Dollar"))).perform(click());
onView(allOf(withId(R.id.currency_name), withText("United States Dollar"))).perform(click());
onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD")));
}

Expand All @@ -204,7 +209,7 @@ public void testSelectTransferMethod_verifyTransferMethodsList() {

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(2));
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(4));

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText(R.string.bank_account_font_icon)))));
Expand All @@ -222,6 +227,24 @@ public void testSelectTransferMethod_verifyTransferMethodsList() {
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText("Transaction Fee: USD 1.75")))));

onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(2, hasDescendant(withText(R.string.wire_account_font_icon)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(2, hasDescendant(withText(R.string.wire_account)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(2, hasDescendant(withText("Transaction Fee: USD 20.00")))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(2, hasDescendant(withText("Processing Time: 1-3 Business days")))));

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(R.string.paypal_account)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(3, hasDescendant(withText("Transaction Fee: USD 0.25")))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(3, hasDescendant(withText("Processing Time: IMMEDIATE")))));

}

@Test
Expand Down Expand Up @@ -283,20 +306,29 @@ public void testSelectTransferMethod_verifyTransferMethodsListUpdatedOnSelection

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(2));
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("Canada"))).perform(click());

onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(1));
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(2));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText(R.string.bank_account_font_icon)))));
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("Transaction Fee: USD 2.00")))));
matches(atPosition(0, hasDescendant(withText("Transaction Fee: CAD 2.20")))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText("Processing Time: 1-2 Business days")))));

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(R.string.paypal_account)))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(1, hasDescendant(withText("Transaction Fee: CAD 0.25")))));
onView(withId(R.id.select_transfer_method_types_list)).check(
matches(atPosition(0, hasDescendant(withText("Processing Time: 1-3 Business days")))));
matches(atPosition(1, hasDescendant(withText("Processing Time: IMMEDIATE")))));

}

Expand All @@ -307,7 +339,7 @@ public void testSelectTransferMethod_verifyIntentIndividualUser() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();

mIntentsTestRule.launchActivity(null);

Expand All @@ -326,7 +358,7 @@ public void testSelectTransferMethod_verifyIntentBusinessUser() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();

mIntentsTestRule.launchActivity(null);

Expand All @@ -345,7 +377,7 @@ public void testSelectTransferMethod_clickBankAccountOpensAddTransferMethodUi()
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();

mActivityTestRule.launchActivity(null);

Expand All @@ -362,7 +394,7 @@ public void testSelectTransferMethod_clickBankCardOpensAddTransferMethodUi() {
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_keys_response.json")).mock();
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
.getResourceContent("successful_tmc_bank_card_fields_response.json")).mock();
.getResourceContent("successful_tmc_fields_bank_card_response.json")).mock();

mActivityTestRule.launchActivity(null);

Expand Down
Loading