Skip to content

Commit 0c742f1

Browse files
jules20022000Paul Nadalpaul-ndl
authored
last modifications (#238)
* activities package * activities package * activities package * activities package * activities package * comments until call * comments * add comments to wallet package * comments * comments * comments * add comments to wallet package * change fragment names * menu activity * menu activity * menu activity * maintainability little changes * fix tests (#240) * modify tests * change tests package * change tests package * change tests package * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests * change tests Co-authored-by: Paul Nadal <[email protected]> Co-authored-by: Paul Nadal <[email protected]>
1 parent eb50d8b commit 0c742f1

File tree

72 files changed

+916
-910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+916
-910
lines changed

app/build.gradle

+5-6
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ android {
3636

3737
dependencies {
3838

39-
implementation 'androidx.appcompat:appcompat:1.4.1'
39+
implementation 'androidx.appcompat:appcompat:1.4.2'
4040
implementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
41-
implementation 'com.google.android.material:material:1.6.0'
41+
implementation 'com.google.android.material:material:1.6.1'
4242
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
4343
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
4444
implementation 'androidx.test.espresso:espresso-intents:3.4.0'
@@ -51,7 +51,7 @@ dependencies {
5151
implementation 'com.google.firebase:firebase-storage:20.0.1'
5252
implementation 'com.google.android.gms:play-services-maps:18.0.2'
5353
implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.9.0'
54-
implementation 'com.google.android.gms:play-services-location:19.0.1'
54+
implementation 'com.google.android.gms:play-services-location:20.0.0'
5555
testImplementation 'junit:junit:4.13.2'
5656
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
5757
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
@@ -65,7 +65,6 @@ dependencies {
6565
implementation 'com.firebaseui:firebase-ui-firestore:8.0.0'
6666
implementation 'de.hdodenhof:circleimageview:3.1.0'
6767
implementation 'com.google.code.gson:gson:2.8.9'
68-
6968
implementation 'io.agora.rtc:full-sdk:3.5.0'
7069
implementation 'com.android.volley:volley:1.2.1'
7170

@@ -78,8 +77,8 @@ tasks.withType(Test) {
7877

7978
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
8079
reports {
81-
xml.enabled = true
82-
html.enabled = true
80+
xml.required.set(true)
81+
html.required.set(true)
8382
}
8483

8584
def fileFilter = [

app/src/androidTest/java/ch/epfl/sweng/hostme/ScrollingApartmentTest.java

-50
This file was deleted.

app/src/androidTest/java/ch/epfl/sweng/hostme/UserProfileUITest.java app/src/androidTest/java/ch/epfl/sweng/hostme/account/UserProfileUITest.java

+18-36
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
package ch.epfl.sweng.hostme;
1+
package ch.epfl.sweng.hostme.account;
22

33
import static androidx.test.espresso.Espresso.onView;
44
import static androidx.test.espresso.action.ViewActions.clearText;
55
import static androidx.test.espresso.action.ViewActions.click;
66
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
77
import static androidx.test.espresso.action.ViewActions.typeText;
88
import static androidx.test.espresso.assertion.ViewAssertions.matches;
9+
import static androidx.test.espresso.intent.Intents.intended;
910
import static androidx.test.espresso.intent.Intents.intending;
1011
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
1112
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
1213
import static androidx.test.espresso.matcher.ViewMatchers.isEnabled;
14+
import static androidx.test.espresso.matcher.ViewMatchers.isNotEnabled;
1315
import static androidx.test.espresso.matcher.ViewMatchers.withId;
1416
import static androidx.test.espresso.matcher.ViewMatchers.withText;
1517
import static org.junit.Assert.assertNotNull;
@@ -28,6 +30,7 @@
2830
import androidx.test.core.app.ActivityScenario;
2931
import androidx.test.core.app.ApplicationProvider;
3032
import androidx.test.espresso.intent.Intents;
33+
import androidx.test.espresso.matcher.ViewMatchers;
3134
import androidx.test.ext.junit.runners.AndroidJUnit4;
3235
import androidx.test.rule.GrantPermissionRule;
3336

@@ -42,6 +45,7 @@
4245
import java.io.FileOutputStream;
4346
import java.io.IOException;
4447

48+
import ch.epfl.sweng.hostme.R;
4549
import ch.epfl.sweng.hostme.activities.LogInActivity;
4650
import ch.epfl.sweng.hostme.activities.MenuActivity;
4751
import ch.epfl.sweng.hostme.database.Auth;
@@ -63,7 +67,7 @@ public static void setUp() {
6367
FirebaseApp.initializeApp(ApplicationProvider.getApplicationContext());
6468
}
6569

66-
public static Bitmap drawableToBitmap(Drawable drawable) {
70+
private static Bitmap drawableToBitmap(Drawable drawable) {
6771

6872
if (drawable instanceof BitmapDrawable) {
6973
return ((BitmapDrawable) drawable).getBitmap();
@@ -88,15 +92,13 @@ public void ProfileInfoIsDisplayedTest() {
8892
String lastName = "account";
8993
String gender = "Male";
9094

91-
onView(withId(R.id.user_name)).perform(typeText(mail), closeSoftKeyboard());
95+
onView(ViewMatchers.withId(R.id.user_name)).perform(typeText(mail), closeSoftKeyboard());
9296
onView(withId(R.id.pwd)).perform(typeText(password), closeSoftKeyboard());
9397
onView(withId(R.id.log_in_button)).perform(click());
9498
Thread.sleep(1000);
9599

96100
onView(withId(R.id.navigation_account)).check(matches(isDisplayed()));
97101
onView(withId(R.id.navigation_account)).perform(click());
98-
Thread.sleep(1000);
99-
100102
onView(withId(R.id.user_profile_first_name)).check(matches(withText(firstName)));
101103
onView(withId(R.id.user_profile_last_name)).check(matches(withText(lastName)));
102104
onView(withId(R.id.user_profile_email)).check(matches(withText(Auth.getCurrentUser().getEmail())));
@@ -120,13 +122,11 @@ public void logOut() {
120122
Thread.sleep(1000);
121123

122124
onView(withId(R.id.navigation_account)).perform(click());
123-
Thread.sleep(1000);
124-
125125
onView(withId(R.id.user_profile_log_out_button)).perform(click());
126-
Thread.sleep(1000);
127-
128126
Intent intent2 = new Intent(ApplicationProvider.getApplicationContext(), MenuActivity.class);
129127
ActivityScenario<MenuActivity> scenario2 = ActivityScenario.launch(intent2);
128+
129+
onView(withId(R.id.log_in_button)).check(matches(isDisplayed()));
130130
} catch (InterruptedException e) {
131131
e.printStackTrace();
132132
}
@@ -145,25 +145,20 @@ public void saveProfileButtonEnabledTest() {
145145
onView(withId(R.id.pwd)).perform(typeText(password), closeSoftKeyboard());
146146
onView(withId(R.id.log_in_button)).perform(click());
147147
Thread.sleep(1000);
148-
149148
onView(withId(R.id.navigation_account)).perform(click());
150-
Thread.sleep(1000);
151149

152150
String firstname = "test modified";
153-
onView(withId(R.id.user_profile_first_name)).perform(clearText())
154-
.perform(typeText(firstname), closeSoftKeyboard());
151+
onView(withId(R.id.user_profile_first_name)).perform(clearText()).perform(typeText(firstname), closeSoftKeyboard());
155152
onView(withId(R.id.user_profile_save_button)).check(matches(isEnabled()));
156153
onView(withId(R.id.user_profile_save_button)).check(matches(isDisplayed()));
157154
onView(withId(R.id.user_profile_gender_f)).perform(click());
158155
onView(withId(R.id.user_profile_save_button)).perform(click());
159-
Thread.sleep(1000);
160156

161157
String firstnameOriginal = "test";
162-
onView(withId(R.id.user_profile_first_name)).perform(clearText())
163-
.perform(typeText(firstnameOriginal), closeSoftKeyboard());
158+
onView(withId(R.id.user_profile_first_name)).perform(clearText()).perform(typeText(firstnameOriginal), closeSoftKeyboard());
164159
onView(withId(R.id.user_profile_gender_m)).perform(click());
165160
onView(withId(R.id.user_profile_save_button)).perform(click());
166-
Thread.sleep(1000);
161+
onView(withId(R.id.user_profile_save_button)).check(matches(isNotEnabled()));
167162

168163
} catch (InterruptedException e) {
169164
e.printStackTrace();
@@ -185,11 +180,8 @@ public void saveProfileButtonDisabledTest() {
185180
Thread.sleep(1000);
186181

187182
onView(withId(R.id.navigation_account)).perform(click());
188-
Thread.sleep(1000);
189-
190183
String firstname = "test modified";
191-
onView(withId(R.id.user_profile_first_name)).perform(clearText())
192-
.perform(typeText(firstname), closeSoftKeyboard());
184+
onView(withId(R.id.user_profile_first_name)).perform(clearText()).perform(typeText(firstname), closeSoftKeyboard());
193185
onView(withId(R.id.user_profile_save_button)).check(matches(isEnabled()));
194186
onView(withId(R.id.user_profile_save_button)).check(matches(isDisplayed()));
195187
onView(withId(R.id.user_profile_gender_f)).perform(click());
@@ -214,8 +206,6 @@ public void checkButtonWalletWorks() {
214206
Thread.sleep(1000);
215207

216208
onView(withId(R.id.navigation_account)).perform(click());
217-
Thread.sleep(1000);
218-
219209
onView(withId(R.id.wallet_button)).check(matches(isDisplayed()));
220210
onView(withId(R.id.wallet_button)).perform(click());
221211

@@ -241,25 +231,20 @@ public void changePasswordButtonTest() {
241231

242232
onView(withId(R.id.navigation_account)).check(matches(isDisplayed()));
243233
onView(withId(R.id.navigation_account)).perform(click());
244-
Thread.sleep(1000);
245-
246234
onView(withId(R.id.user_profile_change_password_button)).perform(click());
247235
onView(withId(R.id.user_profile_change_pwd_terminate)).perform(click());
248-
Thread.sleep(1000);
249236
onView(withId(R.id.user_profile_old_password)).check(matches(isDisplayed()));
250237
onView(withId(R.id.user_profile_new_password)).check(matches(isDisplayed()));
251238
onView(withId(R.id.user_profile_confirm_new_password)).check(matches(isDisplayed()));
252239
onView(withId(R.id.user_profile_old_password)).perform(typeText(originalPassword), closeSoftKeyboard());
253240
onView(withId(R.id.user_profile_new_password)).perform(typeText(newPassword), closeSoftKeyboard());
254241
onView(withId(R.id.user_profile_confirm_new_password)).perform(typeText(newPassword), closeSoftKeyboard());
255242
onView(withId(R.id.user_profile_change_pwd_terminate)).perform(click());
256-
Thread.sleep(1000);
257243

258244
onView(withId(R.id.user_profile_old_password)).perform(clearText()).perform(typeText(newPassword), closeSoftKeyboard());
259245
onView(withId(R.id.user_profile_new_password)).perform(clearText()).perform(typeText(originalPassword), closeSoftKeyboard());
260246
onView(withId(R.id.user_profile_confirm_new_password)).perform(clearText()).perform(typeText(originalPassword), closeSoftKeyboard());
261247
onView(withId(R.id.user_profile_change_pwd_terminate)).perform(click());
262-
Thread.sleep(1000);
263248
} catch (InterruptedException e) {
264249
e.printStackTrace();
265250
}
@@ -271,6 +256,7 @@ public void uploadProfilePictureFromCamera() {
271256
Intent intent = new Intent(ApplicationProvider.getApplicationContext(), LogInActivity.class);
272257
Intents.init();
273258
try (ActivityScenario<LogInActivity> scenario = ActivityScenario.launch(intent)) {
259+
savePickedImage();
274260
intending(hasAction(MediaStore.ACTION_IMAGE_CAPTURE)).respondWith(getImageResult());
275261

276262
String mail = "[email protected]";
@@ -282,10 +268,10 @@ public void uploadProfilePictureFromCamera() {
282268
Thread.sleep(1000);
283269

284270
onView(withId(R.id.navigation_account)).perform(click());
285-
Thread.sleep(1000);
286271

287272
onView(withId(R.id.user_profile_change_photo_button)).perform(click());
288273
onView(withText("Pick from Camera")).perform(click());
274+
intended(hasAction(MediaStore.ACTION_IMAGE_CAPTURE));
289275
Thread.sleep(1000);
290276
} catch (InterruptedException e) {
291277
e.printStackTrace();
@@ -309,11 +295,11 @@ public void uploadProfilePictureFromGallery() {
309295
Thread.sleep(1000);
310296

311297
onView(withId(R.id.navigation_account)).perform(click());
312-
Thread.sleep(1000);
313298

314299
onView(withId(R.id.user_profile_change_photo_button)).perform(click());
315300

316301
onView(withText("Pick from Gallery")).perform(click());
302+
intended(hasAction(Intent.ACTION_PICK));
317303
Thread.sleep(1000);
318304
onView(withId(R.id.user_profile_save_button)).perform(click());
319305
} catch (InterruptedException e) {
@@ -338,21 +324,18 @@ public void updateProfilePictureFromGallery() {
338324
Thread.sleep(1000);
339325

340326
onView(withId(R.id.navigation_account)).perform(click());
341-
Thread.sleep(1000);
342327

343328
onView(withId(R.id.user_profile_change_photo_button)).perform(click());
344329

345330

346331
onView(withText("Pick from Gallery")).perform(click());
332+
intended(hasAction(Intent.ACTION_PICK));
347333
Thread.sleep(1000);
348334
onView(withId(R.id.user_profile_save_button)).perform(click());
349-
Thread.sleep(1000);
350335
onView(withId(R.id.user_profile_change_photo_button)).perform(click());
351336

352337
onView(withText("Pick from Gallery")).perform(click());
353-
Thread.sleep(1000);
354338
onView(withId(R.id.user_profile_save_button)).perform(click());
355-
356339
} catch (InterruptedException e) {
357340
e.printStackTrace();
358341
}
@@ -375,14 +358,13 @@ public void uploadProfilePictureAndDelete() {
375358
Thread.sleep(1000);
376359

377360
onView(withId(R.id.navigation_account)).perform(click());
378-
Thread.sleep(1000);
379361

380362
onView(withId(R.id.user_profile_change_photo_button)).perform(click());
381363

382364
onView(withText("Pick from Gallery")).perform(click());
365+
intended(hasAction(Intent.ACTION_PICK));
383366
Thread.sleep(1000);
384367
onView(withId(R.id.user_profile_save_button)).perform(click());
385-
Thread.sleep(1000);
386368

387369
onView(withId(R.id.user_profile_change_photo_button)).perform(click());
388370
onView(withText("Delete")).perform(click());

0 commit comments

Comments
 (0)