Fix some UI tests

This commit is contained in:
Erwan Croze 2017-07-19 14:17:47 +02:00
parent 2cb3499d4f
commit 294c4c3e21
7 changed files with 166 additions and 135 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="account_linphone_login">wizard15</string> <string name="account_linphone_login">wizard15</string>
<string name="account_linphone_pwd">wizard15</string> <string name="account_linphone_pwd">wizard15</string>
<string name="account_linphone_domain">sip.linphone.org</string> <string name="account_linphone_domain">sip.linphone.org</string>
@ -9,24 +9,27 @@
<string name="account_generic_login">wizard15</string> <string name="account_generic_login">wizard15</string>
<string name="account_generic_pwd">wizard15</string> <string name="account_generic_pwd">wizard15</string>
<string name="account_generic_domain">test.linphone.org</string> <string name="account_generic_domain">test.linphone.org</string>
<string name="account_create_login">wizard42</string> <string name="account_create_login">wizard42</string>
<string name="account_create_pwd">wizard42</string> <string name="account_create_pwd">wizard42</string>
<string name="account_create_email">wizard42@linphone.org</string> <string name="account_create_email">wizard42@linphone.org</string>
<string name="account_create_country_name">france</string>
<string name="account_create_country_code">33</string>
<string name="account_create_phone_number">12345678</string>
<string name="account_test_calls_login">wizard13</string> <string name="account_test_calls_login">wizard13</string>
<string name="account_test_calls_pwd">wizard13</string> <string name="account_test_calls_pwd">wizard13</string>
<string name="account_test_calls_domain">sip.linphone.org</string> <string name="account_test_calls_domain">sip.linphone.org</string>
<string name="contact_name">Wizard</string> <string name="contact_name">Wizard</string>
<string name="contact_number">+33952636505</string> <string name="contact_number">+33952636505</string>
<string name="contact_sip">wizard@sip.linphone.org</string> <string name="contact_sip">wizard@sip.linphone.org</string>
<string name="chat_test_text_sent">Ping!</string> <string name="chat_test_text_sent">Ping!</string>
<string name="chat_test_text_received">Pong!</string> <string name="chat_test_text_received">Pong!</string>
<string name="conference_account_login">wizard16</string> <string name="conference_account_login">wizard16</string>
<string name="conference_account_password">wizard16</string> <string name="conference_account_password">wizard16</string>
<string name="conference_account_domain">sip.linphone.org</string> <string name="conference_account_domain">sip.linphone.org</string>
</resources> </resources>

View file

@ -3,6 +3,7 @@ package org.linphone;
import junit.framework.Assert; import junit.framework.Assert;
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.AssistantActivity;
import org.linphone.core.LinphoneNatPolicy;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneProxyConfig;
import org.linphone.mediastream.video.capture.hwconf.Hacks; import org.linphone.mediastream.video.capture.hwconf.Hacks;
@ -10,7 +11,6 @@ import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.SmallTest;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Button; import android.widget.Button;
@ -40,9 +40,8 @@ public class AccountAssistant extends SampleTest {
solo.enterText((EditText) solo.getView(R.id.assistant_username), aContext.getString(R.string.account_linphone_login)); solo.enterText((EditText) solo.getView(R.id.assistant_username), aContext.getString(R.string.account_linphone_login));
solo.enterText((EditText) solo.getView(R.id.assistant_password), aContext.getString(R.string.account_linphone_pwd)); solo.enterText((EditText) solo.getView(R.id.assistant_password), aContext.getString(R.string.account_linphone_pwd));
solo.clickOnView(solo.getView(R.id.assistant_apply)); solo.clickOnView(solo.getView(R.id.assistant_apply));
solo.sleep(3000);
solo.clickOnView(solo.getView(R.id.assistant_skip)); solo.clickOnView(solo.getView(R.id.assistant_skip));
solo.sleep(1000); solo.sleep(1000);
//Test download openh264 //Test download openh264
@ -61,8 +60,9 @@ public class AccountAssistant extends SampleTest {
waitForRegistration(proxyConfig); waitForRegistration(proxyConfig);
//Check the wizard added sip.linphone.org custom settings //Check the wizard added sip.linphone.org custom settings
LinphoneNatPolicy natPolicy = proxyConfig.getNatPolicy();
LinphonePreferences prefs = LinphonePreferences.instance(); LinphonePreferences prefs = LinphonePreferences.instance();
String stunServer = prefs.getStunServer(); String stunServer = natPolicy.getStunServer();
Assert.assertEquals(aContext.getString(R.string.default_stun), stunServer); Assert.assertEquals(aContext.getString(R.string.default_stun), stunServer);
String transport = prefs.getAccountTransportKey(0); String transport = prefs.getAccountTransportKey(0);
@ -74,7 +74,7 @@ public class AccountAssistant extends SampleTest {
String username = prefs.getAccountUsername(0); String username = prefs.getAccountUsername(0);
Assert.assertEquals(aContext.getString(R.string.account_linphone_login), username); Assert.assertEquals(aContext.getString(R.string.account_linphone_login), username);
boolean ice = prefs.isIceEnabled(); boolean ice = natPolicy.iceEnabled();
Assert.assertEquals(ice, true); Assert.assertEquals(ice, true);
} }
@ -109,56 +109,99 @@ public class AccountAssistant extends SampleTest {
@LargeTest @LargeTest
public void testECreateNewAccount() { public void testECreateNewAccount() {
int sleepingTime = 1500;
startAssistant(); startAssistant();
solo.clickOnView(solo.getView(R.id.create_account)); solo.clickOnView(solo.getView(R.id.create_account));
solo.enterText((EditText) solo.getView(R.id.username), iContext.getString(R.string.account_create_login).substring(0, 2)); if (aContext.getResources().getBoolean(R.bool.isTablet)) {
solo.sleep(200); solo.enterText((EditText) solo.getView(R.id.username), iContext.getString(R.string.account_create_login).substring(0, 2));
TextView error = (TextView) solo.getView(R.id.username_error); solo.sleep(200);
int sleepingTime = 1500; TextView error = (TextView) solo.getView(R.id.username_error);
Button createAccount = (Button) solo.getView(R.id.assistant_create); Button createAccount = (Button) solo.getView(R.id.assistant_create);
Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_username_incorrect)); Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_username_incorrect));
Assert.assertFalse(createAccount.isEnabled()); Assert.assertFalse(createAccount.isEnabled());
solo.clearEditText((EditText) solo.getView(R.id.username)); solo.clearEditText((EditText) solo.getView(R.id.username));
solo.enterText((EditText) solo.getView(R.id.username), iContext.getString(R.string.account_linphone_login)); solo.enterText((EditText) solo.getView(R.id.username), iContext.getString(R.string.account_linphone_login));
solo.sleep(sleepingTime * 2); solo.sleep(sleepingTime * 2);
Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_username_unavailable)); Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_username_unavailable));
Assert.assertFalse(createAccount.isEnabled()); Assert.assertFalse(createAccount.isEnabled());
solo.enterText((EditText) solo.getView(R.id.password), iContext.getString(R.string.account_create_pwd).substring(0, 2)); solo.enterText((EditText) solo.getView(R.id.password), iContext.getString(R.string.account_create_pwd).substring(0, 2));
solo.sleep(sleepingTime); solo.sleep(sleepingTime);
error = (TextView) solo.getView(R.id.confirm_password_error); error = (TextView) solo.getView(R.id.confirm_password_error);
Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_passwords_unmatched)); Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_passwords_unmatched));
Assert.assertFalse(createAccount.isEnabled()); Assert.assertFalse(createAccount.isEnabled());
solo.clearEditText((EditText) solo.getView(R.id.password)); solo.clearEditText((EditText) solo.getView(R.id.password));
solo.enterText((EditText) solo.getView(R.id.password), iContext.getString(R.string.account_create_pwd).substring(0, 2)); solo.enterText((EditText) solo.getView(R.id.password), iContext.getString(R.string.account_create_pwd).substring(0, 2));
solo.enterText((EditText) solo.getView(R.id.confirm_password), iContext.getString(R.string.account_create_pwd).substring(0,2)); solo.enterText((EditText) solo.getView(R.id.confirm_password), iContext.getString(R.string.account_create_pwd).substring(0, 2));
solo.sleep(sleepingTime); solo.sleep(sleepingTime);
error = (TextView) solo.getView(R.id.password_error); error = (TextView) solo.getView(R.id.password_error);
Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_password_incorrect)); Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_password_incorrect));
Assert.assertFalse(createAccount.isEnabled()); Assert.assertFalse(createAccount.isEnabled());
solo.enterText((EditText) solo.getView(R.id.email), iContext.getString(R.string.account_create_email).substring(0, 12)); solo.enterText((EditText) solo.getView(R.id.email), iContext.getString(R.string.account_create_email).substring(0, 12));
solo.sleep(sleepingTime); solo.sleep(sleepingTime);
error = (TextView) solo.getView(R.id.email_error); error = (TextView) solo.getView(R.id.email_error);
Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_email_incorrect)); Assert.assertEquals(error.getText(), aContext.getString(R.string.wizard_email_incorrect));
Assert.assertFalse(createAccount.isEnabled()); Assert.assertFalse(createAccount.isEnabled());
solo.clearEditText((EditText) solo.getView(R.id.username)); solo.clearEditText((EditText) solo.getView(R.id.username));
solo.clearEditText((EditText) solo.getView(R.id.password)); solo.clearEditText((EditText) solo.getView(R.id.password));
solo.clearEditText((EditText) solo.getView(R.id.confirm_password)); solo.clearEditText((EditText) solo.getView(R.id.confirm_password));
solo.clearEditText((EditText) solo.getView(R.id.email)); solo.clearEditText((EditText) solo.getView(R.id.email));
solo.enterText((EditText) solo.getView(R.id.username), iContext.getString(R.string.account_create_login)); solo.enterText((EditText) solo.getView(R.id.username), iContext.getString(R.string.account_create_login));
solo.enterText((EditText) solo.getView(R.id.password), iContext.getString(R.string.account_create_pwd)); solo.enterText((EditText) solo.getView(R.id.password), iContext.getString(R.string.account_create_pwd));
solo.enterText((EditText) solo.getView(R.id.confirm_password), iContext.getString(R.string.account_create_pwd)); solo.enterText((EditText) solo.getView(R.id.confirm_password), iContext.getString(R.string.account_create_pwd));
solo.enterText((EditText) solo.getView(R.id.email), iContext.getString(R.string.account_create_email)); solo.enterText((EditText) solo.getView(R.id.email), iContext.getString(R.string.account_create_email));
solo.sleep(sleepingTime); solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), ""); Assert.assertEquals(error.getText(), "");
Assert.assertTrue(createAccount.isEnabled()); Assert.assertTrue(createAccount.isEnabled());
} else {
solo.clickOnView(solo.getView(R.id.select_country));
solo.enterText((EditText) solo.getView(R.id.search_country), aContext.getString(R.string.account_create_country_name));
solo.sleep(500);
solo.clickInList(0);
solo.sleep(500);
Assert.assertEquals(((Button)solo.getView(R.id.select_country)).getText().toString().toLowerCase(),
aContext.getString(R.string.account_create_country_name).toLowerCase());
Assert.assertEquals(((EditText)solo.getView(R.id.dial_code)).getText().toString(),
"+"+aContext.getString(R.string.account_create_country_code));
Assert.assertEquals(((TextView)solo.getView(R.id.sip_uri)).getText().toString(), "");
solo.enterText((EditText) solo.getView(R.id.phone_number),
aContext.getString(R.string.account_create_phone_number).substring(2));
Assert.assertEquals(((TextView)solo.getView(R.id.phone_number_error)).getText().toString(),
aContext.getString(R.string.phone_number_too_short));
solo.clearEditText((EditText) solo.getView(R.id.phone_number));
solo.enterText((EditText) solo.getView(R.id.phone_number), aContext.getString(R.string.account_create_phone_number)+"1234");
Assert.assertEquals(((TextView)solo.getView(R.id.phone_number_error)).getText().toString(),
aContext.getString(R.string.phone_number_too_long));
solo.clearEditText((EditText) solo.getView(R.id.phone_number));
solo.enterText((EditText) solo.getView(R.id.phone_number), aContext.getString(R.string.account_create_phone_number));
Assert.assertEquals(((TextView)solo.getView(R.id.phone_number_error)).getText().toString(), "");
Assert.assertEquals(((TextView)solo.getView(R.id.sip_uri)).getText().toString(),
aContext.getString(R.string.assistant_create_account_phone_number_address)
+ " <" + "+" + aContext.getString(R.string.account_create_country_code)
+ aContext.getString(R.string.account_create_phone_number)
+ "@" + aContext.getString(R.string.default_domain) + ">");
solo.clickOnView(solo.getView(R.id.use_username));
Assert.assertEquals(((TextView)solo.getView(R.id.sip_uri)).getText().toString(), "");
solo.enterText((EditText) solo.getView(R.id.username), aContext.getString(R.string.account_create_login));
Assert.assertEquals(((TextView)solo.getView(R.id.sip_uri)).getText().toString(),
aContext.getString(R.string.assistant_create_account_phone_number_address)
+ " <" + aContext.getString(R.string.account_create_login)
+ "@" + aContext.getString(R.string.default_domain) + ">");
Button createAccount = (Button) solo.getView(R.id.assistant_create);
Assert.assertTrue(createAccount.isEnabled());
}
} }
@LargeTest @LargeTest

View file

@ -2,11 +2,6 @@ package org.linphone;
import junit.framework.Assert; import junit.framework.Assert;
import org.linphone.CallActivity;
import org.linphone.CallIncomingActivity;
import org.linphone.CallOutgoingActivity;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreException;
@ -15,8 +10,13 @@ import org.linphone.core.PayloadType;
import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.SmallTest;
import android.util.DisplayMetrics; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import static android.test.TouchUtils.dragViewToX;
import static android.view.Gravity.CENTER_HORIZONTAL;
import static android.view.Gravity.CENTER_VERTICAL;
/** /**
* @author Sylvain Berfini * @author Sylvain Berfini
@ -61,7 +61,9 @@ public class CallsAudio extends SampleTest {
@LargeTest @LargeTest
public void testCDTMFRFC2833InPCMUCall() { public void testCDTMFRFC2833InPCMUCall() {
disableAllEnabledAudioCodecs(); disableAllEnabledAudioCodecs();
solo.scrollUp();
solo.clickOnText("PCMU"); solo.clickOnText("PCMU");
solo.sleep(500);
goBackToDialerAfterCodecChanges(); goBackToDialerAfterCodecChanges();
solo.sleep(1000); solo.sleep(1000);
@ -160,7 +162,8 @@ public class CallsAudio extends SampleTest {
LinphoneTestManager.getInstance().autoAnswer = true; LinphoneTestManager.getInstance().autoAnswer = true;
solo.clickOnView(solo.getView(R.id.outgoing_hang_up)); ImageView hangUp = (ImageView) solo.getView(R.id.outgoing_hang_up);
solo.clickOnView(hangUp);
solo.waitForActivity("LinphoneActivity", 5000); solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
} }
@ -201,15 +204,8 @@ public class CallsAudio extends SampleTest {
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class); solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
solo.sleep(1000); solo.sleep(1000);
/*View topLayout = solo.getView(R.id.topLayout); dragViewToX(this, solo.getView(R.id.accept), Gravity.CENTER_HORIZONTAL, 0);
int topLayoutHeigh = topLayout.getMeasuredHeight(); getInstrumentation().waitForIdleSync();
DisplayMetrics dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
int topOffset = dm.heightPixels - topLayoutHeigh;
int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);*/
solo.clickOnView(solo.getView(R.id.accept));
assertCallIsCorrectlyRunning(); assertCallIsCorrectlyRunning();
} }
@ -228,16 +224,9 @@ public class CallsAudio extends SampleTest {
solo.waitForActivity("CallIncomingActivity", 5000); solo.waitForActivity("CallIncomingActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class); solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
/*solo.sleep(1000); solo.sleep(1000);
View topLayout = solo.getView(R.id.topLayout); dragViewToX(this, solo.getView(R.id.accept), Gravity.CENTER_HORIZONTAL, 0);
int topLayoutHeigh = topLayout.getMeasuredHeight(); getInstrumentation().waitForIdleSync();
DisplayMetrics dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
int topOffset = dm.heightPixels - topLayoutHeigh;
int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);*/
solo.clickOnView(solo.getView(R.id.accept));
assertCallIsCorrectlyRunning(); assertCallIsCorrectlyRunning();
} }
@ -319,13 +308,10 @@ public class CallsAudio extends SampleTest {
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class); solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
solo.sleep(1000); solo.sleep(1000);
View topLayout = solo.getView(R.id.topLayout); View topLayout = solo.getView(R.id.topLayout);
int topLayoutHeigh = topLayout.getMeasuredHeight(); dragViewToX(this, solo.getView(R.id.decline), Gravity.CENTER_HORIZONTAL, topLayout.getMeasuredWidth());
DisplayMetrics dm = new DisplayMetrics(); getInstrumentation().waitForIdleSync();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
int topOffset = dm.heightPixels - topLayoutHeigh;
int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
solo.drag(topLayout.getMeasuredWidth() - 10, 10, slidersTop, slidersTop, 10);
} }
@MediumTest @MediumTest
@ -420,6 +406,16 @@ public class CallsAudio extends SampleTest {
solo.sleep(500); solo.sleep(500);
} }
if (isAudioCodecEnabled("PCMU", 8000)) {
solo.clickOnText("PCMU");
solo.sleep(500);
}
if (isAudioCodecEnabled("PCMA", 8000)) {
solo.clickOnText("PCMA");
solo.sleep(500);
}
if (isAudioCodecEnabled("iLBC", 8000)) { if (isAudioCodecEnabled("iLBC", 8000)) {
solo.clickOnText("iLBC"); solo.clickOnText("iLBC");
solo.sleep(500); solo.sleep(500);
@ -464,16 +460,6 @@ public class CallsAudio extends SampleTest {
solo.clickOnText("SILK", 2); solo.clickOnText("SILK", 2);
solo.sleep(500); solo.sleep(500);
} }
if (isAudioCodecEnabled("PCMU", 8000)) {
solo.clickOnText("PCMU");
solo.sleep(500);
}
if (isAudioCodecEnabled("PCMA", 8000)) {
solo.clickOnText("PCMA");
solo.sleep(500);
}
} }
private void goBackToDialerAfterCodecChanges() { private void goBackToDialerAfterCodecChanges() {

View file

@ -17,8 +17,13 @@ import android.test.suitebuilder.annotation.SmallTest;
import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.MediumTest;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View; import android.view.View;
import static android.test.TouchUtils.dragViewToX;
import static android.view.Gravity.CENTER_HORIZONTAL;
import static android.view.Gravity.CENTER_VERTICAL;
/** /**
* @author Sylvain Berfini * @author Sylvain Berfini
*/ */
@ -72,7 +77,9 @@ public class CallsVideo extends SampleTest {
@LargeTest @LargeTest
public void testCDTMFRFC2833InPCMUCall() { public void testCDTMFRFC2833InPCMUCall() {
disableAllEnabledAudioCodecs(); disableAllEnabledAudioCodecs();
solo.scrollUp();
solo.clickOnText("PCMU"); solo.clickOnText("PCMU");
solo.sleep(500);
goBackToDialerAfterCodecChanges(); goBackToDialerAfterCodecChanges();
solo.sleep(1000); solo.sleep(1000);
@ -175,7 +182,7 @@ public class CallsVideo extends SampleTest {
LinphoneTestManager.getInstance().autoAnswer = true; LinphoneTestManager.getInstance().autoAnswer = true;
solo.clickOnView(solo.getView(R.id.hang_up)); solo.clickOnView(solo.getView(R.id.outgoing_hang_up));
solo.waitForActivity("LinphoneActivity", 5000); solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
} }
@ -213,7 +220,8 @@ public class CallsVideo extends SampleTest {
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class); solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
solo.sleep(1000); solo.sleep(1000);
solo.clickOnView(solo.getView(R.id.accept)); dragViewToX(this, solo.getView(R.id.accept), Gravity.CENTER_HORIZONTAL, 0);
getInstrumentation().waitForIdleSync();
assertCallIsCorrectlyRunning(); assertCallIsCorrectlyRunning();
} }
@ -234,7 +242,10 @@ public class CallsVideo extends SampleTest {
solo.waitForActivity("IncomingCallActivity", 5000); solo.waitForActivity("IncomingCallActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class); solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
solo.clickOnView(solo.getView(R.id.accept));
solo.sleep(1000);
dragViewToX(this, solo.getView(R.id.accept), Gravity.CENTER_HORIZONTAL, 0);
getInstrumentation().waitForIdleSync();
assertCallIsCorrectlyRunning(); assertCallIsCorrectlyRunning();
assertCallIsRunningWithVideo(); assertCallIsRunningWithVideo();
@ -259,18 +270,18 @@ public class CallsVideo extends SampleTest {
assertCallIsCorrectlyRunning(); assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(R.id.video_frame)); solo.clickOnView(solo.getView(R.id.active_call));
solo.clickOnView(solo.getView(R.id.pause)); solo.clickOnView(solo.getView(R.id.pause));
solo.sleep(1000); solo.sleep(1000);
waitForCallPaused(LinphoneManager.getLc().getCalls()[0]); waitForCallPaused(LinphoneManager.getLc().getCalls()[0]);
solo.clickOnView(solo.getView(R.id.video_frame)); solo.clickOnView(solo.getView(R.id.active_call));
solo.clickOnView(solo.getView(R.id.call_pause)); solo.clickOnView(solo.getView(R.id.call_pause));
solo.sleep(1000); solo.sleep(1000);
waitForCallResumed(LinphoneManager.getLc().getCalls()[0]); waitForCallResumed(LinphoneManager.getLc().getCalls()[0]);
solo.clickOnView(solo.getView(R.id.video_frame)); solo.clickOnView(solo.getView(R.id.active_call));
solo.clickOnView(solo.getView(R.id.hang_up)); solo.clickOnView(solo.getView(R.id.hang_up));
solo.waitForActivity("LinphoneActivity", 5000); solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
@ -288,13 +299,13 @@ public class CallsVideo extends SampleTest {
solo.sleep(1000); solo.sleep(1000);
waitForCallState(LinphoneManager.getLc().getCalls()[0], LinphoneCall.State.PausedByRemote); waitForCallState(LinphoneManager.getLc().getCalls()[0], LinphoneCall.State.PausedByRemote);
solo.clickOnView(solo.getView(R.id.video_frame)); solo.clickOnView(solo.getView(R.id.active_call));
LinphoneTestManager.getLc().resumeCall(LinphoneTestManager.getLc().getCalls()[0]); LinphoneTestManager.getLc().resumeCall(LinphoneTestManager.getLc().getCalls()[0]);
solo.sleep(1000); solo.sleep(1000);
waitForCallResumed(LinphoneManager.getLc().getCalls()[0]); waitForCallResumed(LinphoneManager.getLc().getCalls()[0]);
solo.clickOnView(solo.getView(R.id.video_frame)); solo.clickOnView(solo.getView(R.id.active_call));
solo.clickOnView(solo.getView(R.id.hang_up)); solo.clickOnView(solo.getView(R.id.hang_up));
solo.waitForActivity("LinphoneActivity", 5000); solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
@ -395,6 +406,16 @@ public class CallsVideo extends SampleTest {
solo.sleep(500); solo.sleep(500);
} }
if (isAudioCodecEnabled("PCMU", 8000)) {
solo.clickOnText("PCMU");
solo.sleep(500);
}
if (isAudioCodecEnabled("PCMA", 8000)) {
solo.clickOnText("PCMA");
solo.sleep(500);
}
if (isAudioCodecEnabled("iLBC", 8000)) { if (isAudioCodecEnabled("iLBC", 8000)) {
solo.clickOnText("iLBC"); solo.clickOnText("iLBC");
solo.sleep(500); solo.sleep(500);
@ -440,15 +461,7 @@ public class CallsVideo extends SampleTest {
solo.sleep(500); solo.sleep(500);
} }
if (isAudioCodecEnabled("PCMU", 8000)) {
solo.clickOnText("PCMU");
solo.sleep(500);
}
if (isAudioCodecEnabled("PCMA", 8000)) {
solo.clickOnText("PCMA");
solo.sleep(500);
}
} }
private boolean isVideoCodecEnabled(String mime) { private boolean isVideoCodecEnabled(String mime) {

View file

@ -30,6 +30,7 @@ public class Chat extends SampleTest {
LinphoneChatRoom[] chats = LinphoneTestManager.getInstance().getLc().getChatRooms(); LinphoneChatRoom[] chats = LinphoneTestManager.getInstance().getLc().getChatRooms();
for (LinphoneChatRoom chatroom : chats) { for (LinphoneChatRoom chatroom : chats) {
chatroom.markAsRead();
chatroom.deleteHistory(); chatroom.deleteHistory();
} }
@ -76,13 +77,7 @@ public class Chat extends SampleTest {
LinphoneChatRoom chatRoom = LinphoneTestManager.getLc().getOrCreateChatRoom("sip:" + iContext.getString(R.string.account_linphone_login) + "@" + iContext.getString(R.string.account_linphone_domain)); LinphoneChatRoom chatRoom = LinphoneTestManager.getLc().getOrCreateChatRoom("sip:" + iContext.getString(R.string.account_linphone_login) + "@" + iContext.getString(R.string.account_linphone_domain));
LinphoneChatMessage msg = chatRoom.createLinphoneChatMessage(iContext.getString(R.string.chat_test_text_received)); LinphoneChatMessage msg = chatRoom.createLinphoneChatMessage(iContext.getString(R.string.chat_test_text_received));
chatRoom.sendMessage(msg, new LinphoneChatMessage.StateListener() { chatRoom.sendChatMessage(msg);
@Override
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg,
State state) {
Log.e("Chat message state = " + state.toString());
}
});
solo.sleep(1000); solo.sleep(1000);
Assert.assertTrue(solo.searchText(iContext.getString(R.string.chat_test_text_received))); Assert.assertTrue(solo.searchText(iContext.getString(R.string.chat_test_text_received)));

View file

@ -16,8 +16,11 @@ import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.SmallTest;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View; import android.view.View;
import static android.test.TouchUtils.dragViewToX;
public class ConferenceAndMultiCall extends SampleTest { public class ConferenceAndMultiCall extends SampleTest {
@SmallTest @SmallTest
@ -67,7 +70,6 @@ public class ConferenceAndMultiCall extends SampleTest {
solo.clickOnView(solo.getView(R.id.hang_up)); solo.clickOnView(solo.getView(R.id.hang_up));
solo.sleep(1000); solo.sleep(1000);
solo.clickOnView(solo.getView(R.id.hang_up));
solo.waitForActivity("LinphoneActivity", 5000); solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
} }
@ -192,18 +194,15 @@ public class ConferenceAndMultiCall extends SampleTest {
solo.assertCurrentActivity("Expected Incoming call Activity", CallIncomingActivity.class); solo.assertCurrentActivity("Expected Incoming call Activity", CallIncomingActivity.class);
solo.sleep(1000); solo.sleep(1000);
View topLayout = solo.getView(R.id.topLayout); dragViewToX(this, solo.getView(R.id.accept), Gravity.CENTER_HORIZONTAL, 0);
int topLayoutHeigh = topLayout.getMeasuredHeight(); getInstrumentation().waitForIdleSync();
DisplayMetrics dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
int topOffset = dm.heightPixels - topLayoutHeigh;
int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
solo.drag(topLayout.getMeasuredWidth() - 10, 10, slidersTop, slidersTop, 10);
assertCallIsCorrectlyRunning(1); assertCallIsCorrectlyRunning(1);
solo.sleep(2000); solo.sleep(2000);
solo.clickOnView(solo.getView(R.id.hang_up)); solo.clickOnView(solo.getView(R.id.hang_up));
solo.sleep(1000);
solo.clickOnView(solo.getView(R.id.hang_up));
solo.waitForActivity("LinphoneActivity", 5000); solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
} }
@ -226,13 +225,8 @@ public class ConferenceAndMultiCall extends SampleTest {
solo.assertCurrentActivity("Expected Incoming call Activity", CallIncomingActivity.class); solo.assertCurrentActivity("Expected Incoming call Activity", CallIncomingActivity.class);
solo.sleep(1000); solo.sleep(1000);
View topLayout = solo.getView(R.id.topLayout); dragViewToX(this, solo.getView(R.id.accept), Gravity.CENTER_HORIZONTAL, 0);
int topLayoutHeigh = topLayout.getMeasuredHeight(); getInstrumentation().waitForIdleSync();
DisplayMetrics dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
int topOffset = dm.heightPixels - topLayoutHeigh;
int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
solo.sleep(1000); solo.sleep(1000);
LinphoneCall call1 = LinphoneTestManager.getLc(1).getCalls()[0]; LinphoneCall call1 = LinphoneTestManager.getLc(1).getCalls()[0];

View file

@ -1,7 +1,5 @@
package org.linphone; package org.linphone;
import org.linphone.LinphoneLauncherActivity;
import org.linphone.LinphoneManager;
import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore;
@ -11,7 +9,6 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import android.content.Context; import android.content.Context;
import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityInstrumentationTestCase2;
import android.widget.ListView; import android.widget.ListView;
import java.util.List;
import com.robotium.solo.Condition; import com.robotium.solo.Condition;
import com.robotium.solo.Solo; import com.robotium.solo.Solo;