Update ui tests
This commit is contained in:
parent
48a3df183e
commit
8ad53f0dbb
1 changed files with 67 additions and 3 deletions
|
@ -16,17 +16,18 @@ import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
|
|
||||||
import static android.support.test.espresso.Espresso.onData;
|
|
||||||
import static android.support.test.espresso.Espresso.onView;
|
import static android.support.test.espresso.Espresso.onView;
|
||||||
import static android.support.test.espresso.Espresso.pressBack;
|
import static android.support.test.espresso.Espresso.pressBack;
|
||||||
import static android.support.test.espresso.action.ViewActions.click;
|
import static android.support.test.espresso.action.ViewActions.click;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.replaceText;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.scrollTo;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
|
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withTagKey;
|
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||||
import static org.hamcrest.core.AllOf.allOf;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@ -250,6 +251,60 @@ public class LinphoneLauncherActivityTest {
|
||||||
pressBack();
|
pressBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void LoginLinphone() {
|
||||||
|
|
||||||
|
waitUi(2000);
|
||||||
|
|
||||||
|
LinphoneActivity.instance().displayDialer();
|
||||||
|
|
||||||
|
onView(withId(R.id.side_menu_button)).perform(click());
|
||||||
|
|
||||||
|
onView(Matchers.allOf(
|
||||||
|
withId(R.id.item_name),
|
||||||
|
withText(LinphoneActivity.instance().getString(R.string.assistant)),
|
||||||
|
childAtPosition(
|
||||||
|
withId(R.id.item_list),
|
||||||
|
0),
|
||||||
|
isDisplayed())).perform(click());
|
||||||
|
|
||||||
|
ViewInteraction button = onView(
|
||||||
|
Matchers.allOf(withId(R.id.login_linphone),
|
||||||
|
withText(LinphoneActivity.instance().getString(R.string.assistant_login_linphone))));
|
||||||
|
button.perform(scrollTo(), click());
|
||||||
|
|
||||||
|
ViewInteraction checkBox = onView(
|
||||||
|
Matchers.allOf(withId(R.id.use_username)));
|
||||||
|
checkBox.perform(scrollTo(), click());
|
||||||
|
|
||||||
|
ViewInteraction editText = onView(
|
||||||
|
Matchers.allOf(withId(R.id.assistant_username),
|
||||||
|
withParent(withId(R.id.username_layout))));
|
||||||
|
editText.perform(scrollTo(),
|
||||||
|
replaceText(LinphoneActivity.instance().getString(R.string.account_linphone_login)),
|
||||||
|
closeSoftKeyboard());
|
||||||
|
|
||||||
|
ViewInteraction editText2 = onView(
|
||||||
|
Matchers.allOf(withId(R.id.assistant_password),
|
||||||
|
withParent(withId(R.id.password_layout))));
|
||||||
|
editText2.perform(scrollTo(),
|
||||||
|
replaceText(LinphoneActivity.instance().getString(R.string.account_linphone_pwd)),
|
||||||
|
closeSoftKeyboard());
|
||||||
|
|
||||||
|
ViewInteraction button2 = onView(
|
||||||
|
Matchers.allOf(withId(R.id.assistant_apply)));
|
||||||
|
button2.perform(scrollTo(), click());
|
||||||
|
|
||||||
|
waitUi(5000);
|
||||||
|
|
||||||
|
ViewInteraction textView = onView(
|
||||||
|
Matchers.allOf(withId(R.id.assistant_skip)));
|
||||||
|
textView.perform(scrollTo(), click());
|
||||||
|
|
||||||
|
//Delete account
|
||||||
|
deleteDefaultAccount();
|
||||||
|
}
|
||||||
|
|
||||||
private static Matcher<View> childAtPosition(
|
private static Matcher<View> childAtPosition(
|
||||||
final Matcher<View> parentMatcher, final int position) {
|
final Matcher<View> parentMatcher, final int position) {
|
||||||
|
|
||||||
|
@ -268,4 +323,13 @@ public class LinphoneLauncherActivityTest {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteDefaultAccount() {
|
||||||
|
LinphoneProxyConfig proxyCfg = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||||
|
|
||||||
|
if (proxyCfg != null)
|
||||||
|
LinphoneManager.getLc().removeProxyConfig(proxyCfg);
|
||||||
|
if (LinphoneManager.getLc().getProxyConfigList().length == 0)
|
||||||
|
LinphoneManager.getLc().setDefaultProxyConfig(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue