@Test public void testRotateWithDialog() { addDialog(new AlertDialog.Builder(getActivity())); espDevice.rotateToLandscape(); espDevice.assertOrientationIsLandscape(); }
private void givenEditTextToOpenSoftKeyboard() { EditText editText = new EditText(activityTestRule.getActivity()); editText.setId(editTextId); addViewToLayout(editText, BaseActivity.rootLayout); } }
@Test public void testAssertSoftKeyboardIsClosedFailure() { exception.expect(AssertionFailedError.class); exception.expectMessage(containsString("Keyboard should be closed.")); exception.expectMessage(containsString("Expected: is <true>")); exception.expectMessage(containsString("Got: <false>")); givenEditTextToOpenSoftKeyboard(); // other test works and difference is this extra check for initial closed. espDevice.assertSoftKeyboardIsClosed(); espEditText.click(); espDevice.assertSoftKeyboardIsClosed(); }
@Test @Ignore("change orientation works only for current activity but not following activities") public void testKeepRotation() { espDevice.assertOrientationIsPortrait(); espDevice.rotateToLandscape(); espDevice.assertOrientationIsLandscape(); getActivity().startActivity(new Intent(getActivity(), LongListActivity.class)); espDevice.assertOrientationIsLandscape(); }
@Test public void testClickBackButton() { givenButtonToStartNextPage(); startPage.assertIsVisible(); espButton.click(); nextPage.assertIsVisible(); espDevice.clickBackButton(); startPage.assertIsVisible(); }
@Test public void testCloseSoftKeyboard() { givenEditTextToOpenSoftKeyboard(); espDevice.assertSoftKeyboardIsClosed(); espEditText.click(); espDevice.assertSoftKeyboardIsOpen(); espDevice.closeSoftKeyboard(); espDevice.assertSoftKeyboardIsClosed(); }
private void givenButtonToStartNextPage() { Button button = new Button(activityTestRule.getActivity()); button.setText(nextPageButtonText); button.setId(nextPageButtonId); addViewToLayout(button, BaseActivity.rootLayout); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(activityTestRule.getActivity(), LandscapeFixedActivity.class); activityTestRule.getActivity().startActivity(intent); } }); }