com.robotium.solo.Solo Java Examples

The following examples show how to use com.robotium.solo.Solo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationTest.java    From StepSensor with MIT License 5 votes vote down vote up
/**
 * Set up.
 * Called before each tests.
 *
 * @throws Exception if one
 */
@TargetApi(Build.VERSION_CODES.CUPCAKE)
protected void setUp() throws Exception {
    super.setUp();
    solo = new Solo(getInstrumentation(), getActivity());
    wakeUpScreen();
}
 
Example #2
Source File: RipperTestCase.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Operation done after restart
 */
public void afterRestart() {
	automation.setActivityOrientation(Solo.PORTRAIT);
	sleepAfterTask();
	automation.waitOnThrobber();
	Debug.info(this, "Ready to operate after restarting...");
}
 
Example #3
Source File: BaseTestDashboardFragment.java    From bitmask_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    context = getInstrumentation().getContext();
    solo = new Solo(getInstrumentation(), getActivity());
    Screenshot.initialize(solo);
    user_status_controller = new UserStatusTestController(solo);
    vpn_controller = new VpnTestController(solo);
    ConnectionManager.setMobileDataEnabled(true, context);
    solo.unlockScreen();
    if (solo.searchText(solo.getString(R.string.configuration_wizard_title))) {
        toDashboardAnonymously("demo.bitmask.net");
    }
}
 
Example #4
Source File: RobotiumWrapperRobot.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void changeOrientation()
{
	Display display = ((WindowManager) getInstrumentation().getContext().getSystemService(android.content.Context.WINDOW_SERVICE)).getDefaultDisplay();
	int angle = display.getRotation();
	int newAngle = ((angle==Surface.ROTATION_0)||(angle==Surface.ROTATION_180))?Solo.LANDSCAPE:Solo.PORTRAIT;
	solo.setActivityOrientation(newAngle);
}
 
Example #5
Source File: RobotiumWrapperRobot.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Scroll until the view is on the screen if IN_AND_OUT_OF_FOCUS is enabled or if the force parameter is true
 * 
 * @param v
 * @param force
 */
protected void requestView (final View v, boolean force) {
	if (force) {
		home();
		solo.sendKey(Solo.UP); // Solo.waitForView() requires a widget to be focused		
		solo.waitForView(v, 1000, true);
	}
	requestFocus(v);
}
 
Example #6
Source File: PaymentActivityTest.java    From yandex-money-sdk-android with MIT License 5 votes vote down vote up
private void setUp() {
    Intent intent = PaymentActivity.getBuilder(getInstrumentation().getContext())
            .setPaymentParams(createArguments())
            .setClientId(clientId)
            .setHost(localProperties.getHostUrl())
            .build();
    setActivityIntent(intent);

    solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #7
Source File: RobotiumWrapperRobot.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Initialize Robotium
 * 
 * @param ActivityInstrumentationTestCase2
 */
public RobotiumWrapperRobot(ActivityInstrumentationTestCase2<?> test)
{
	testCase = test;
	solo = new Solo (testCase.getInstrumentation(), testCase.getActivity());
	
	//init widget lists
	this.theViews = new HashMap<Integer,View>();
	this.allViews = new ArrayList<View>();
}
 
Example #8
Source File: ExtSolo.java    From robotium-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated As of release 2.7, replaced by
 * {@link #ExtSolo(Instrumentation inst, Activity activity, String className, String methodName)}
 */
public ExtSolo(Instrumentation inst, Solo solo) {
    super(inst, solo.getCurrentActivity());
    this.inst = inst;
    htmlUtils = new HtmlUtils(this, "unknown", "unknown");
    screenshotUtils = new ScreenshotUtils(this);
    otherUtils = new OtherUtils(this, "unknown", "unknown");
    clicker = new Clicker(this);
    waiter = new Waiter(this);
}
 
Example #9
Source File: AbstractRobotiumTestCase.java    From AndroidStarter with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    mActivity = mActivityTestRule.getActivity();
    mSolo = new Solo(InstrumentationRegistry.getInstrumentation(), mActivity);
    mContextTest = InstrumentationRegistry.getContext();
    mContextTarget = InstrumentationRegistry.getTargetContext();
}
 
Example #10
Source File: EndToEndTestUtils.java    From mytracks with Apache License 2.0 5 votes vote down vote up
/**
 * A setup for debugging end-to-end tests.
 * 
 * @param inst the instrumentation
 * @param activity the track list activity
 */
public static void setupForDebug(Instrumentation inst, TrackListActivity activity) {
  instrumentation = inst;
  trackListActivity = activity;
  SOLO = new Solo(instrumentation, trackListActivity);
  setIsEmulator();
  hasActionBar = setHasActionBar();
  checkLanguage();
}
 
Example #11
Source File: AbstractRobotiumTestCase.java    From AndroidStarterAlt with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    mActivity = mActivityTestRule.getActivity();
    mSolo = new Solo(InstrumentationRegistry.getInstrumentation(), mActivity);
    mContextTest = InstrumentationRegistry.getContext();
    mContextTarget = InstrumentationRegistry.getTargetContext();
}
 
Example #12
Source File: PinFragmentTests.java    From android-pin with MIT License 5 votes vote down vote up
public void testVerifyRotation() {
    final TestActivity activity = getActivityHelper(PinDisplayType.VERIFY);
    mSolo.setActivityOrientation(Solo.PORTRAIT);
    getInstrumentation().waitForIdleSync();
    PinHelper.saveDefaultPin(activity, "1111");

    clickOnKey(Key.ONE, Key.ONE);

    mSolo.setActivityOrientation(Solo.LANDSCAPE);
    getInstrumentation().waitForIdleSync();
    assertPinText("11");

    clickOnKey(Key.ONE, Key.ONE);
    validatedPin(activity);
}
 
Example #13
Source File: PinFragmentTests.java    From android-pin with MIT License 5 votes vote down vote up
public void testCreateWithRotation() {
    final TestActivity activity = getActivityHelper(PinDisplayType.CREATE);
    mSolo.setActivityOrientation(Solo.PORTRAIT);
    getInstrumentation().waitForIdleSync();
    clickOnKey(Key.ONE, Key.ONE);

    mSolo.setActivityOrientation(Solo.LANDSCAPE);
    getInstrumentation().waitForIdleSync();
    assertPinText("11");
    clickOnKey(Key.ONE, Key.ONE);

    confirmCreationWithPin(activity, Key.ONE, Key.ONE, Key.ONE, Key.ONE);
    assertPinSaved("1111");
}
 
Example #14
Source File: TestMainActivityWithRobotium.java    From vb-android-app-quality with Apache License 2.0 5 votes vote down vote up
@Override
public void setUp() throws Exception {
    super.setUp();
    mSolo = new Solo(InstrumentationRegistry.getInstrumentation(), mActivityRule.getActivity());
    mEditText = (EditText) mSolo.getView(R.id.editTextDigits);
    mButtonSendPI = (Button) mSolo.getView(R.id.buttonSendPi);
    mButtonCompute = (Button) mSolo.getView(R.id.buttonCompute);
    mButtonShare = (Button) mSolo.getView(R.id.buttonShareResult);
}
 
Example #15
Source File: FeedTest.java    From coursera-android-labs with MIT License 5 votes vote down vote up
public void testRun() {
	int shortDelay = 5000;
	int longDelay = 10000;

	// Wait for activity:
	// 'course.labs.threadslab.TestFrontEndActivity'
	solo.waitForActivity(course.labs.asynctasklab.MainActivity.class,
			shortDelay);
	
	solo.waitForView(android.R.id.list);
	
	solo.setActivityOrientation(Solo.LANDSCAPE);
	
	solo.waitForActivity(course.labs.asynctasklab.MainActivity.class,
			shortDelay);
	
	solo.waitForView(android.R.id.list);

	final View listView = solo.getView(android.R.id.list);
	solo.waitForCondition(new Condition() {
		@Override
		public boolean isSatisfied() {
			return listView.isEnabled();
		}
	}, longDelay);

	// Click on taylorswift13
	solo.clickOnView(solo.getView(android.R.id.text1));

	// Assert that: 'feed_view' is shown
	assertTrue("feed_view not shown!", solo.waitForView(solo
			.getView(course.labs.asynctasklab.R.id.feed_view)));

	// Assert that: 'Taylor Swift' is shown
	assertTrue("'Taylor Swift' is not shown!",
			solo.searchText("Taylor Swift"));

}
 
Example #16
Source File: ScorePersistenceTest.java    From tedroid with Apache License 2.0 4 votes vote down vote up
@Override
public void setUp() throws Exception {
    solo = new Solo(getInstrumentation(), getActivity());
    TedroidSQLiteOpenHelper.destroyDb(getActivity());
}
 
Example #17
Source File: MainMenuTest.java    From tedroid with Apache License 2.0 4 votes vote down vote up
@Override
public void setUp() throws Exception {
    solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #18
Source File: TestTwoValidLocations.java    From android_coursera_1 with MIT License 4 votes vote down vote up
public void setUp() throws Exception {
	solo = new Solo(getInstrumentation());
	getActivity();
}
 
Example #19
Source File: BaseRxLoaderActivityTest.java    From rxloader with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    testScheduler = new TestScheduler();
    solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #20
Source File: SampleAppInstrumentTest.java    From AndroidGradleStarter with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUp() throws Exception {
    solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #21
Source File: PauseResumeGameTest.java    From tedroid with Apache License 2.0 4 votes vote down vote up
@Override
public void setUp() throws Exception {
    solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #22
Source File: MyActivityRobotium.java    From android-alltest-gradle-sample with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setUp() throws Exception {
  solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #23
Source File: Test3_CancelTest.java    From coursera-android-labs with MIT License 4 votes vote down vote up
public void setUp() throws Exception {
	solo = new Solo(getInstrumentation(),getActivity());
}
 
Example #24
Source File: Test4_ResetTest.java    From coursera-android-labs with MIT License 4 votes vote down vote up
public void setUp() throws Exception {
	solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #25
Source File: Test2_DateTimeTest.java    From coursera-android-labs with MIT License 4 votes vote down vote up
protected void setUp() throws Exception {
	solo = new Solo(getInstrumentation());
	getActivity();
}
 
Example #26
Source File: Test1_SubmitTest.java    From coursera-android-labs with MIT License 4 votes vote down vote up
protected void setUp() throws Exception {
	solo = new Solo(getInstrumentation(),getActivity());
}
 
Example #27
Source File: OldFeedWithNotificationTest.java    From coursera-android-labs with MIT License 4 votes vote down vote up
public void setUp() throws Exception {
	solo = new Solo(getInstrumentation());
	getActivity();
}
 
Example #28
Source File: NewFeedTest.java    From coursera-android-labs with MIT License 4 votes vote down vote up
public void setUp() throws Exception {
	solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #29
Source File: RestartGameTest.java    From tedroid with Apache License 2.0 4 votes vote down vote up
@Override
public void setUp() throws Exception {
    solo = new Solo(getInstrumentation(), getActivity());
}
 
Example #30
Source File: OldFeedNoNotificationTest.java    From coursera-android-labs with MIT License 4 votes vote down vote up
public void setUp() throws Exception {
	solo = new Solo(getInstrumentation(), getActivity());
}