Skip to content

Commit

Permalink
last modifications (#238)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Jun 10, 2022
1 parent eb50d8b commit 0c742f1
Show file tree
Hide file tree
Showing 72 changed files with 916 additions and 910 deletions.
11 changes: 5 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ android {

dependencies {

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
implementation 'com.google.android.material:material:1.6.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.test.espresso:espresso-intents:3.4.0'
Expand All @@ -51,7 +51,7 @@ dependencies {
implementation 'com.google.firebase:firebase-storage:20.0.1'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.9.0'
implementation 'com.google.android.gms:play-services-location:19.0.1'
implementation 'com.google.android.gms:play-services-location:20.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand All @@ -65,7 +65,6 @@ dependencies {
implementation 'com.firebaseui:firebase-ui-firestore:8.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.google.code.gson:gson:2.8.9'

implementation 'io.agora.rtc:full-sdk:3.5.0'
implementation 'com.android.volley:volley:1.2.1'

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

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
xml.required.set(true)
html.required.set(true)
}

def fileFilter = [
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package ch.epfl.sweng.hostme;
package ch.epfl.sweng.hostme.account;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.clearText;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.intent.Intents.intended;
import static androidx.test.espresso.intent.Intents.intending;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.isEnabled;
import static androidx.test.espresso.matcher.ViewMatchers.isNotEnabled;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.junit.Assert.assertNotNull;
Expand All @@ -28,6 +30,7 @@
import androidx.test.core.app.ActivityScenario;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.espresso.intent.Intents;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.GrantPermissionRule;

Expand All @@ -42,6 +45,7 @@
import java.io.FileOutputStream;
import java.io.IOException;

import ch.epfl.sweng.hostme.R;
import ch.epfl.sweng.hostme.activities.LogInActivity;
import ch.epfl.sweng.hostme.activities.MenuActivity;
import ch.epfl.sweng.hostme.database.Auth;
Expand All @@ -63,7 +67,7 @@ public static void setUp() {
FirebaseApp.initializeApp(ApplicationProvider.getApplicationContext());
}

public static Bitmap drawableToBitmap(Drawable drawable) {
private static Bitmap drawableToBitmap(Drawable drawable) {

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

onView(withId(R.id.user_name)).perform(typeText(mail), closeSoftKeyboard());
onView(ViewMatchers.withId(R.id.user_name)).perform(typeText(mail), closeSoftKeyboard());
onView(withId(R.id.pwd)).perform(typeText(password), closeSoftKeyboard());
onView(withId(R.id.log_in_button)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.navigation_account)).check(matches(isDisplayed()));
onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.user_profile_first_name)).check(matches(withText(firstName)));
onView(withId(R.id.user_profile_last_name)).check(matches(withText(lastName)));
onView(withId(R.id.user_profile_email)).check(matches(withText(Auth.getCurrentUser().getEmail())));
Expand All @@ -120,13 +122,11 @@ public void logOut() {
Thread.sleep(1000);

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.user_profile_log_out_button)).perform(click());
Thread.sleep(1000);

Intent intent2 = new Intent(ApplicationProvider.getApplicationContext(), MenuActivity.class);
ActivityScenario<MenuActivity> scenario2 = ActivityScenario.launch(intent2);

onView(withId(R.id.log_in_button)).check(matches(isDisplayed()));
} catch (InterruptedException e) {
e.printStackTrace();
}
Expand All @@ -145,25 +145,20 @@ public void saveProfileButtonEnabledTest() {
onView(withId(R.id.pwd)).perform(typeText(password), closeSoftKeyboard());
onView(withId(R.id.log_in_button)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

String firstname = "test modified";
onView(withId(R.id.user_profile_first_name)).perform(clearText())
.perform(typeText(firstname), closeSoftKeyboard());
onView(withId(R.id.user_profile_first_name)).perform(clearText()).perform(typeText(firstname), closeSoftKeyboard());
onView(withId(R.id.user_profile_save_button)).check(matches(isEnabled()));
onView(withId(R.id.user_profile_save_button)).check(matches(isDisplayed()));
onView(withId(R.id.user_profile_gender_f)).perform(click());
onView(withId(R.id.user_profile_save_button)).perform(click());
Thread.sleep(1000);

String firstnameOriginal = "test";
onView(withId(R.id.user_profile_first_name)).perform(clearText())
.perform(typeText(firstnameOriginal), closeSoftKeyboard());
onView(withId(R.id.user_profile_first_name)).perform(clearText()).perform(typeText(firstnameOriginal), closeSoftKeyboard());
onView(withId(R.id.user_profile_gender_m)).perform(click());
onView(withId(R.id.user_profile_save_button)).perform(click());
Thread.sleep(1000);
onView(withId(R.id.user_profile_save_button)).check(matches(isNotEnabled()));

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

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

String firstname = "test modified";
onView(withId(R.id.user_profile_first_name)).perform(clearText())
.perform(typeText(firstname), closeSoftKeyboard());
onView(withId(R.id.user_profile_first_name)).perform(clearText()).perform(typeText(firstname), closeSoftKeyboard());
onView(withId(R.id.user_profile_save_button)).check(matches(isEnabled()));
onView(withId(R.id.user_profile_save_button)).check(matches(isDisplayed()));
onView(withId(R.id.user_profile_gender_f)).perform(click());
Expand All @@ -214,8 +206,6 @@ public void checkButtonWalletWorks() {
Thread.sleep(1000);

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.wallet_button)).check(matches(isDisplayed()));
onView(withId(R.id.wallet_button)).perform(click());

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

onView(withId(R.id.navigation_account)).check(matches(isDisplayed()));
onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.user_profile_change_password_button)).perform(click());
onView(withId(R.id.user_profile_change_pwd_terminate)).perform(click());
Thread.sleep(1000);
onView(withId(R.id.user_profile_old_password)).check(matches(isDisplayed()));
onView(withId(R.id.user_profile_new_password)).check(matches(isDisplayed()));
onView(withId(R.id.user_profile_confirm_new_password)).check(matches(isDisplayed()));
onView(withId(R.id.user_profile_old_password)).perform(typeText(originalPassword), closeSoftKeyboard());
onView(withId(R.id.user_profile_new_password)).perform(typeText(newPassword), closeSoftKeyboard());
onView(withId(R.id.user_profile_confirm_new_password)).perform(typeText(newPassword), closeSoftKeyboard());
onView(withId(R.id.user_profile_change_pwd_terminate)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.user_profile_old_password)).perform(clearText()).perform(typeText(newPassword), closeSoftKeyboard());
onView(withId(R.id.user_profile_new_password)).perform(clearText()).perform(typeText(originalPassword), closeSoftKeyboard());
onView(withId(R.id.user_profile_confirm_new_password)).perform(clearText()).perform(typeText(originalPassword), closeSoftKeyboard());
onView(withId(R.id.user_profile_change_pwd_terminate)).perform(click());
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Expand All @@ -271,6 +256,7 @@ public void uploadProfilePictureFromCamera() {
Intent intent = new Intent(ApplicationProvider.getApplicationContext(), LogInActivity.class);
Intents.init();
try (ActivityScenario<LogInActivity> scenario = ActivityScenario.launch(intent)) {
savePickedImage();
intending(hasAction(MediaStore.ACTION_IMAGE_CAPTURE)).respondWith(getImageResult());

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

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.user_profile_change_photo_button)).perform(click());
onView(withText("Pick from Camera")).perform(click());
intended(hasAction(MediaStore.ACTION_IMAGE_CAPTURE));
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
Expand All @@ -309,11 +295,11 @@ public void uploadProfilePictureFromGallery() {
Thread.sleep(1000);

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

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

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

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

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


onView(withText("Pick from Gallery")).perform(click());
intended(hasAction(Intent.ACTION_PICK));
Thread.sleep(1000);
onView(withId(R.id.user_profile_save_button)).perform(click());
Thread.sleep(1000);
onView(withId(R.id.user_profile_change_photo_button)).perform(click());

onView(withText("Pick from Gallery")).perform(click());
Thread.sleep(1000);
onView(withId(R.id.user_profile_save_button)).perform(click());

} catch (InterruptedException e) {
e.printStackTrace();
}
Expand All @@ -375,14 +358,13 @@ public void uploadProfilePictureAndDelete() {
Thread.sleep(1000);

onView(withId(R.id.navigation_account)).perform(click());
Thread.sleep(1000);

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

onView(withText("Pick from Gallery")).perform(click());
intended(hasAction(Intent.ACTION_PICK));
Thread.sleep(1000);
onView(withId(R.id.user_profile_save_button)).perform(click());
Thread.sleep(1000);

onView(withId(R.id.user_profile_change_photo_button)).perform(click());
onView(withText("Delete")).perform(click());
Expand Down
Loading

0 comments on commit 0c742f1

Please sign in to comment.