Search code examples
androidcordovaamazon-web-serviceswebviewaws-device-farm

Calabash for Cordova Android app on AWS Device Farm, correct webview name?


I'm running into trouble trying to write Calabash tests for a Cordova application. webView and cordovaWebView do not work for me locally or on AWS.


Code variation that does work locally when I run against a device:

Then(/^I entered text "(.*?)" into input with id "(.*?)"$/) do |arg1, arg2|
    enter_text("SystemWebView css:'##{arg2}'", arg1)
end

However, on AWS it gives me this error:

map SystemWebView css:'#login-email', query failed because: java.util.concurrent.ExecutionException: java.lang.ClassCastException: sh.calaba.instrumentationbackend.actions.webview.CalabashChromeClient cannot be cast to org.apache.cordova.engine.SystemWebChromeClient (RuntimeError) (RuntimeError) ./features/step_definitions/calabash_steps.rb:8:in /^I entered text "(.*?)" into input with id "(.*?)"$/' features/login.feature:7:inThen I entered text "test@tester" into input with id "login-email"'


Another code variation I tried, hoping it would work on AWS Device Farm:

Then(/^I entered text "(.*?)" into input with id "(.*?)"$/) do |arg1, arg2|
    enter_text("CalabashChromeClient css:'##{arg2}'", arg1)
end

But that too gives me an error: Timeout waiting for elements: CalabashChromeClient css:'#login-email' (Calabash::Android::WaitHelpers::WaitError)


With cordovaWebView, I get the following error:

Timeout waiting for elements: cordovaWebView css:'#login-email' (Calabash::Android::WaitHelpers::WaitError)


I figured out the correct webview name to run locally by playing around in the console. When it comes to AWS Device Farm, I'm a little blind here and would appreciate all hints/tips you guys can offer. I'm also open to switching test frameworks.


 query("*")
[
    [0] {
                        "id" => nil,
                   "enabled" => true,
        "contentDescription" => nil,
                   "visible" => true,
                       "tag" => nil,
               "description" => "com.android.internal.policy.impl.PhoneWindow$DecorView{41c4f3b8 V.E..... R.....I. 0,0-720,1232}",
                     "class" => "com.android.internal.policy.impl.PhoneWindow$DecorView",
                      "rect" => {
            "center_y" => 616,
            "center_x" => 360,
              "height" => 1232,
                   "y" => 0,
               "width" => 720,
                   "x" => 0
        }
    },
    [1] {
                        "id" => nil,
                   "enabled" => true,
        "contentDescription" => nil,
                   "visible" => true,
                       "tag" => nil,
               "description" => "android.widget.LinearLayout{41c4f8a8 V.E..... ......I. 0,0-720,1232}",
                     "class" => "android.widget.LinearLayout",
                      "rect" => {
            "center_y" => 616,
            "center_x" => 360,
              "height" => 1232,
                   "y" => 0,
               "width" => 720,
                   "x" => 0
        }
    },
    [2] {
                        "id" => "content",
                   "enabled" => true,
        "contentDescription" => nil,
                   "visible" => true,
                       "tag" => nil,
               "description" => "android.widget.FrameLayout{41c50560 V.E..... ......I. 0,25-720,1232 #1020002 android:id/content}",
                     "class" => "android.widget.FrameLayout",
                      "rect" => {
            "center_y" => 628,
            "center_x" => 360,
              "height" => 1207,
                   "y" => 25,
               "width" => 720,
                   "x" => 0
        }
    },
    [3] {
                        "id" => nil,
                   "enabled" => true,
        "contentDescription" => nil,
                   "visible" => true,
                       "tag" => nil,
               "description" => "android.widget.ImageView{41bb9f40 V.ED.... ........ 0,0-720,1207}",
                     "class" => "android.widget.ImageView",
                      "rect" => {
            "center_y" => 628,
            "center_x" => 360,
              "height" => 1207,
                   "y" => 25,
               "width" => 720,
                   "x" => 0
        }
    }
]

Solution

  • From AWS support: "They've been able to reproduce your issue and are looking into this further. For now, I can tell you this doesn't work currently and may be something we have to push into a feature request to add the functionality. If that is the case, it may take some time for them to implement the functionality." -- Oct 22, 2015