Skip to content

Commit

Permalink
[RG, MK]{tests} T - UI tests, should not fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-groebl committed Jun 11, 2014
1 parent f68a2bf commit acb5768
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
3 changes: 2 additions & 1 deletion NAM/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="9"
android:minSdkVersion="14"
android:targetSdkVersion="19" />

<permission
Expand All @@ -19,6 +19,7 @@
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<application
android:name="com.sw.nam.Common"
Expand Down
4 changes: 3 additions & 1 deletion NAM_tests/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="9" />
<uses-sdk
android:minSdkVersion="14"/>

<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.sw.nam" />


<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
Expand Down
2 changes: 1 addition & 1 deletion NAM_tests/src/com/sw/nam/test/AddContactTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected void setUp() throws Exception {
}

protected void tearDown() throws Exception {
super.tearDown();
solo.finishOpenedActivities();
}

public void test1InvalidEmail() {
Expand Down
41 changes: 21 additions & 20 deletions NAM_tests/src/com/sw/nam/test/ChatTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.accounts.Account;
import android.accounts.AccountManager;
import android.test.ActivityInstrumentationTestCase2;

import com.robotium.solo.Solo;
import com.sw.nam.ChatActivity;
import com.sw.nam.MainActivity;
Expand All @@ -22,26 +21,28 @@ protected void setUp() throws Exception {
}

protected void tearDown() throws Exception {
super.tearDown();
solo.finishOpenedActivities();
}

public void test1EnterChat() {
// Account[] accounts = AccountManager.get(getInstrumentation().getContext())
// .getAccountsByType("com.google");
// String email = accounts[0].name;
// solo.clickOnView(getActivity().findViewById(com.sw.nam.R.id.action_add));
// solo.enterText(0, email);;
// solo.clickOnButton(1);
// assertTrue("Could not add contact!", solo.waitForText("email"));
// solo.clickOnText(email);
//// assertTrue("Could not enter chat!", solo.waitForActivity(ChatActivity.class));
// solo.clickLongOnTextAndPress(email, 1);
public void testChat() {
Account[] accounts = AccountManager.get(getInstrumentation().getContext())
.getAccountsByType("com.google");
String email = accounts[0].name;
String message = "Test message!";

solo.clickOnView(getActivity().findViewById(com.sw.nam.R.id.action_add));
solo.enterText(0, email);
solo.clickOnButton(1);
assertTrue("Could not add contact!", solo.waitForText(email + " added!"));
solo.clickInList(0);
assertTrue("Could not enter chat!", solo.waitForActivity(ChatActivity.class));
solo.enterText(0, message);
solo.clickOnButton("Send");
assertTrue("Could not send message!", solo.waitForText(message));
assertTrue("Could not reveice message!", solo.waitForText(message, 2, 1000));
solo.clickOnActionBarHomeButton();
assertTrue("Could not leave chat!", solo.waitForActivity(MainActivity.class));
solo.clickLongOnTextAndPress(email, 1);
assertTrue("Could not delete contact!", solo.waitForText("Contact deleted"));
}


// public void test5ContactDelete() {
// String name = "Bot";
// solo.clickLongOnTextAndPress(name, 1);
// assertFalse("User not deleted!", solo.searchText(name));
// }
}
8 changes: 2 additions & 6 deletions NAM_tests/src/com/sw/nam/test/LoginTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.sw.nam.test;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.test.ActivityInstrumentationTestCase2;
import com.robotium.solo.Solo;
import com.sw.nam.MainActivity;
Expand All @@ -19,12 +17,10 @@ protected void setUp() throws Exception {
}

protected void tearDown() throws Exception {
super.tearDown();
han.finishOpenedActivities();
}

public void test1LoggedIn() {
Account[] accounts = AccountManager.get(getInstrumentation().getContext())
.getAccountsByType("com.google");
assertTrue("not logged in", han.searchText(accounts[0].name));
assertTrue("not logged in", han.searchText("Online"));
}
}

0 comments on commit acb5768

Please sign in to comment.