Java Code Examples for android.support.test.uiautomator.Configurator.getInstance()

The following are Jave code examples for showing how to use getInstance() of the android.support.test.uiautomator.Configurator class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AppCrawler   File: TestMain.java   View Source Code Vote up 5 votes
@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
Project: AppCrawler   File: TestMain.java   View Source Code Vote up 5 votes
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
Project: android-uiautomator-server   File: ConfiguratorInfo.java   View Source Code Vote up 5 votes
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
Project: android-uiautomator-server   File: ConfiguratorInfo.java   View Source Code Vote up 5 votes
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
Project: UIAutomatorWD   File: Element.java   View Source Code Vote up 4 votes
public void setText(String text) throws UiObjectNotFoundException {
	Configurator config = Configurator.getInstance();
	config.setKeyInjectionDelay(20);
	element.setText(text);
	config.setKeyInjectionDelay(0);
}