技术上不支持...在此之下,我的解决方法似乎可行。
http://www.rubydoc.info/gems/calabash-android/0.5.8/Calabash/Android/Operations:app_to_background
尚未实施
def app_to_background(secs)
ni
end
在我的功能文件中:
@automated @high @test
Scenario Outline: Login with keep me signed in background and relaunch
Given I am on the Login page
When I check keep me signed in
When I log into Overview page with "<acct>"
When I background the app
When I relaunch the app
Then I am on the Overview page
我对背景和重新启动的步骤定义:
When /I background the app/ do
`adb shell input keyevent KEYCODE_HOME`
sleep(5)
end
When /I relaunch the app/ do
attempts = 0
begin
attempts = attempts + 1
start_test_server_in_background
rescue RuntimeError => e
retry if attempts < 3
end
sleep(5)
end
start_test_server_in_background(上图)将我带回应用程序,而不是登录屏幕。你注意到我的脚步声When I check keep me signed in
。我不知道这一切有多可靠,但它适用于我正在测试的应用程序。