Search in sources :

Example 41 with FlakyTest

use of android.test.FlakyTest in project Quality-Tools-for-Android by stephanenicolas.

the class UIAutomatorSampleTest method testCalculatorApp.

@LargeTest
@FlakyTest(tolerance = TEST_TOLERANCE)
public void testCalculatorApp() throws UiObjectNotFoundException {
    setCurrentTestName("testCalculatorApp");
    startAppOnEmulator("Calculator");
    takeScreenshot("open");
    UiObject deleteButton;
    deleteButton = new UiObject(new UiSelector().text("DELETE"));
    deleteButton.waitForExists(CALCULATOR_UPDATE_TIMEOUT);
    if (!deleteButton.exists()) {
        deleteButton = new UiObject(new UiSelector().text("CLR"));
    }
    deleteButton.waitForExists(CALCULATOR_UPDATE_TIMEOUT);
    deleteButton.click();
    takeScreenshot("after_clear");
    new UiObject(new UiSelector().text("7")).click();
    takeScreenshot("after_7");
    new UiObject(new UiSelector().text("+")).click();
    takeScreenshot("after_plus");
    new UiObject(new UiSelector().text("5")).click();
    takeScreenshot("after_5");
    new UiObject(new UiSelector().text("=")).click();
    takeScreenshot("after_equal");
    assertTrue(new UiObject(new UiSelector().text("12")).waitForExists(CALCULATOR_UPDATE_TIMEOUT));
}
Also used : UiObject(com.android.uiautomator.core.UiObject) UiSelector(com.android.uiautomator.core.UiSelector) FlakyTest(android.test.FlakyTest) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 42 with FlakyTest

use of android.test.FlakyTest in project Quality-Tools-for-Android by stephanenicolas.

the class UIAutomatorSampleTest method testSettingsApp.

@LargeTest
@FlakyTest(tolerance = TEST_TOLERANCE)
public void testSettingsApp() throws UiObjectNotFoundException {
    setCurrentTestName("testSettingsApp");
    startAppOnEmulator("Settings");
    takeScreenshot("open");
    // Validate that the package name is the expected one
    UiObject settingsValidation = new UiObject(new UiSelector().packageName("com.android.settings"));
    assertTrue("Unable to detect Settings", settingsValidation.exists());
}
Also used : UiObject(com.android.uiautomator.core.UiObject) UiSelector(com.android.uiautomator.core.UiSelector) FlakyTest(android.test.FlakyTest) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 43 with FlakyTest

use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.

the class BroadcastTest method testReceive2Sticky.

// Marking flaky until http://b/issue?id=1191337 is resolved
@FlakyTest(tolerance = 2)
public void testReceive2Sticky() throws Exception {
    Intent intent = new Intent(LaunchpadActivity.BROADCAST_STICKY1, null);
    intent.putExtra("test", LaunchpadActivity.DATA_1);
    ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
    intent = new Intent(LaunchpadActivity.BROADCAST_STICKY2, null);
    intent.putExtra("test", LaunchpadActivity.DATA_2);
    ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.myUserId());
    runLaunchpad(LaunchpadActivity.BROADCAST_STICKY2);
}
Also used : Intent(android.content.Intent) FlakyTest(android.test.FlakyTest)

Example 44 with FlakyTest

use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.

the class AutoCompleteTextViewCallbacks method testPopupNoSelection.

/** Test that the initial popup of the suggestions does not select anything.
     */
@FlakyTest(tolerance = 3)
public void testPopupNoSelection() throws Exception {
    AutoCompleteTextViewSimple theActivity = getActivity();
    AutoCompleteTextView textView = theActivity.getTextView();
    final Instrumentation instrumentation = getInstrumentation();
    // focus and type
    textView.requestFocus();
    instrumentation.waitForIdleSync();
    sendKeys("A");
    instrumentation.waitForIdleSync();
    // give UI time to settle
    Thread.sleep(WAIT_TIME);
    // now check for selection callbacks.  Nothing should be clicked or selected.
    assertFalse("onItemClick should not be called", theActivity.mItemClickCalled);
    assertFalse("onItemSelected should not be called", theActivity.mItemSelectedCalled);
// arguably, this should be "false", because we aren't deselecting - we shouldn't
// really be calling it.  But it's not the end of the world, and we might wind up
// breaking something if we change this.
//assertTrue("onNothingSelected should be called", theActivity.mNothingSelectedCalled);
}
Also used : Instrumentation(android.app.Instrumentation) FlakyTest(android.test.FlakyTest)

Example 45 with FlakyTest

use of android.test.FlakyTest in project android_frameworks_base by ParanoidAndroid.

the class AutoCompleteTextViewPopup method testPopupShow.

/** Test the show/hide behavior of the drop-down. */
@FlakyTest(tolerance = 3)
public void testPopupShow() throws Throwable {
    AutoCompleteTextViewSimple theActivity = getActivity();
    final AutoCompleteTextView textView = theActivity.getTextView();
    final Instrumentation instrumentation = getInstrumentation();
    // Drop-down should not be showing when no text has been entered
    assertFalse("isPopupShowing() on start", textView.isPopupShowing());
    // focus and type
    textView.requestFocus();
    instrumentation.waitForIdleSync();
    sendKeys("A");
    // Drop-down should now be visible
    waitAssertPopupShowState("isPopupShowing() after typing", textView, true);
    // Clear the text
    runTestOnUiThread(new Runnable() {

        public void run() {
            textView.setText("");
        }
    });
    instrumentation.waitForIdleSync();
    // Drop-down should be hidden when text is cleared
    waitAssertPopupShowState("isPopupShowing() after text cleared", textView, false);
    // Set the text, without filtering
    runTestOnUiThread(new Runnable() {

        public void run() {
            textView.setText("a", false);
        }
    });
    instrumentation.waitForIdleSync();
    // Drop-down should still be hidden
    waitAssertPopupShowState("isPopupShowing() after setText(\"a\", false)", textView, false);
    // Set the text, now with filtering
    runTestOnUiThread(new Runnable() {

        public void run() {
            textView.setText("a");
        }
    });
    instrumentation.waitForIdleSync();
    // Drop-down should show up after setText() with filtering
    waitAssertPopupShowState("isPopupShowing() after text set", textView, true);
    // TODO: FlakyTest repeat runs will not currently call setUp, clear state
    clearText(textView);
}
Also used : Instrumentation(android.app.Instrumentation) FlakyTest(android.test.FlakyTest)

Aggregations

FlakyTest (android.test.FlakyTest)78 Instrumentation (android.app.Instrumentation)49 Intent (android.content.Intent)13 FeedItem (de.danoeh.antennapod.core.feed.FeedItem)11 Feed (de.danoeh.antennapod.core.feed.Feed)9 ArrayList (java.util.ArrayList)7 File (java.io.File)6 LargeTest (android.test.suitebuilder.annotation.LargeTest)3 UiObject (com.android.uiautomator.core.UiObject)2 UiSelector (com.android.uiautomator.core.UiSelector)2 FeedMedia (de.danoeh.antennapod.core.feed.FeedMedia)2 PlayerStatus (de.danoeh.antennapod.core.service.playback.PlayerStatus)2 PodDBAdapter (de.danoeh.antennapod.core.storage.PodDBAdapter)2 Date (java.util.Date)2 Uri (android.net.Uri)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 AppLink (bolts.AppLink)1 FacebookAppLinkResolver (com.facebook.applinks.FacebookAppLinkResolver)1 SdkSuppress (com.google.android.apps.common.testing.testrunner.annotations.SdkSuppress)1