Calabash for Cordova Android AWS Device Farm 上的应用程序,正确的 webview 名称?
Calabash for Cordova Android app on AWS Device Farm, correct webview name?
我在尝试为 Cordova 应用程序编写 Calabash 测试时遇到了麻烦 运行。 webView 和 cordovaWebView 在本地或 AWS 上对我不起作用。
当我 运行 针对设备时在本地工作的代码变体:
Then(/^I entered text "(.*?)" into input with id "(.*?)"$/) do |arg1, arg2|
enter_text("SystemWebView css:'##{arg2}'", arg1)
end
但是,在 AWS 上它给我这个错误:
map SystemWebView css:'#login-email', 查询失败因为: java.util.concurrent.ExecutionException: java.lang.ClassCastException: sh.calaba.instrumentationbackend.actions.webview.CalabashChromeClient 无法转换为 org.apache.cordova.engine.SystemWebChromeClient
(运行时错误) (运行时错误)
./features/step_definitions/calabash_steps.rb:8:in /^I entered text "(.*?)" into input with id "(.*?)"$/'
features/login.feature:7:in
然后我输入文本 "test@tester" 到输入 ID "login-email"'
我尝试的另一个代码变体,希望它能在 AWS Device Farm 上运行:
Then(/^I entered text "(.*?)" into input with id "(.*?)"$/) do |arg1, arg2|
enter_text("CalabashChromeClient css:'##{arg2}'", arg1)
end
但这也给我一个错误:
等待元素超时:CalabashChromeClient css:'#login-email' (Calabash::Android::WaitHelpers::WaitError)
使用 cordovaWebView 时,出现以下错误:
等待元素超时:cordovaWebView css:'#login-email' (Calabash::Android::WaitHelpers::WaitError)
我通过在控制台中尝试,在本地找到了 运行 的正确 webview 名称。说到 AWS Device Farm,我有点盲目,非常感谢 hints/tips 你们能提供的一切。我也愿意转换测试框架。
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
}
}
]
您的应用是常规应用还是 Cordova 应用?
您应该能够使用 webView 或 cordovaWebView 查询 webview
query("webView css:'#header'")
OR
query("cordovaWebView css:'#header'")
来自 AWS 支持:"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." -- 2015 年 10 月 22 日
你在使用人行横道吗?如果是这种情况,那么这应该有效:
query("org.crosswalk.engine.XWalkCordovaView css:'.page-on-center#intro'")
但是,它无法在 AWS Device Farm 上运行。得到以下错误:
', query failed because: java.util.concurrent.ExecutionException:
java.lang.RuntimeException:
sh.calaba.org.codehaus.jackson.map.JsonMappingException: Can not
deserialize instance of java.util.HashMap out of START_ARRAY token
这个问题似乎与新的 Android 系统 WebViews 有关。例如,您使用的是 Android 5.1 或更高版本吗?
与 webView 相同的应用程序在 4.4 智能手机上对我来说工作正常但由于这个错误在某些 5.1 上失败。
阅读其他 post 我发现这应该在 Calabash-Android 的 0.5.12 版本中得到修复。
查看更改日志:
calabash-android 0.5.12 的发行说明
修复 Calabash WebView 查询不适用于 Lollipop 和 M.
中的新 Android 系统 WebView
请更新!!!
我在尝试为 Cordova 应用程序编写 Calabash 测试时遇到了麻烦 运行。 webView 和 cordovaWebView 在本地或 AWS 上对我不起作用。
当我 运行 针对设备时在本地工作的代码变体:
Then(/^I entered text "(.*?)" into input with id "(.*?)"$/) do |arg1, arg2|
enter_text("SystemWebView css:'##{arg2}'", arg1)
end
但是,在 AWS 上它给我这个错误:
map SystemWebView css:'#login-email', 查询失败因为: java.util.concurrent.ExecutionException: java.lang.ClassCastException: sh.calaba.instrumentationbackend.actions.webview.CalabashChromeClient 无法转换为 org.apache.cordova.engine.SystemWebChromeClient
(运行时错误) (运行时错误)
./features/step_definitions/calabash_steps.rb:8:in /^I entered text "(.*?)" into input with id "(.*?)"$/'
features/login.feature:7:in
然后我输入文本 "test@tester" 到输入 ID "login-email"'
我尝试的另一个代码变体,希望它能在 AWS Device Farm 上运行:
Then(/^I entered text "(.*?)" into input with id "(.*?)"$/) do |arg1, arg2|
enter_text("CalabashChromeClient css:'##{arg2}'", arg1)
end
但这也给我一个错误: 等待元素超时:CalabashChromeClient css:'#login-email' (Calabash::Android::WaitHelpers::WaitError)
使用 cordovaWebView 时,出现以下错误:
等待元素超时:cordovaWebView css:'#login-email' (Calabash::Android::WaitHelpers::WaitError)
我通过在控制台中尝试,在本地找到了 运行 的正确 webview 名称。说到 AWS Device Farm,我有点盲目,非常感谢 hints/tips 你们能提供的一切。我也愿意转换测试框架。
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
}
}
]
您的应用是常规应用还是 Cordova 应用?
您应该能够使用 webView 或 cordovaWebView 查询 webview
query("webView css:'#header'")
OR
query("cordovaWebView css:'#header'")
来自 AWS 支持:"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." -- 2015 年 10 月 22 日
你在使用人行横道吗?如果是这种情况,那么这应该有效:
query("org.crosswalk.engine.XWalkCordovaView css:'.page-on-center#intro'")
但是,它无法在 AWS Device Farm 上运行。得到以下错误:
', query failed because: java.util.concurrent.ExecutionException: java.lang.RuntimeException: sh.calaba.org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.HashMap out of START_ARRAY token
这个问题似乎与新的 Android 系统 WebViews 有关。例如,您使用的是 Android 5.1 或更高版本吗? 与 webView 相同的应用程序在 4.4 智能手机上对我来说工作正常但由于这个错误在某些 5.1 上失败。
阅读其他 post 我发现这应该在 Calabash-Android 的 0.5.12 版本中得到修复。
查看更改日志: calabash-android 0.5.12 的发行说明 修复 Calabash WebView 查询不适用于 Lollipop 和 M.
中的新 Android 系统 WebView请更新!!!