Little fixes + new tests
This commit is contained in:
parent
69a4cf9f6a
commit
3b4ed458f2
5 changed files with 127 additions and 6 deletions
|
@ -473,7 +473,7 @@ public class StatusFragment extends Fragment {
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
title.setText(getString(R.string.call_stats_video));
|
title.setText("Audio");
|
||||||
PayloadType payload = call.getCurrentParamsCopy().getUsedVideoCodec();
|
PayloadType payload = call.getCurrentParamsCopy().getUsedVideoCodec();
|
||||||
if (payload != null) {
|
if (payload != null) {
|
||||||
codec.setText(payload.getMime());
|
codec.setText(payload.getMime());
|
||||||
|
@ -490,7 +490,7 @@ public class StatusFragment extends Fragment {
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
title.setText(getString(R.string.call_stats_audio));
|
title.setText("Video");
|
||||||
PayloadType payload = call.getCurrentParamsCopy().getUsedAudioCodec();
|
PayloadType payload = call.getCurrentParamsCopy().getUsedAudioCodec();
|
||||||
if (payload != null) {
|
if (payload != null) {
|
||||||
codec.setText(payload.getMime());
|
codec.setText(payload.getMime());
|
||||||
|
|
|
@ -48,8 +48,10 @@ public class GCMService extends GCMBaseIntentService {
|
||||||
@Override
|
@Override
|
||||||
protected void onMessage(Context context, Intent intent) {
|
protected void onMessage(Context context, Intent intent) {
|
||||||
Log.d("Push notification received");
|
Log.d("Push notification received");
|
||||||
LinphoneManager.getLc().setNetworkReachable(false);
|
if (LinphoneManager.isInstanciated()) {
|
||||||
LinphoneManager.getLc().setNetworkReachable(true);
|
LinphoneManager.getLc().setNetworkReachable(false);
|
||||||
|
LinphoneManager.getLc().setNetworkReachable(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
11
tests/res/values/tests.xml
Normal file
11
tests/res/values/tests.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<bool name="enable_account_tests">true</bool>
|
||||||
|
|
||||||
|
|
||||||
|
<bool name="enable_call_tests">true</bool>
|
||||||
|
|
||||||
|
<bool name="enable_push_notification_tests">true</bool>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -11,7 +11,9 @@ import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.test.ActivityInstrumentationTestCase2;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.jayway.android.robotium.solo.Solo;
|
import com.jayway.android.robotium.solo.Solo;
|
||||||
|
|
||||||
|
@ -31,13 +33,40 @@ public class AccountsTest extends
|
||||||
solo = new Solo(getInstrumentation(), getActivity());
|
solo = new Solo(getInstrumentation(), getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConfigureExistingAccount() {
|
public void testAConfigureExternalSIPAccount() {
|
||||||
Context context = getActivity();
|
Context context = getActivity();
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
||||||
|
|
||||||
|
solo.waitForActivity("SetupActivity", 2000);
|
||||||
|
solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
|
||||||
|
Log.testSuccess("Wizard launching at first startup");
|
||||||
|
|
||||||
|
solo.clickOnView(solo.getView(R.id.setup_next));
|
||||||
|
solo.clickOnText(context.getString(R.string.setup_login_generic));
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_username), "junit");
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_password), "junit");
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_domain), "test.linphone.org");
|
||||||
|
solo.clickOnText(context.getString(R.string.setup_apply));
|
||||||
|
|
||||||
|
solo.waitForActivity("LinphoneActivity", 2000);
|
||||||
|
Assert.assertTrue(solo.searchText("junit@test.linphone.org"));
|
||||||
|
|
||||||
|
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
||||||
|
Assert.assertEquals(nbAccountsBefore + 1, nbAccountsAfter);
|
||||||
|
Log.testSuccess("Configure existing generic account");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBConfigureExistingLinphoneAccount() {
|
||||||
|
Context context = getActivity();
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
|
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
||||||
|
|
||||||
|
solo.waitForActivity("LinphoneActivity", 2000);
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
|
Log.testSuccess("Wizard not launching at startup if account is configured");
|
||||||
|
|
||||||
solo.clickOnView(solo.getView(R.id.settings));
|
solo.clickOnView(solo.getView(R.id.settings));
|
||||||
solo.clickOnText(context.getString(R.string.setup_title));
|
solo.clickOnText(context.getString(R.string.setup_title));
|
||||||
|
@ -54,15 +83,18 @@ public class AccountsTest extends
|
||||||
|
|
||||||
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
||||||
Assert.assertEquals(nbAccountsBefore + 1, nbAccountsAfter);
|
Assert.assertEquals(nbAccountsBefore + 1, nbAccountsAfter);
|
||||||
|
Log.testSuccess("Configure existing sip.linphone.org account");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeleteConfiguredAccount() {
|
public void testCDeleteConfiguredAccount() {
|
||||||
Context context = getActivity();
|
Context context = getActivity();
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
||||||
|
|
||||||
|
solo.waitForActivity("LinphoneActivity", 2000);
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
|
|
||||||
solo.clickOnView(solo.getView(R.id.settings));
|
solo.clickOnView(solo.getView(R.id.settings));
|
||||||
Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
|
Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
|
||||||
|
|
||||||
|
@ -79,6 +111,71 @@ public class AccountsTest extends
|
||||||
|
|
||||||
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
|
||||||
Assert.assertEquals(nbAccountsBefore - 1, nbAccountsAfter);
|
Assert.assertEquals(nbAccountsBefore - 1, nbAccountsAfter);
|
||||||
|
Log.testSuccess("Deleting existing SIP account");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDTryCreatingExistingAccount() {
|
||||||
|
Context context = getActivity();
|
||||||
|
solo.waitForActivity("LinphoneActivity", 2000);
|
||||||
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
|
|
||||||
|
solo.clickOnView(solo.getView(R.id.settings));
|
||||||
|
solo.clickOnText(context.getString(R.string.setup_title));
|
||||||
|
|
||||||
|
solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
|
||||||
|
|
||||||
|
solo.clickOnView(solo.getView(R.id.setup_next));
|
||||||
|
solo.clickOnText(context.getString(R.string.setup_create_account));
|
||||||
|
|
||||||
|
TextView error = (TextView) solo.getView(R.id.setup_error);
|
||||||
|
ImageView createAccount = (ImageView) solo.getView(R.id.setup_create);
|
||||||
|
int sleepingTime = 1500;
|
||||||
|
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_username), "wi");
|
||||||
|
solo.sleep(sleepingTime);
|
||||||
|
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_username_incorrect));
|
||||||
|
Assert.assertFalse(createAccount.isEnabled());
|
||||||
|
Log.testSuccess("Username incorrect error message");
|
||||||
|
|
||||||
|
solo.clearEditText((EditText) solo.getView(R.id.setup_username));
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard15");
|
||||||
|
solo.sleep(sleepingTime*2);
|
||||||
|
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_username_unavailable));
|
||||||
|
Assert.assertFalse(createAccount.isEnabled());
|
||||||
|
Log.testSuccess("Username already in use error message");
|
||||||
|
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_password), "wi");
|
||||||
|
solo.sleep(sleepingTime);
|
||||||
|
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_password_incorrect));
|
||||||
|
Assert.assertFalse(createAccount.isEnabled());
|
||||||
|
Log.testSuccess("Password incorrect error message");
|
||||||
|
|
||||||
|
solo.clearEditText((EditText) solo.getView(R.id.setup_password));
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard15");
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_password_confirm), "wizard14");
|
||||||
|
solo.sleep(sleepingTime);
|
||||||
|
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_passwords_unmatched));
|
||||||
|
Assert.assertFalse(createAccount.isEnabled());
|
||||||
|
Log.testSuccess("Passwords doesn't match error message");
|
||||||
|
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_email), "wizard15@lin");
|
||||||
|
solo.sleep(sleepingTime);
|
||||||
|
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_email_incorrect));
|
||||||
|
Assert.assertFalse(createAccount.isEnabled());
|
||||||
|
Log.testSuccess("Email incorrect error message");
|
||||||
|
|
||||||
|
solo.clearEditText((EditText) solo.getView(R.id.setup_username));
|
||||||
|
solo.clearEditText((EditText) solo.getView(R.id.setup_password));
|
||||||
|
solo.clearEditText((EditText) solo.getView(R.id.setup_password_confirm));
|
||||||
|
solo.clearEditText((EditText) solo.getView(R.id.setup_email));
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard42");
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard42");
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_password_confirm), "wizard42");
|
||||||
|
solo.enterText((EditText) solo.getView(R.id.setup_email), "wizard15@linphone.org");
|
||||||
|
solo.sleep(sleepingTime);
|
||||||
|
Assert.assertEquals(error.getText(), "");
|
||||||
|
Assert.assertTrue(createAccount.isEnabled());
|
||||||
|
Log.testSuccess("All wizard fields correctly filled");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
11
tests/src/org/linphone/test/Log.java
Normal file
11
tests/src/org/linphone/test/Log.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package org.linphone.test;
|
||||||
|
|
||||||
|
public class Log {
|
||||||
|
public static void testSuccess(String testName) {
|
||||||
|
android.util.Log.wtf("TEST SUCCESS", testName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testFailure(String testName) {
|
||||||
|
android.util.Log.wtf("TEST FAILURE", testName);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue