【发布时间】:2016-01-02 16:55:47
【问题描述】:
我在尝试为 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,我在这里有点盲目,希望你们能提供的所有提示/技巧。我也愿意切换测试框架。
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
}
}
]
【问题讨论】:
标签: android cordova amazon-web-services webview aws-device-farm