summaryrefslogtreecommitdiffstats
path: root/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-03-03 23:32:54 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-11-10 17:40:55 +0100
commite55eeb311c01775c123eea7bd2f6e9c82fa067b4 (patch)
tree316140568b81534255de9be5822b5435e9090f57 /Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab
parent9f4f2c3cd098159e741995c453df6d5da9fdb89d (diff)
downloadcoursera-e55eeb311c01775c123eea7bd2f6e9c82fa067b4.zip
coursera-e55eeb311c01775c123eea7bd2f6e9c82fa067b4.tar.gz
Android : 06-Notifications: add
Diffstat (limited to 'Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab')
-rw-r--r--Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/NewFeedTest.java94
-rw-r--r--Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedNoNotificationTest.java108
-rw-r--r--Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedWithNotificationTest.java77
3 files changed, 279 insertions, 0 deletions
diff --git a/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/NewFeedTest.java b/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/NewFeedTest.java
new file mode 100644
index 0000000..57e1a75
--- /dev/null
+++ b/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/NewFeedTest.java
@@ -0,0 +1,94 @@
+package course.labs.notificationslab.test;
+
+import course.labs.notificationslab.TestFrontEndActivity;
+import com.robotium.solo.*;
+import android.test.ActivityInstrumentationTestCase2;
+
+public class NewFeedTest extends
+ActivityInstrumentationTestCase2<TestFrontEndActivity> {
+ private Solo solo;
+
+ public NewFeedTest() {
+ super(TestFrontEndActivity.class);
+ }
+
+ public void setUp() throws Exception {
+ solo = new Solo(getInstrumentation());
+ getActivity();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ solo.finishOpenedActivities();
+ }
+
+ public void testRun() {
+ int shortDelay = 2000;
+
+ // Wait for activity:
+ // 'course.labs.notificationslab.TestFrontEndActivity'
+ solo.waitForActivity(course.labs.notificationslab.TestFrontEndActivity.class, 2000);
+
+ solo.sleep(shortDelay);
+
+ // Click on Make Tweets New
+ solo.clickOnView(solo.getView(course.labs.notificationslab.R.id.rejuv_tweets_button));
+
+ solo.sleep(shortDelay);
+
+ // Click on Start Main Activty
+ solo.clickOnView(solo.getView(course.labs.notificationslab.R.id.start_main_button));
+
+ // Wait for activity: 'course.labs.notificationslab.MainActivity'
+ assertTrue(
+ "course.labs.notificationslab.MainActivity is not found!",
+ solo.waitForActivity(course.labs.notificationslab.MainActivity.class));
+
+ solo.sleep(shortDelay);
+
+ // Click on taylorswift13
+ solo.clickOnView(solo.getView(android.R.id.text1));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue("feed_view not shown!", solo.waitForView(solo.getView(course.labs.notificationslab.R.id.feed_view)));
+
+ // Assert that: 'Taylor Swift' is shown
+ assertTrue("'Taylor Swift' is not shown!", solo.searchText("Taylor Swift"));
+
+ solo.sleep(shortDelay);
+
+ // Press menu back key
+ solo.goBack();
+
+ solo.sleep(shortDelay);
+
+ // Click on msrebeccablack
+ solo.clickOnView(solo.getView(android.R.id.text1, 1));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue(
+ "'Rebecca Black' is not shown!",
+ solo.waitForView(solo
+ .getView(course.labs.notificationslab.R.id.feed_view)));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue("'Rebecca Black' is not shown!", solo.searchText("Rebecca Black"));
+
+ solo.sleep(shortDelay);
+
+ // Press menu back key
+ solo.goBack();
+
+ // Click on ladygaga
+ solo.clickOnView(solo.getView(android.R.id.text1, 2));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue(
+ "'feed_view' is not shown!",
+ solo.waitForView(solo
+ .getView(course.labs.notificationslab.R.id.feed_view)));
+
+ // Assert that: 'Lady Gaga' is shown
+ assertTrue("'Lady Gaga' is not shown!", solo.searchText("Lady Gaga"));
+ }
+}
diff --git a/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedNoNotificationTest.java b/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedNoNotificationTest.java
new file mode 100644
index 0000000..d2f3c19
--- /dev/null
+++ b/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedNoNotificationTest.java
@@ -0,0 +1,108 @@
+package course.labs.notificationslab.test;
+
+import course.labs.notificationslab.TestFrontEndActivity;
+import com.robotium.solo.*;
+import android.test.ActivityInstrumentationTestCase2;
+
+public class OldFeedNoNotificationTest extends
+ActivityInstrumentationTestCase2<TestFrontEndActivity> {
+ private Solo solo;
+
+ public OldFeedNoNotificationTest() {
+ super(TestFrontEndActivity.class);
+ }
+
+ public void setUp() throws Exception {
+ solo = new Solo(getInstrumentation());
+ getActivity();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ solo.finishOpenedActivities();
+ }
+
+ public void testRun() {
+
+ int shortDelay = 2000;
+ int longDelay = 20000;
+
+ // Wait for activity:
+ // 'course.labs.notificationslab.TestFrontEndActivity'
+ solo.waitForActivity(course.labs.notificationslab.TestFrontEndActivity.class, 2000);
+
+ // Click on Make Tweets Old
+ solo.clickOnView(solo.getView(course.labs.notificationslab.R.id.age_tweets_button));
+
+ solo.sleep(shortDelay);
+
+ // Click on Start Main Activty
+ solo.clickOnView(solo.getView(course.labs.notificationslab.R.id.start_main_button));
+
+ // Wait for activity: 'course.labs.notificationslab.MainActivity'
+ assertTrue(
+ "course.labs.notificationslab.MainActivity is not found!",
+ solo.waitForActivity(course.labs.notificationslab.MainActivity.class));
+
+ solo.sleep(shortDelay);
+
+ // Click on taylorswift13
+ solo.clickOnView(solo.getView(android.R.id.text1));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue("feed_view' is not shown!", solo.waitForView(solo.getView(course.labs.notificationslab.R.id.feed_view)));
+
+ // Assert that: 'Please wait while we download the Tweets!' is shown
+ assertTrue("'Please wait while we download the Tweets!' is not shown!",
+ solo.searchText("Please wait while we download the Tweets!"));
+
+ solo.sleep(shortDelay);
+
+ // Press menu back key
+ solo.goBack();
+
+ // Sleep for 20 seconds while URLs are downloaded
+ solo.sleep(longDelay);
+
+ // Click on taylorswift13
+ solo.clickOnView(solo.getView(android.R.id.text1));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue("feed_view not shown!", solo.waitForView(solo.getView(course.labs.notificationslab.R.id.feed_view)));
+
+ // Assert that: 'Taylor Swift' is shown
+ assertTrue("'Taylor Swift' is not shown!",solo.searchText("Taylor Swift"));
+
+ solo.sleep(shortDelay);
+
+ // Press menu back key
+ solo.goBack();
+
+ solo.sleep(shortDelay);
+
+ // Click on msrebeccablack
+ solo.clickOnView(solo.getView(android.R.id.text1, 1));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue("'Rebecca Black' is not shown!", solo.waitForView(solo.getView(course.labs.notificationslab.R.id.feed_view)));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue("'Rebecca Black' is not shown!",solo.searchText("Rebecca Black"));
+
+ solo.sleep(shortDelay);
+
+ // Press menu back key
+ solo.goBack();
+
+ solo.sleep(shortDelay);
+
+ // Click on ladygaga
+ solo.clickOnView(solo.getView(android.R.id.text1, 2));
+
+ // Assert that: 'feed_view' is shown
+ assertTrue("'feed_view' is not shown!", solo.waitForView(solo.getView(course.labs.notificationslab.R.id.feed_view)));
+
+ // Assert that: 'Lady Gaga' is shown
+ assertTrue("'Lady Gaga' is not shown!", solo.searchText("Lady Gaga"));
+ }
+}
diff --git a/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedWithNotificationTest.java b/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedWithNotificationTest.java
new file mode 100644
index 0000000..542a554
--- /dev/null
+++ b/Android/06-Notifications/Notifications/tests/src/course/labs/notificationslab/OldFeedWithNotificationTest.java
@@ -0,0 +1,77 @@
+package course.labs.notificationslab.test;
+
+import course.labs.notificationslab.TestFrontEndActivity;
+import com.robotium.solo.*;
+import android.test.ActivityInstrumentationTestCase2;
+
+public class OldFeedWithNotificationTest extends
+ActivityInstrumentationTestCase2<TestFrontEndActivity> {
+ private Solo solo;
+
+ public OldFeedWithNotificationTest() {
+ super(TestFrontEndActivity.class);
+ }
+
+ public void setUp() throws Exception {
+ solo = new Solo(getInstrumentation());
+ getActivity();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ solo.finishOpenedActivities();
+ }
+
+ public void testRun() {
+ int shortDelay = 2000;
+ int longDelay = 20000;
+
+ // Wait for activity:
+ // 'course.labs.notificationslab.TestFrontEndActivity'
+ solo.waitForActivity(course.labs.notificationslab.TestFrontEndActivity.class, 2000);
+
+ solo.sleep(shortDelay);
+
+ // Click on Make Tweets Old
+ solo.clickOnView(solo.getView(course.labs.notificationslab.R.id.age_tweets_button));
+
+ solo.sleep(shortDelay);
+
+ // Click on Start Main Activty
+ solo.clickOnView(solo.getView(course.labs.notificationslab.R.id.start_main_button));
+
+ // Wait for activity: 'course.labs.notificationslab.MainActivity'
+ assertTrue(
+ "course.labs.notificationslab.MainActivity is not found!",
+ solo.waitForActivity(course.labs.notificationslab.MainActivity.class));
+
+ solo.sleep(shortDelay);
+
+ // Click on taylorswift13
+ solo.clickOnView(solo.getView(android.R.id.text1));
+
+ // Assert that: 'Please wait while we download the Tweets!' is shown
+ assertTrue("'Please wait while we download the Tweets!' is not shown!",
+ solo.waitForView(solo
+ .getView(course.labs.notificationslab.R.id.feed_view)));
+
+ solo.sleep(shortDelay);
+
+ // Press menu back key
+ solo.goBack();
+
+ solo.sleep(shortDelay);
+
+ // Press menu back key
+ solo.goBack();
+
+ // Wait for activity:
+ // 'course.labs.notificationslab.TestFrontEndActivity'
+ assertTrue(
+ "course.labs.notificationslab.TestFrontEndActivity is not found!",
+ solo.waitForActivity(course.labs.notificationslab.TestFrontEndActivity.class));
+
+ // Sleep while twitter feed loads
+ solo.sleep(longDelay);
+ }
+}