Skip to content

Commit fdaffc8

Browse files
authored
HW-51714 - Updating gql responses (#23)
1 parent f41207c commit fdaffc8

24 files changed

+12288
-11605
lines changed

ui/src/androidTest/java/com/hyperwallet/android/transfermethod/ui/AddTransferMethodTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void testAddTransferMethod_accountDetailsHiddenOnEmptyFeeAndProcessingRes
124124
@Test
125125
public void testAddTransferMethod_displaysErrorDialogOnDuplicateAccountFailure() {
126126
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
127-
.getResourceContent("successful_tmc_fields_response.json")).mock();
127+
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
128128
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_BAD_REQUEST).withBody(sResourceManager
129129
.getResourceContent("bank_account_duplicate_routing_response.json")).mock();
130130

@@ -159,7 +159,7 @@ public void testAddTransferMethod_displaysErrorDialogOnDuplicateAccountFailure()
159159
@Test
160160
public void testAddTransferMethod_displaysUnexpectedErrorDialogOnException() {
161161
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
162-
.getResourceContent("successful_tmc_fields_response.json")).mock();
162+
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
163163
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_BAD_REQUEST).withBody(sResourceManager
164164
.getResourceContent("invalid_json_response.json")).mock();
165165

@@ -189,7 +189,7 @@ public void testAddTransferMethod_displaysUnexpectedErrorDialogOnException() {
189189
@Test
190190
public void testAddTransferMethod_displaysNetworkErrorDialogOnConnectionTimeout() throws IOException {
191191
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
192-
.getResourceContent("successful_tmc_fields_response.json")).mock();
192+
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
193193

194194
mActivityTestRule.launchActivity(null);
195195

ui/src/androidTest/java/com/hyperwallet/android/transfermethod/ui/BankAccountTest.java

Lines changed: 153 additions & 32 deletions
Large diffs are not rendered by default.

ui/src/androidTest/java/com/hyperwallet/android/transfermethod/ui/BankCardTest.java

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import static androidx.test.espresso.action.ViewActions.typeText;
88
import static androidx.test.espresso.assertion.ViewAssertions.matches;
99
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
10+
import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
1011
import static androidx.test.espresso.matcher.ViewMatchers.withId;
1112
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
1213
import static androidx.test.espresso.matcher.ViewMatchers.withText;
@@ -35,6 +36,7 @@
3536
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
3637
import androidx.test.core.app.ApplicationProvider;
3738
import androidx.test.espresso.IdlingRegistry;
39+
import androidx.test.espresso.matcher.ViewMatchers;
3840
import androidx.test.ext.junit.runners.AndroidJUnit4;
3941
import androidx.test.rule.ActivityTestRule;
4042

@@ -98,7 +100,7 @@ public void setup() {
98100
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
99101
.getResourceContent("authentication_token_response.json")).mock();
100102
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
101-
.getResourceContent("successful_tmc_bank_card_fields_response.json")).mock();
103+
.getResourceContent("successful_tmc_fields_bank_card_response.json")).mock();
102104
}
103105

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

126128
onView(withId(R.id.cardNumber)).check(matches(isDisplayed()));
129+
onView(withId(R.id.cardNumberLabel)).check(matches(isDisplayed()));
127130
onView(withId(R.id.cardNumberLabel)).check(matches(withHint(CARD_NUMBER_LABEL)));
128131
onView(withId(R.id.dateOfExpiry)).check(matches(isDisplayed()));
132+
onView(withId(R.id.dateOfExpiryLabel)).check(matches(isDisplayed()));
129133
onView(withId(R.id.dateOfExpiryLabel)).check(matches(withHint(EXPIRY_DATE_LABEL)));
130134
onView(withId(R.id.cvv)).check(matches(isDisplayed()));
131-
onView(withId(R.id.cvvLabel)).check(
132-
matches(withHint(CVV_LABEL)));
135+
onView(withId(R.id.cvvLabel)).check(matches(isDisplayed()));
136+
onView(withId(R.id.cvvLabel)).check(matches(withHint(CVV_LABEL)));
133137

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

146+
onView(withId(R.id.add_transfer_method_static_container)).check(
147+
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
148+
149+
onView(withId(R.id.add_transfer_method_fee_label)).check(
150+
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
142151
onView(withId(R.id.add_transfer_method_fee_label)).check(
143152
matches(withText(R.string.add_transfer_method_fee_label)));
144-
onView(withId(R.id.add_transfer_method_processing_label)).check(
145-
matches(withText(R.string.add_transfer_method_processing_time_label)));
146153
onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("USD 1.75")));
154+
155+
//TODO: Uncomment when processing time node is implemented
156+
// onView(withId(R.id.add_transfer_method_processing_label)).check(
157+
// matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
158+
// onView(withId(R.id.add_transfer_method_processing_label)).check(
159+
// matches(withText(R.string.add_transfer_method_processing_time_label)));
160+
// onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("1 - 2 Business Days")));
147161
}
148162

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

213227
onView(withId(R.id.cardNumberLabel))
214-
.check(matches(hasErrorText("You must provide a value for this field.")));
228+
.check(matches(hasErrorText("You must provide a value for this field")));
215229
onView(withId(R.id.dateOfExpiryLabel))
216-
.check(matches(hasErrorText("You must provide a value for this field.")));
230+
.check(matches(hasErrorText("You must provide a value for this field")));
217231
onView(withId(R.id.cvvLabel))
218-
.check(matches(hasErrorText("You must provide a value for this field.")));
232+
.check(matches(hasErrorText("You must provide a value for this field")));
219233
}
220234

221235
@Test

ui/src/androidTest/java/com/hyperwallet/android/transfermethod/ui/PayPalTest.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static androidx.test.espresso.assertion.ViewAssertions.matches;
99
import static androidx.test.espresso.matcher.RootMatchers.isDialog;
1010
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
11+
import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
1112
import static androidx.test.espresso.matcher.ViewMatchers.withId;
1213
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
1314
import static androidx.test.espresso.matcher.ViewMatchers.withText;
@@ -37,6 +38,7 @@
3738
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
3839
import androidx.test.core.app.ApplicationProvider;
3940
import androidx.test.espresso.IdlingRegistry;
41+
import androidx.test.espresso.matcher.ViewMatchers;
4042
import androidx.test.ext.junit.runners.AndroidJUnit4;
4143
import androidx.test.rule.ActivityTestRule;
4244

@@ -88,7 +90,7 @@ public void setup() {
8890
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
8991
.getResourceContent("authentication_token_response.json")).mock();
9092
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
91-
.getResourceContent("successful_tmc_paypal_fields_response.json")).mock();
93+
.getResourceContent("successful_tmc_fields_paypal_response.json")).mock();
9294
}
9395

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

116118
onView(withId(R.id.email)).check(matches(isDisplayed()));
119+
onView(withId(R.id.emailLabel)).check(matches(isDisplayed()));
117120
onView(withId(R.id.emailLabel)).check(matches(withHint("Email")));
118121

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

130+
onView(withId(R.id.add_transfer_method_static_container)).check(
131+
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
132+
133+
onView(withId(R.id.add_transfer_method_fee_label)).check(
134+
matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
127135
onView(withId(R.id.add_transfer_method_fee_label)).check(
128136
matches(withText(R.string.add_transfer_method_fee_label)));
129-
onView(withId(R.id.add_transfer_method_processing_label)).check(
130-
matches(withText(R.string.add_transfer_method_processing_time_label)));
131137
onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("USD 0.25")));
132-
onView(withId(R.id.add_transfer_method_processing_time_value)).check(matches(withText("IMMEDIATE")));
138+
139+
//TODO: Uncomment when processing time node is implemented
140+
// onView(withId(R.id.add_transfer_method_processing_label)).check(
141+
// matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
142+
// onView(withId(R.id.add_transfer_method_processing_label)).check(
143+
// matches(withText(R.string.add_transfer_method_processing_time_label)));
144+
// onView(withId(R.id.add_transfer_method_fee_value)).check(matches(withText("IMMEDIATE")));
145+
133146
}
134147

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

180193
onView(withId(R.id.emailLabel))
181-
.check(matches(hasErrorText("accountNumber is invalid")));
194+
.check(matches(hasErrorText("is invalid length or format.")));
182195
}
183196

184197
@Test

ui/src/androidTest/java/com/hyperwallet/android/transfermethod/ui/SelectTransferMethodTest.java

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ public void testSelectTransferMethod_verifyCountrySelectionList() {
136136
onView(allOf(instanceOf(TextView.class), withParent(withId(R.id.country_selection_toolbar)))).check(
137137
matches(withText(R.string.select_transfer_method_country)));
138138
onView(withId(R.id.search_button)).check(doesNotExist());
139-
onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(2));
139+
onView(withId(R.id.country_selection_list)).check(new RecyclerViewCountAssertion(5));
140140
onView(allOf(withId(R.id.country_name), withText("Canada"))).check(matches(isDisplayed()));
141+
onView(allOf(withId(R.id.country_name), withText("Croatia"))).check(matches(isDisplayed()));
142+
onView(allOf(withId(R.id.country_name), withText("Mexico"))).check(matches(isDisplayed()));
143+
onView(allOf(withId(R.id.country_name), withText("United Kingdom"))).check(matches(isDisplayed()));
141144
onView(allOf(withId(R.id.country_name), withText("United States"))).check(matches(isDisplayed()));
145+
142146
onView(allOf(withId(R.id.country_item_selected_image),
143147
hasSibling(allOf(withId(R.id.country_name), withText("United States"))))).check(matches(isDisplayed()));
144148

@@ -185,11 +189,12 @@ public void testSelectTransferMethod_verifyCurrencySelectionList() {
185189
matches(withText(R.string.select_transfer_method_currency)));
186190
onView(withId(R.id.search_button)).check(doesNotExist());
187191
onView(withId(R.id.currency_selection_list)).check(new RecyclerViewCountAssertion(1));
188-
onView(allOf(withId(R.id.currency_name), withText("US Dollar"))).check(matches(isDisplayed()));
192+
onView(allOf(withId(R.id.currency_name), withText("United States Dollar"))).check(matches(isDisplayed()));
189193
onView(allOf(withId(R.id.currency_item_selected_image),
190-
hasSibling(allOf(withId(R.id.currency_name), withText("US Dollar"))))).check(matches(isDisplayed()));
194+
hasSibling(allOf(withId(R.id.currency_name), withText("United States Dollar"))))).check(
195+
matches(isDisplayed()));
191196

192-
onView(allOf(withId(R.id.currency_name), withText("US Dollar"))).perform(click());
197+
onView(allOf(withId(R.id.currency_name), withText("United States Dollar"))).perform(click());
193198
onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD")));
194199
}
195200

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

205210
onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
206211
onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD")));
207-
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(2));
212+
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(4));
208213

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

230+
onView(withId(R.id.select_transfer_method_types_list)).check(
231+
matches(atPosition(2, hasDescendant(withText(R.string.wire_account_font_icon)))));
232+
onView(withId(R.id.select_transfer_method_types_list)).check(
233+
matches(atPosition(2, hasDescendant(withText(R.string.wire_account)))));
234+
onView(withId(R.id.select_transfer_method_types_list)).check(
235+
matches(atPosition(2, hasDescendant(withText("Transaction Fee: USD 20.00")))));
236+
onView(withId(R.id.select_transfer_method_types_list)).check(
237+
matches(atPosition(2, hasDescendant(withText("Processing Time: 1-3 Business days")))));
238+
239+
onView(withId(R.id.select_transfer_method_types_list)).check(
240+
matches(atPosition(3, hasDescendant(withText(R.string.paypal_account_font_icon)))));
241+
onView(withId(R.id.select_transfer_method_types_list)).check(
242+
matches(atPosition(3, hasDescendant(withText(R.string.paypal_account)))));
243+
onView(withId(R.id.select_transfer_method_types_list)).check(
244+
matches(atPosition(3, hasDescendant(withText("Transaction Fee: USD 0.25")))));
245+
onView(withId(R.id.select_transfer_method_types_list)).check(
246+
matches(atPosition(3, hasDescendant(withText("Processing Time: IMMEDIATE")))));
247+
225248
}
226249

227250
@Test
@@ -283,20 +306,29 @@ public void testSelectTransferMethod_verifyTransferMethodsListUpdatedOnSelection
283306

284307
onView(withId(R.id.select_transfer_method_country_value)).check(matches(withText("United States")));
285308
onView(withId(R.id.select_transfer_method_currency_value)).check(matches(withText("USD")));
286-
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(2));
309+
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(4));
287310

288311
onView(withId(R.id.select_transfer_method_country_value)).perform(click());
289312
onView(allOf(withId(R.id.country_name), withText("Canada"))).perform(click());
290313

291-
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(1));
314+
onView(withId(R.id.select_transfer_method_types_list)).check(new RecyclerViewCountAssertion(2));
292315
onView(withId(R.id.select_transfer_method_types_list)).check(
293316
matches(atPosition(0, hasDescendant(withText(R.string.bank_account_font_icon)))));
294317
onView(withId(R.id.select_transfer_method_types_list)).check(
295318
matches(atPosition(0, hasDescendant(withText(R.string.bank_account)))));
296319
onView(withId(R.id.select_transfer_method_types_list)).check(
297-
matches(atPosition(0, hasDescendant(withText("Transaction Fee: USD 2.00")))));
320+
matches(atPosition(0, hasDescendant(withText("Transaction Fee: CAD 2.20")))));
321+
onView(withId(R.id.select_transfer_method_types_list)).check(
322+
matches(atPosition(0, hasDescendant(withText("Processing Time: 1-2 Business days")))));
323+
324+
onView(withId(R.id.select_transfer_method_types_list)).check(
325+
matches(atPosition(1, hasDescendant(withText(R.string.paypal_account_font_icon)))));
326+
onView(withId(R.id.select_transfer_method_types_list)).check(
327+
matches(atPosition(1, hasDescendant(withText(R.string.paypal_account)))));
328+
onView(withId(R.id.select_transfer_method_types_list)).check(
329+
matches(atPosition(1, hasDescendant(withText("Transaction Fee: CAD 0.25")))));
298330
onView(withId(R.id.select_transfer_method_types_list)).check(
299-
matches(atPosition(0, hasDescendant(withText("Processing Time: 1-3 Business days")))));
331+
matches(atPosition(1, hasDescendant(withText("Processing Time: IMMEDIATE")))));
300332

301333
}
302334

@@ -307,7 +339,7 @@ public void testSelectTransferMethod_verifyIntentIndividualUser() {
307339
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
308340
.getResourceContent("successful_tmc_keys_response.json")).mock();
309341
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
310-
.getResourceContent("successful_tmc_fields_response.json")).mock();
342+
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
311343

312344
mIntentsTestRule.launchActivity(null);
313345

@@ -326,7 +358,7 @@ public void testSelectTransferMethod_verifyIntentBusinessUser() {
326358
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
327359
.getResourceContent("successful_tmc_keys_response.json")).mock();
328360
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
329-
.getResourceContent("successful_tmc_fields_response.json")).mock();
361+
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
330362

331363
mIntentsTestRule.launchActivity(null);
332364

@@ -345,7 +377,7 @@ public void testSelectTransferMethod_clickBankAccountOpensAddTransferMethodUi()
345377
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
346378
.getResourceContent("successful_tmc_keys_response.json")).mock();
347379
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
348-
.getResourceContent("successful_tmc_fields_response.json")).mock();
380+
.getResourceContent("successful_tmc_fields_bank_account_response.json")).mock();
349381

350382
mActivityTestRule.launchActivity(null);
351383

@@ -362,7 +394,7 @@ public void testSelectTransferMethod_clickBankCardOpensAddTransferMethodUi() {
362394
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
363395
.getResourceContent("successful_tmc_keys_response.json")).mock();
364396
mMockWebServer.mockResponse().withHttpResponseCode(HTTP_OK).withBody(sResourceManager
365-
.getResourceContent("successful_tmc_bank_card_fields_response.json")).mock();
397+
.getResourceContent("successful_tmc_fields_bank_card_response.json")).mock();
366398

367399
mActivityTestRule.launchActivity(null);
368400

0 commit comments

Comments
 (0)