You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@taverna.apache.org by Hiteshgautam01 <gi...@git.apache.org> on 2018/06/24 19:58:35 UTC
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
GitHub user Hiteshgautam01 opened a pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88
Added TutorialActivity Test
Please make sure these boxes are checked before submitting your pull request - thanks!
- [ ] Apply the `AndroidStyle.xml` style template to your code in Android Studio.
- [ ] Run the checks with `./gradlew check` to make sure you didn't break anything
- [ ] If you have multiple commits please combine them into one commit by squashing them.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Hiteshgautam01/incubator-taverna-mobile Test_2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-taverna-mobile/pull/88.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #88
----
commit 40c5828c1c339f4ab08dad8a4246ae887f09e4e8
Author: Hitesh Gautam <ga...@...>
Date: 2018-06-17T11:58:39Z
Added Tutorial Activity Test
----
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091697
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
mEditTextEmail.addTextChangedListener(new CustomTextWatcher(mEditTextEmail));
-
-
mEditTextPassword.addTextChangedListener(new CustomTextWatcher(mEditTextPassword));
-
mEditTextEmail.setOnFocusChangeListener(this);
-
mEditTextPassword.setOnFocusChangeListener(this);
-
--- End diff --
revert this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/incubator-taverna-mobile/pull/88
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091691
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
mEditTextEmail.addTextChangedListener(new CustomTextWatcher(mEditTextEmail));
-
-
--- End diff --
revert this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091682
--- Diff: app/build.gradle ---
@@ -126,6 +126,7 @@ dependencies {
//Dependencies for JUNit and unit tests.
testImplementation "junit:junit:4.12"
+
--- End diff --
remove this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091742
--- Diff: app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java ---
@@ -0,0 +1,85 @@
+package org.apache.taverna.mobile.tutorial;
+
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.taverna.mobile.R;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.tutorial.TutorialActivity;
+import org.junit.Before;
+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.action.ViewActions.swipeLeft;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+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 TutorialActivityTest {
+
+ @Rule
+ public ActivityTestRule<TutorialActivity> mActivityTestRule
+ = new ActivityTestRule<>(TutorialActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check all the views present are visible
+ */
+ @Test
+ public void CheckAllViewAreVisible() throws Exception {
+
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_next)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_skip)).check(matches((isDisplayed())));
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.slide_pager)).check(matches((isDisplayed())));
+ }
+
+ /**
+ * Checks while clicking on skip button should start login activity
+ */
+ @Test
+ public void clickingSkip_shouldStartLoginActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.btn_skip)).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Check swipes are working on tutorial screens and on last tutorial screen while click on
+ * GOT IT it should go to login activity
+ */
+ @Test
+ public void clickingNext_shouldGotoNextTutorial_onClickGotIt_ShouldGoToLoginActivity()
+ throws Exception {
+
+ Intents.init();
+ onView(withText(R.string.next)).check(matches(isDisplayed()));
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withText("GOT IT")).check(matches(isDisplayed()));
--- End diff --
also verify that skip should not visible when "GOT IT" button is visible.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091689
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
mEditTextEmail.addTextChangedListener(new CustomTextWatcher(mEditTextEmail));
-
--- End diff --
revert this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091698
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
mEditTextEmail.addTextChangedListener(new CustomTextWatcher(mEditTextEmail));
-
-
mEditTextPassword.addTextChangedListener(new CustomTextWatcher(mEditTextPassword));
-
mEditTextEmail.setOnFocusChangeListener(this);
-
mEditTextPassword.setOnFocusChangeListener(this);
-
progressDialog = new ProgressDialog(getContext());
-
--- End diff --
revert this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091695
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
mEditTextEmail.addTextChangedListener(new CustomTextWatcher(mEditTextEmail));
-
-
mEditTextPassword.addTextChangedListener(new CustomTextWatcher(mEditTextPassword));
-
mEditTextEmail.setOnFocusChangeListener(this);
-
--- End diff --
revert this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091688
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
--- End diff --
revert this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211138694
--- Diff: app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java ---
@@ -0,0 +1,87 @@
+package org.apache.taverna.mobile.tutorial;
+
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.taverna.mobile.R;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.tutorial.TutorialActivity;
+import org.junit.Before;
+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.action.ViewActions.swipeLeft;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+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;
+import static org.hamcrest.CoreMatchers.not;
+
+@RunWith(AndroidJUnit4.class)
+public class TutorialActivityTest {
+
+ @Rule
+ public ActivityTestRule<TutorialActivity> mActivityTestRule
+ = new ActivityTestRule<>(TutorialActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check all the views present are visible
+ */
+ @Test
+ public void CheckAllViewAreVisible() throws Exception {
+
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_next)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_skip)).check(matches((isDisplayed())));
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.slide_pager)).check(matches((isDisplayed())));
+ }
+
+ /**
+ * Checks while clicking on skip button should start login activity
+ */
+ @Test
+ public void clickingSkip_shouldStartLoginActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.btn_skip)).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Check swipes are working on tutorial screens and on last tutorial screen while clicking on
+ * GOT IT it should go to login activity
+ */
+ @Test
+ public void clickingNext_shouldGotoNextTutorial_onClickGotIt_ShouldGoToLoginActivity()
+ throws Exception {
+
+ Intents.init();
+ onView(withText(R.string.next)).check(matches(isDisplayed()));
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withText("SKIP")).check(matches(not(isDisplayed())));
--- End diff --
I have also requested to add a new scenario.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by Hiteshgautam01 <gi...@git.apache.org>.
Github user Hiteshgautam01 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211100948
--- Diff: app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java ---
@@ -0,0 +1,87 @@
+package org.apache.taverna.mobile.tutorial;
+
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.taverna.mobile.R;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.tutorial.TutorialActivity;
+import org.junit.Before;
+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.action.ViewActions.swipeLeft;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+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;
+import static org.hamcrest.CoreMatchers.not;
+
+@RunWith(AndroidJUnit4.class)
+public class TutorialActivityTest {
+
+ @Rule
+ public ActivityTestRule<TutorialActivity> mActivityTestRule
+ = new ActivityTestRule<>(TutorialActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check all the views present are visible
+ */
+ @Test
+ public void CheckAllViewAreVisible() throws Exception {
+
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_next)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_skip)).check(matches((isDisplayed())));
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.slide_pager)).check(matches((isDisplayed())));
+ }
+
+ /**
+ * Checks while clicking on skip button should start login activity
+ */
+ @Test
+ public void clickingSkip_shouldStartLoginActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.btn_skip)).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Check swipes are working on tutorial screens and on last tutorial screen while clicking on
+ * GOT IT it should go to login activity
+ */
+ @Test
+ public void clickingNext_shouldGotoNextTutorial_onClickGotIt_ShouldGoToLoginActivity()
+ throws Exception {
+
+ Intents.init();
+ onView(withText(R.string.next)).check(matches(isDisplayed()));
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withText("SKIP")).check(matches(not(isDisplayed())));
--- End diff --
@sagar15795, I already added the skip check whether it is displayed or not when GOT IT is displayed.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211138642
--- Diff: app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java ---
@@ -0,0 +1,87 @@
+package org.apache.taverna.mobile.tutorial;
+
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.taverna.mobile.R;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.tutorial.TutorialActivity;
+import org.junit.Before;
+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.action.ViewActions.swipeLeft;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+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;
+import static org.hamcrest.CoreMatchers.not;
+
+@RunWith(AndroidJUnit4.class)
+public class TutorialActivityTest {
+
+ @Rule
+ public ActivityTestRule<TutorialActivity> mActivityTestRule
+ = new ActivityTestRule<>(TutorialActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check all the views present are visible
+ */
+ @Test
+ public void CheckAllViewAreVisible() throws Exception {
+
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_next)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_skip)).check(matches((isDisplayed())));
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.slide_pager)).check(matches((isDisplayed())));
+ }
+
+ /**
+ * Checks while clicking on skip button should start login activity
+ */
+ @Test
+ public void clickingSkip_shouldStartLoginActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.btn_skip)).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Check swipes are working on tutorial screens and on last tutorial screen while clicking on
+ * GOT IT it should go to login activity
+ */
+ @Test
+ public void clickingNext_shouldGotoNextTutorial_onClickGotIt_ShouldGoToLoginActivity()
+ throws Exception {
+
+ Intents.init();
+ onView(withText(R.string.next)).check(matches(isDisplayed()));
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withText("SKIP")).check(matches(not(isDisplayed())));
--- End diff --
@Hiteshgautam01 `Please change the requested changes. Could you also write a test for the scenario that you first navigate to a random page and then click skip and verify is it navigating to LoginActivity or not?`
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091693
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
mEditTextEmail.addTextChangedListener(new CustomTextWatcher(mEditTextEmail));
-
-
mEditTextPassword.addTextChangedListener(new CustomTextWatcher(mEditTextPassword));
-
--- End diff --
revert this line.
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by Hiteshgautam01 <gi...@git.apache.org>.
Github user Hiteshgautam01 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211529291
--- Diff: app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java ---
@@ -0,0 +1,87 @@
+package org.apache.taverna.mobile.tutorial;
+
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.taverna.mobile.R;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.tutorial.TutorialActivity;
+import org.junit.Before;
+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.action.ViewActions.swipeLeft;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+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;
+import static org.hamcrest.CoreMatchers.not;
+
+@RunWith(AndroidJUnit4.class)
+public class TutorialActivityTest {
+
+ @Rule
+ public ActivityTestRule<TutorialActivity> mActivityTestRule
+ = new ActivityTestRule<>(TutorialActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check all the views present are visible
+ */
+ @Test
+ public void CheckAllViewAreVisible() throws Exception {
+
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_next)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_skip)).check(matches((isDisplayed())));
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.slide_pager)).check(matches((isDisplayed())));
+ }
+
+ /**
+ * Checks while clicking on skip button should start login activity
+ */
+ @Test
+ public void clickingSkip_shouldStartLoginActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.btn_skip)).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Check swipes are working on tutorial screens and on last tutorial screen while clicking on
+ * GOT IT it should go to login activity
+ */
+ @Test
+ public void clickingNext_shouldGotoNextTutorial_onClickGotIt_ShouldGoToLoginActivity()
+ throws Exception {
+
+ Intents.init();
+ onView(withText(R.string.next)).check(matches(isDisplayed()));
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withText("SKIP")).check(matches(not(isDisplayed())));
--- End diff --
@sagar15795 Done
---
[GitHub] incubator-taverna-mobile pull request #88: Added TutorialActivity Test
Posted by sagar15795 <gi...@git.apache.org>.
Github user sagar15795 commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-mobile/pull/88#discussion_r211091699
--- Diff: app/src/main/java/org/apache/taverna/mobile/ui/login/LoginFragment.java ---
@@ -102,20 +102,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
mEditTextEmail.addTextChangedListener(new CustomTextWatcher(mEditTextEmail));
-
-
mEditTextPassword.addTextChangedListener(new CustomTextWatcher(mEditTextPassword));
-
mEditTextEmail.setOnFocusChangeListener(this);
-
mEditTextPassword.setOnFocusChangeListener(this);
-
progressDialog = new ProgressDialog(getContext());
-
progressDialog.setMessage("Please wait");
-
--- End diff --
revert this line.
---