-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
eb50d8b
commit 0c742f1
Showing
72 changed files
with
916 additions
and
910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
app/src/androidTest/java/ch/epfl/sweng/hostme/ScrollingApartmentTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
@@ -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; | ||
|
||
|
@@ -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; | ||
|
@@ -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(); | ||
|
@@ -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()))); | ||
|
@@ -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(); | ||
} | ||
|
@@ -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(); | ||
|
@@ -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()); | ||
|
@@ -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()); | ||
|
||
|
@@ -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(); | ||
} | ||
|
@@ -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]"; | ||
|
@@ -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(); | ||
|
@@ -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) { | ||
|
@@ -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(); | ||
} | ||
|
@@ -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()); | ||
|
Oops, something went wrong.