Fixes in tests

This commit is contained in:
Sylvain Berfini 2012-12-07 12:19:29 +01:00
parent 0f4edff91c
commit 062eda75e7
3 changed files with 15 additions and 12 deletions

View file

@ -17,7 +17,8 @@ import android.widget.ListView;
import com.jayway.android.robotium.solo.Solo;
public class AccountzFreephonieTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
private static final String numberToCallToTestPSTNGateway = "0952636505";
private static final String numberToCallToTestPSTNGateway = "0482532176";
private Solo solo;
@SuppressWarnings("deprecation")
@ -111,7 +112,8 @@ public class AccountzFreephonieTest extends ActivityInstrumentationTestCase2<Lin
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
solo.sleep(2000);
try {
Assert.assertEquals(LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCalls()[0].getState(), LinphoneCall.State.OutgoingEarlyMedia);
LinphoneCall.State state = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCalls()[0].getState();
Assert.assertTrue(state == LinphoneCall.State.OutgoingEarlyMedia || state == LinphoneCall.State.OutgoingRinging || state == LinphoneCall.State.StreamsRunning);
} catch (AssertionError ae) {
} finally {
solo.clickOnView(solo.getView(R.id.hangUp));

View file

@ -169,7 +169,7 @@ public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<Li
solo.enterText((EditText) solo.getView(R.id.Adress), sipAdressToCall);
solo.clickOnView(solo.getView(R.id.Call));
boolean incompatibleMediaParams = solo.waitForText(context.getString(R.string.error_incompatible_media), 1, 1000);
boolean incompatibleMediaParams = solo.waitForText(context.getString(R.string.error_incompatible_media), 1, 1500);
if (!incompatibleMediaParams) { // There is a possiblity the callee doesn't support the codec, in which case we don't have to wait for the incall view
solo.waitForActivity("InCallActivity", 1000);
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
@ -182,7 +182,7 @@ public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<Li
solo.clickOnView(hangUp);
else { // While on video, menu can hide. Click the first time to display it back, then click again to really hang up
solo.clickOnView(hangUp);
solo.sleep(500);
solo.sleep(1000);
solo.clickOnView(hangUp);
}
} else {

View file

@ -13,6 +13,7 @@ import com.jayway.android.robotium.solo.Solo;
public class ChatTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
private static final String testTextMessage = "Test";
private Solo solo;
@SuppressWarnings("deprecation")
@ -48,7 +49,7 @@ public class ChatTest extends ActivityInstrumentationTestCase2<LinphoneActivity>
solo.clickOnText(context.getString(R.string.button_new_chat));
solo.sleep(1000);
solo.enterText((EditText) solo.getView(R.id.message), "Draft");
solo.enterText((EditText) solo.getView(R.id.message), testTextMessage);
solo.goBack();
solo.sleep(1000);
Assert.assertTrue(solo.searchText(context.getString(R.string.draft)));
@ -63,12 +64,12 @@ public class ChatTest extends ActivityInstrumentationTestCase2<LinphoneActivity>
solo.clickOnView(solo.getView(R.id.chat));
solo.clickOnText(context.getString(R.string.draft));
Assert.assertTrue(solo.searchText("Draft"));
Assert.assertTrue(solo.searchText(testTextMessage));
Log.testSuccess("Draft successfully restored");
solo.clickOnText(context.getString(R.string.button_send_message));
solo.sleep(1000);
Assert.assertTrue(solo.searchText("Draft"));
Assert.assertTrue(solo.searchText(testTextMessage));
Log.testSuccess("Chat message sent");
solo.goBack();
@ -86,13 +87,13 @@ public class ChatTest extends ActivityInstrumentationTestCase2<LinphoneActivity>
solo.clickOnView(solo.getView(R.id.chat));
solo.clickOnText("cotcot");
Assert.assertTrue(solo.searchText("Draft"));
solo.clickLongOnText("Draft");
Assert.assertTrue(solo.searchText(testTextMessage));
solo.clickLongOnText(testTextMessage);
solo.sleep(1000);
solo.clickOnText(context.getString(R.string.delete));
solo.sleep(1000);
Assert.assertFalse(solo.searchText("Draft"));
Assert.assertFalse(solo.searchText(testTextMessage));
Log.testSuccess("Chat message successfully deleted");
}
@ -107,11 +108,11 @@ public class ChatTest extends ActivityInstrumentationTestCase2<LinphoneActivity>
solo.clickOnText(context.getString(R.string.button_new_chat));
solo.sleep(1000);
solo.enterText((EditText) solo.getView(R.id.message), "Test");
solo.enterText((EditText) solo.getView(R.id.message), testTextMessage);
solo.clickOnText(context.getString(R.string.button_send_message));
solo.sleep(1000);
Assert.assertTrue(solo.searchText("Test", 2));
Assert.assertTrue(solo.searchText(testTextMessage, 2));
Log.testSuccess("Chat message successfully received");
solo.goBack();