-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from nus-mtp/development-frontend
Development frontend to master for V0.5
- Loading branch information
Showing
112 changed files
with
5,448 additions
and
748 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
148 changes: 148 additions & 0 deletions
148
...src/androidTest/java/org/example/team_pigeon/movie_pigeon/ChangeUserInfoActivityTest.java
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 |
---|---|---|
@@ -0,0 +1,148 @@ | ||
package org.example.team_pigeon.movie_pigeon; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.filters.LargeTest; | ||
import android.support.test.rule.ActivityTestRule; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import junit.framework.AssertionFailedError; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static android.support.test.espresso.Espresso.onView; | ||
import static android.support.test.espresso.assertion.ViewAssertions.matches; | ||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withId; | ||
|
||
/** | ||
* Created by Guo Mingxuan on 19/3/2017. | ||
*/ | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
@LargeTest | ||
public class ChangeUserInfoActivityTest { | ||
|
||
@Rule | ||
public ActivityTestRule<ChangeUserInfoActivity> mActivityRule = new ActivityTestRule<ChangeUserInfoActivity>(ChangeUserInfoActivity.class){ | ||
@Override | ||
protected Intent getActivityIntent() { | ||
Context targetContext = InstrumentationRegistry.getInstrumentation() | ||
.getTargetContext(); | ||
Intent result = new Intent(targetContext, ThirdPartySignupActivity.class); | ||
result.putExtra("type", "username"); | ||
return result; | ||
} | ||
}; | ||
|
||
@Test | ||
public void loadToolbar() { | ||
try { | ||
onView(withId(R.id.toolbar_user_activity)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadFrameLayout() { | ||
try { | ||
onView(withId(R.id.fl_user_activity)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadUsernameTextView() { | ||
try { | ||
onView(withId(R.id.setting_fragment_username_tv)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadUsernameEdittext() { | ||
try { | ||
onView(withId(R.id.setting_fragment_username_et)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadCurrentPasswordTextView() { | ||
try { | ||
onView(withId(R.id.setting_fragment_now_password_tv)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadCurrentPasswordEdittext() { | ||
try { | ||
onView(withId(R.id.setting_fragment_now_password_et)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadNewPasswordTextView() { | ||
try { | ||
onView(withId(R.id.setting_fragment_password_tv)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadNewPasswordEdittext() { | ||
try { | ||
onView(withId(R.id.setting_fragment_password_et)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadConfirmPasswordTextView() { | ||
try { | ||
onView(withId(R.id.setting_fragment_repeat_password_tv)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadConfirmPasswordEdittext() { | ||
try { | ||
onView(withId(R.id.setting_fragment_repeat_password_et)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadConfirmButton() { | ||
try { | ||
onView(withId(R.id.setting_fragment_confirm)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Test | ||
public void loadCancelButton() { | ||
try { | ||
onView(withId(R.id.setting_fragment_cancel)).check(matches(isDisplayed())); | ||
} catch (AssertionFailedError e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...on/app/src/androidTest/java/org/example/team_pigeon/movie_pigeon/DisplayActivityTest.java
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.example.team_pigeon.movie_pigeon; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.rule.ActivityTestRule; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.example.team_pigeon.movie_pigeon.models.Movie; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.util.ArrayList; | ||
|
||
import static android.support.test.espresso.Espresso.onData; | ||
import static android.support.test.espresso.Espresso.onView; | ||
import static android.support.test.espresso.assertion.ViewAssertions.matches; | ||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withId; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withText; | ||
|
||
/** | ||
* Created by SHENGX on 2017/3/19. | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class DisplayActivityTest { | ||
@Rule | ||
public ActivityTestRule<DisplayActivity> displayActivityActivityTestRule = new ActivityTestRule<DisplayActivity>(DisplayActivity.class) { | ||
@Override | ||
protected Intent getActivityIntent() { | ||
ArrayList<Movie> testMovieList = new ArrayList<>(); | ||
for (int i = 0; i < 10; i++) { | ||
testMovieList.add(new Movie(String.valueOf(i), "id")); | ||
} | ||
Bundle argument = new Bundle(); | ||
argument.putSerializable("movieList", testMovieList); | ||
argument.putString("title", "TestBar"); | ||
argument.putString("type", "test"); | ||
Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
Intent result = new Intent(targetContext, DisplayActivity.class); | ||
result.putExtra("bundle",argument); | ||
return result; | ||
} | ||
}; | ||
|
||
@Test | ||
public void showMovieListProperly() { | ||
onView(withId(R.id.toolbar_display_page)).check(matches(isDisplayed())); | ||
onView(withId(R.id.list_movies)).check(matches(isDisplayed())); | ||
for(int i = 0;i<10;i++) { | ||
onData(withText(String.valueOf(i))).inAdapterView(withId(R.id.list_movies)).atPosition(i); | ||
} | ||
} | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
...n/app/src/androidTest/java/org/example/team_pigeon/movie_pigeon/HomePageActivityTest.java
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.example.team_pigeon.movie_pigeon; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.rule.ActivityTestRule; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static android.support.test.espresso.Espresso.onView; | ||
import static android.support.test.espresso.action.ViewActions.click; | ||
import static android.support.test.espresso.assertion.ViewAssertions.matches; | ||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withId; | ||
import static android.support.test.espresso.matcher.ViewMatchers.withText; | ||
|
||
/** | ||
* Created by SHENGX on 2017/3/19. | ||
*/ | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
public class HomePageActivityTest { | ||
@Rule | ||
public ActivityTestRule<HomePageActivity> homePageActivityActivityTestRule = new ActivityTestRule<HomePageActivity>(HomePageActivity.class) { | ||
@Override | ||
protected Intent getActivityIntent() { | ||
Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
Intent result = new Intent(targetContext, HomePageActivity.class); | ||
result.putExtra("Token", "test token"); | ||
return result; | ||
} | ||
}; | ||
|
||
@Test | ||
public void ensureUiComponentsDisplayed() { | ||
onView(withId(R.id.rg_tab_bar)) | ||
.check(matches(isDisplayed())); | ||
onView(withId(R.id.rb_now_showing)) | ||
.check(matches(isDisplayed())); | ||
onView(withId(R.id.rb_home)) | ||
.check(matches(isDisplayed())); | ||
onView(withId(R.id.rb_me)) | ||
.check(matches(isDisplayed())); | ||
onView(withId(R.id.view_pager)) | ||
.check(matches(isDisplayed())); | ||
onView(withId(R.id.rg_tab_bar)) | ||
.check(matches(isDisplayed())); | ||
} | ||
|
||
@Test | ||
public void viewPagerSwitchCorrectly() { | ||
onView(withText("Cinemas")).perform(click()); | ||
onView(withId(R.id.spinner_cinema_brand)).check(matches(isDisplayed())); | ||
onView(withText("Me")).perform(click()); | ||
onView(withText("My Ratings")).check(matches(isDisplayed())); | ||
onView(withText("My Bookmarks")).check(matches(isDisplayed())); | ||
onView(withText("Settings")).check(matches(isDisplayed())); | ||
onView(withText("Logout")).check(matches(isDisplayed())); | ||
onView(withText("Home")).perform(click()); | ||
onView(withId(R.id.search_view)).check(matches(isDisplayed())); | ||
onView(withId(R.id.grid_now_showing)).check(matches(isDisplayed())); | ||
onView(withId(R.id.grid_recommended)).check(matches(isDisplayed())); | ||
} | ||
} |
Oops, something went wrong.