android-uiautomator

Espresso idling resource not working if long running task is started in Activity's onCreate?

人盡茶涼 提交于 2019-12-11 08:57:06
问题 How to use espresso idling resource if long running task is started in Activity's onCreate ? I have created a custom IdlingResource and it is working fine if the long async method call is triggered by click event, but breaks whenever the it is called in Acitivty's onCreate method. Example: public void onBtnClick(){ setIdle(true); // This works fine, our tests wait until setIdle(false) is called doSomeBackgroundTask(); } public void onDone(){ setResourceIdle(false); setIdle(false); } @Override

How to register broadcast receiver inside instrumentation?

纵饮孤独 提交于 2019-12-11 06:38:26
问题 I am trying to get bluetooth discovery results through an apk which runs as android junit runner. Everything works fine but while registerReciever I get below error. What could be the reason ? java.lang.SecurityException: Given caller package com.ex.test is not running in process ProcessRecord{d740580 19462:com.ex/u0a302} Code- @Test public void demo() throws Exception { Context ctx = InstrumentationRegistry.getInstrumentation().getContext(); BluetoothAdapter mBtAdapter = BluetoothAdapter

Automate the installation of ucbrowser

拟墨画扇 提交于 2019-12-11 04:14:28
问题 I am trying to automate the installation of UC browser. I able to reach to the final "Enter UC" button (below screenshot ) button activity.I need to simulate the click on "Enter UC" button. I tried multiple ways(listed below) to simulate the click but nothing worked out. 1.)Using UIautomator dump - I tried to fetch the dump and parse it to get the bound but when I am fetching the dump using adb shell uiautomator dump , I am not able to get the full complete UI hierarchy (maybe because it

Android: Runtime error while UiTesting

£可爱£侵袭症+ 提交于 2019-12-11 00:00:07
问题 I am trying to run a Ui test, and everytime I run the applicatoin it gives the following error in the console and closes the app that is running. I have the uiautomator.jar, android.jar & JUnit4 libraries imported. Im using Eclipse. What am I missing here? [2016-04-04 04:44:00 - UiTests] Test run failed: Instrumentation run failed due to 'java.lang.RuntimeException' TestClass package android.support.v7.appcompat.test; import com.android.uiautomator.core.UiObject; import com.android

UIAutomator facebook login

醉酒当歌 提交于 2019-12-10 22:33:34
问题 I created a UIAutomator login test for my app, and it works on some of the emulators. Problem is, it doesnt work on all of them. UiObject input = mDevice.findObject(new UiSelector().instance(0).className(EditText.class)); input.setText(getFacebookLoginEmail()); SystemClock.sleep(2000); UiObject input2 = mDevice.findObject(new UiSelector().instance(1).className(EditText.class)); input2.setText(getFacebookLoginPassword()); SystemClock.sleep(2000); UiObject buttonInput = mDevice.findObject(new

Android tests are not executed

谁说我不能喝 提交于 2019-12-10 16:12:50
问题 I have created a test project with exact the same code as shown here: http://developer.android.com/tools/testing/testing_ui.html I have uploaded the jar file in the android virtual device and now I'm ready to run the tests. But I always get this output on the console: INSTRUMENTATION_STATUS: stream= Test results for WatcherResultPrinter= Time: 0.0 OK (0 tests) INSTRUMENTATION_STATUS_CODE: -1 I have also created a simple test with the following code: public void FailedTest() throws

How to run Uiautomator tests in to multiple devices?

空扰寡人 提交于 2019-12-10 15:33:26
问题 I am trying to Uiautomator android Ui tests in a .bat file. but i could not able them run parallelly. Here is my execution flow and have connected 3 devices -> adb devices XXXX XXXX XXXX -> adb push ./bin/UiautomatorTests.jar /data/local/tmp/ -> adb shell uiautomator runtest UiautomatorTests.jar -c com.music.tests Here how can i give a common common command for all the devices to runs with parllely 回答1: You can checkout Uiautomator-bot as it seems to fit your requirement. It can run

uiautomator - cannot get ListView to scroll as I validate text in each list item. it just fails when I hit the last item on screen

杀马特。学长 韩版系。学妹 提交于 2019-12-10 13:17:52
问题 I am trying to validate text in each list item in my ListView and scroll down one by one so I can validate each one... but for some reason I cant get it to continue scrolling through the list validating each element. Has anyone had any luck automating this kind of action.Here is the closest I can come to. Please let me know if this isn't enough info: UiScrollable scrollableList = new UiScrollable(new UiSelector() .resourceId("com.example.app:id/listView") .className(android.widget.ListView

Integrating uiautomator test case with application code in Android

丶灬走出姿态 提交于 2019-12-10 10:18:51
问题 I am using Eclipse IDE. Here is my code for uiautomator testcase: public class caltest extends UiAutomatorTestCase { public void testDemo() throws UiObjectNotFoundException, IOException { //mytesstcode } } To run this test i have to issue following commands from command line: /tools/android create uitest-project -n -t 1 -p Go to the project directory where your build.xml file is located and build your test JAR. ---> ant build Deploy your generated test JAR file to the test device by using the

How to access elements on external website using Espresso

徘徊边缘 提交于 2019-12-09 10:18:40
问题 Using espresso, we click a Login button which launches an external website (Chrome Custom Tab) where you can login and then it redirects back to our android application. Is there a way in Espresso to: 1) Verify the correct URL is being launched 2) Access the elements on the website so that I can enter the login information and continue to login When I try viewing it in the Espresso Launch Navigator, nothing shows up for the page, and if I try to record, it doesn't pick up on me entering