Last active
September 29, 2020 22:04
-
-
Save FisherKK/6485d9bd62544bb2af45dd4a85dbd092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testFacebook_correctData_enterNotificationCenter() throws Exception { | |
final UiDevice mDevice = | |
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); | |
final int timeOut = 1000 * 60; | |
// Login Activity | |
onView(withId(R.id.btnFacebookLogin)).perform(click()); | |
// Facebook WebView - Page 1 | |
mDevice.wait(Until.findObject(By.clazz(WebView.class)), timeOut); | |
// Set Login | |
UiObject emailInput = mDevice.findObject(new UiSelector() | |
.instance(0) | |
.className(EditText.class)); | |
emailInput.waitForExists(timeOut); | |
emailInput.setText("android_wppcmrq_facebook@tfbnw.net"); | |
// Set Password | |
UiObject passwordInput = mDevice.findObject(new UiSelector() | |
.instance(1) | |
.className(EditText.class)); | |
passwordInput.waitForExists(timeOut); | |
passwordInput.setText("testPassword"); | |
// Confirm Button Click | |
UiObject buttonLogin = mDevice.findObject(new UiSelector() | |
.instance(0) | |
.className(Button.class)); | |
buttonLogin.waitForExists(timeOut); | |
buttonLogin.clickAndWaitForNewWindow(); | |
// Facebook WebView - Page 2 | |
UiObject buttonOk = mDevice.findObject(new UiSelector() | |
.instance(1) | |
.className(Button.class)); | |
buttonOk.waitForExists(timeOut); | |
buttonOk.click(); | |
// should be properly synchronised with Espresso via IdlingResource, | |
// ConditionWatcher or any similar waiting solution | |
Thread.sleep(15000); | |
// NotificationCenter Activity | |
assertThat(getCurrentActivity() instanceof NotificationCenterActivity, is(true)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment