android.support.test.uiautomator.Configurator Java Examples

The following examples show how to use android.support.test.uiautomator.Configurator. 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: TestMain.java    From AppCrawler with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    Log.v(TAG, new Exception().getStackTrace()[0].getMethodName() + "()");

    // Get command line parameters
    getArguments();

    // Create screenshot folder
    File path = Environment.getExternalStorageDirectory();
    Config.sOutputDir = new File(String.format("%s/AppCrawler/%s", path.getAbsolutePath(), Config.sTargetPackage));
    deleteRecursive(Config.sOutputDir);
    if (!Config.sOutputDir.exists()) {
        if (!Config.sOutputDir.mkdirs()) {
            Log.d(TAG, "Failed to create screenshot folder: " + Config.sOutputDir.getPath());
        }
    }

    // Init File log
    Config.sFileLog = Config.sOutputDir + "/" + Config.TAG + ".log";
    FileLog.i(TAG_MAIN, "Version: " + Config.VERSION);

    // Init Performance log
    Config.sPerformanceLog = Config.sOutputDir + "/Performance.csv";
    PerformanceMonitor.init();

    //  Set timeout longer so we can see the ANR dialog?
    Configurator conf = Configurator.getInstance();
    conf.setActionAcknowledgmentTimeout(200L); // Generally, this timeout should not be modified, default 3000
    conf.setScrollAcknowledgmentTimeout(100L); // Generally, this timeout should not be modified, default 200
    conf.setWaitForIdleTimeout(0L);
    conf.setWaitForSelectorTimeout(0L);
    //conf.setKeyInjectionDelay(0L);
    logConfiguration();

    // Register UiWatchers: ANR, CRASH, ....
    UiHelper.registerAnrAndCrashWatchers();

    // Good practice to start from the home screen (launcher)
    UiHelper.launchHome();
}
 
Example #2
Source File: TestMain.java    From AppCrawler with Apache License 2.0 5 votes vote down vote up
public static void logConfiguration() {
    Configurator conf = Configurator.getInstance();

    String log = String.format("ActionAcknowledgmentTimeout:%d," +
                    " KeyInjectionDelay:%d, " +
                    "ScrollAcknowledgmentTimeout:%d," +
                    " WaitForIdleTimeout:%d," +
                    " WaitForSelectorTimeout:%d",
            conf.getActionAcknowledgmentTimeout(),
            conf.getKeyInjectionDelay(),
            conf.getScrollAcknowledgmentTimeout(),
            conf.getWaitForIdleTimeout(),
            conf.getWaitForSelectorTimeout());

    FileLog.i(TAG_MAIN, log);

    FileLog.i(TAG_MAIN, "TargetPackage: " + Config.sTargetPackage +
            ", Debug: " + Config.sDebug +
            ", MaxSteps: " + Config.sMaxSteps +
            ", MaxDepth: " + Config.sMaxDepth +
            ", MaxRuntime: " + Config.sMaxRuntime +
            ", MaxScreenshot: " + Config.sMaxScreenshot +
            ", MaxScreenLoop: " + Config.sMaxScreenLoop +
            ", ScreenSignatueLength: " + Config.sScreenSignatueLength +
            ", RandomText: " + Config.sRandomText +
            ", CaptureSteps: " + Config.sCaptureSteps +
            ", LaunchTimeout: " + Config.sLaunchTimeout +
            ", WaitIdleTimeout: " + Config.sWaitIdleTimeout);
}
 
Example #3
Source File: ConfiguratorInfo.java    From android-uiautomator-server with MIT License 5 votes vote down vote up
public ConfiguratorInfo() {
    Configurator config = Configurator.getInstance();
    this._actionAcknowledgmentTimeout = config.getActionAcknowledgmentTimeout();
    this._keyInjectionDelay = config.getKeyInjectionDelay();
    this._scrollAcknowledgmentTimeout = config.getScrollAcknowledgmentTimeout();
    this._waitForIdleTimeout = config.getWaitForIdleTimeout();
    this._waitForSelectorTimeout = config.getWaitForSelectorTimeout();
}
 
Example #4
Source File: ConfiguratorInfo.java    From android-uiautomator-server with MIT License 5 votes vote down vote up
public static void setConfigurator(ConfiguratorInfo info) {
    Configurator config = Configurator.getInstance();
    config.setActionAcknowledgmentTimeout(info.getActionAcknowledgmentTimeout());
    config.setKeyInjectionDelay(info.getKeyInjectionDelay());
    config.setScrollAcknowledgmentTimeout(info.getScrollAcknowledgmentTimeout());
    config.setWaitForIdleTimeout(info.getWaitForIdleTimeout());
    config.setWaitForSelectorTimeout(info.getWaitForSelectorTimeout());
}
 
Example #5
Source File: Element.java    From UIAutomatorWD with MIT License 4 votes vote down vote up
public void setText(String text) throws UiObjectNotFoundException {
	Configurator config = Configurator.getInstance();
	config.setKeyInjectionDelay(20);
	element.setText(text);
	config.setKeyInjectionDelay(0);
}