You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by sa...@apache.org on 2018/08/12 02:53:09 UTC
incubator-taverna-mobile git commit: Added DashboardActivityTest
Repository: incubator-taverna-mobile
Updated Branches:
refs/heads/master 775fe175a -> cb497ab43
Added DashboardActivityTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/cb497ab4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/cb497ab4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/cb497ab4
Branch: refs/heads/master
Commit: cb497ab43024a62e4c778226acb9667a44152f4a
Parents: 775fe17
Author: Hitesh Gautam <ga...@gmail.com>
Authored: Sat Aug 11 17:53:33 2018 +0530
Committer: Hitesh Gautam <ga...@gmail.com>
Committed: Sun Aug 12 03:37:59 2018 +0530
----------------------------------------------------------------------
.../taverna/mobile/DashboardActivityTest.java | 278 +++++++++++++++++++
.../taverna/mobile/login/LoginActivityTest.java | 1 +
.../taverna/mobile/ui/DashboardActivity.java | 2 +-
app/src/main/res/layout/about.xml | 1 +
app/src/main/res/values/strings.xml | 1 +
build.gradle | 2 +-
6 files changed, 283 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/cb497ab4/app/src/androidTest/java/org/apache/taverna/mobile/DashboardActivityTest.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/DashboardActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/DashboardActivityTest.java
new file mode 100644
index 0000000..f9c0351
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/DashboardActivityTest.java
@@ -0,0 +1,278 @@
+package org.apache.taverna.mobile;
+
+import android.support.test.espresso.contrib.DrawerActions;
+import android.support.test.espresso.contrib.NavigationViewActions;
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+import android.view.Gravity;
+
+import org.apache.taverna.mobile.ui.DashboardActivity;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.usage.UsageActivity;
+import org.apache.taverna.mobile.ui.userprofile.UserProfileActivity;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.os.SystemClock.sleep;
+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.contrib.DrawerMatchers.isClosed;
+import static android.support.test.espresso.contrib.DrawerMatchers.isOpen;
+import static android.support.test.espresso.intent.Intents.intended;
+import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
+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;
+
+
+@RunWith(AndroidJUnit4.class)
+public class DashboardActivityTest {
+
+ @Rule
+ public ActivityTestRule<DashboardActivity> mActivityTestRule
+ = new ActivityTestRule<>(DashboardActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check if the username, password and userAvatar are visible and verify when click on
+ * userAvatar UserProfileActivity will open
+ */
+ @Test
+ public void checkAllViewsVisible_and_OnClickAvatar_openUserProfileActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ //Please Login first otherwise it will not find username and email
+ onView(withId(R.id.nav_user_avatar)).check(matches((isDisplayed())));
+ onView(withId(R.id.nav_user_name)).check(matches((isDisplayed())));
+ onView(withId(R.id.nav_user_email)).check(matches((isDisplayed())));
+
+ onView(withId(R.id.nav_user_avatar)).perform(click());
+
+ intended(hasComponent(UserProfileActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Checks if the Workflow fragment is launched when we click on Workflow in nav drawer
+ */
+ @Test
+ public void onClickNavAllWorkflows_openWorkflowsFragment() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_workflows));
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the myWorkflow fragment is launched when we click on myWorkflow in nav drawer.
+ * Without login, The app does not have any user then it also does not have any myworkflow
+ * Without login it will fail
+ */
+ @Test
+ public void onClickNavMyWorkflows_openMyWorkflowActivity() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_my_workflows));
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the favoriteWorkflow fragment is launched when we click on
+ * favoriteWorkflow in nav drawer
+ */
+ @Test
+ public void onClickNavFavWorkflows_openFavoriteWorkflowActivity() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_favourite_workflow));
+
+ sleep(3000);
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the Announcement fragment is launched when we click on
+ * announcement in nav drawer
+ */
+ @Test
+ public void onClickNavAnnouncement_openAnnouncementActivity() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_announcement));
+
+ sleep(3000);
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the usage activity is launched when we click on usage in nav drawer
+ */
+ @Test
+ public void onClickNavUsage_openUsageActivity() throws Exception {
+
+ Intents.init();
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_usage));
+
+ intended(hasComponent(UsageActivity.class.getName()));
+
+ Intents.release();
+ }
+
+ /**
+ * Checks if the About dialouge is launched when we click on about in nav drawer
+ */
+ @Test
+ public void onClickNavAbout_checkAboutDialogue() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_about));
+
+ onView(withId(R.id.about_dialouge_layout)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the Licence dialouge is launched when we click on licence in nav drawer
+ */
+ @Test
+ public void onClickNavLicence_openLicenceDialouge() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.os_licences));
+
+ onView(withText(R.string.title_nav_os_licences)).check(matches(isDisplayed()));
+
+ }
+
+ /**
+ * Checks if the Licence dialogue is launched when we click on licence in nav drawer
+ */
+ @Test
+ public void onClickNavApacheLicence_openApacheLicence_NoticeDialouge() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.apache_licences));
+
+ onView(withText(R.string.title_nav_apache_licences)).check(matches(isDisplayed()));
+
+ }
+
+ /**
+ * Checks if the setting fragment is launched
+ * when we click on settings in navigation drawer
+ */
+ @Test
+ public void onClickNavSetting_openSettingFragment() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_settings));
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the login is launched when click on logout in nav drawer and click on
+ * sign out in alert dialouge box
+ */
+ @Test
+ public void onClickLogout_ClickSignOut_OpenLoginScreen() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_logout));
+
+ onView(withId(android.R.id.button1)).perform(click());
+
+ intended(hasComponent(LoginActivity.class.getName()));
+
+ Intents.release();
+ }
+
+ /**
+ * Checks if alert dialogue box is dismiss when click on cancel in logout alert sign in box
+ */
+ @Test
+ public void onClickLogout_clickCancel_dismissDialogueBoz() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_logout));
+
+ onView(withId(android.R.id.button2)).perform(click());
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isOpen(Gravity.LEFT)));
+
+ Intents.release();
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/cb497ab4/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
index d58a13c..ba52fb8 100644
--- a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
@@ -90,6 +90,7 @@ public class LoginActivityTest {
*/
@Test
public void checkAllViewAreVisible() throws Exception {
+ mLoginActivityActivityTestRule.launchActivity(null);
onView(withId(R.id.logo)).check(matches(isDisplayed()));
onView(withId(R.id.tvAppName)).check(matches(withText(R.string.app_name)));
onView(withId(R.id.loginlayout)).check(matches(isDisplayed()));
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/cb497ab4/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java b/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
index 60b3316..4acad97 100644
--- a/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
+++ b/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
@@ -257,7 +257,7 @@ public class DashboardActivity extends BaseActivity {
private void signOutConfirmation() {
new AlertDialog.Builder(this)
- .setTitle(R.string.sign_out)
+ .setTitle(R.string.sign_out_conformation)
.setMessage(R.string.sign_out_message)
.setPositiveButton(R.string.sign_out, new DialogInterface.OnClickListener() {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/cb497ab4/app/src/main/res/layout/about.xml
----------------------------------------------------------------------
diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml
index 1d1e77c..858ec0f 100644
--- a/app/src/main/res/layout/about.xml
+++ b/app/src/main/res/layout/about.xml
@@ -15,6 +15,7 @@ limitations under the License.
-->
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/about_dialouge_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="*"
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/cb497ab4/app/src/main/res/values/strings.xml
----------------------------------------------------------------------
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 304a469..3d5fb64 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -186,6 +186,7 @@ limitations under the License.
<string name="please_wait">Please Wait ...</string>
<string name="headline_taverna_player_portal_login">Taverna Player Portal Login</string>
<string name="button_text_login">Login</string>
+ <string name="sign_out_conformation">Sign Out</string>
<string name="sign_out">Sign Out</string>
<string name="sign_out_message">Do you really want to sign out?</string>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/cb497ab4/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 7326a5d..047e788 100644
--- a/build.gradle
+++ b/build.gradle
@@ -50,6 +50,6 @@ ext {
leakcanary ='1.5.4'
dagger='2.8'
- espresso = '2.2.1'
+ espresso = '2.2.2'
runner = '0.4'
}
\ No newline at end of file