anistn / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Webview support always times out on first test on devices pre Android 4.4 #165

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a test that tries to enter text into a web view on an emulator (used 
genymotion and offical emulator pre-4.4)
2. Run the test.

What is the expected output? What do you see instead?
I would expect that all tests would all pass successfully.

However, it seems the first test that tries an assertion always fails with a 
timeout, but the following tests run fine. What I've done to run successfully 
in this example is to create a test that runs first that just does onWebView(), 
this seems to initialize something that allows following tests to run. To 
replicate this, comment out the last line in SimpleEspressTest.firstTest()

What version of the product are you using? On what operating system?
espresso 2.2, Mac OSX, Genymotion S4 - 4.3, Nexus 4 emulator x86 4.2.2

Please provide any additional information below.

Please see attached zip for a sample project, If you comment the last line in 
SimpleEspressoTest.firstTest, all tests will pass. Use ./gradlew 
connectedAndroidTestDebug to run

Original issue reported on code.google.com by brian.pa...@gmail.com on 10 Jul 2015 at 1:35

Attachments:

GoogleCodeExporter commented 9 years ago
Update to get around the issue you can call

    @BeforeClass
    public static void espressoHack(){
        // For some reason, the way we are set up doesn't seem to initalize
        // javascript correctly - so lets make sure it happens.
        Handler mainHandler = new Handler(Looper.getMainLooper());
        mainHandler.post(new Runnable() {
            @Override
            public void run() {
                JavaScriptBridge.installBridge();
            }
        });
    }

directly as a workaround in the interim.

Original comment by brian.pa...@gmail.com on 15 Jul 2015 at 11:42

GoogleCodeExporter commented 9 years ago
This is fixed in the next release, there is a synchronization issue with 
installing of the JS bridge.

Original comment by slinz...@google.com on 24 Jul 2015 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by slinz...@google.com on 15 Sep 2015 at 10:58