- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试在 Android 设备上运行一些 Calabash 测试。如果我在运行测试之前手动转动屏幕,那么一切正常。在 Nexus 4 上,如果我关闭屏幕并尝试运行测试,那么我的第一个场景会在等待元素出现时超时。在 Galaxy Nexus 上,如果我在屏幕关闭的情况下开始测试,Calabash 会唤醒设备并通过测试。
是否有一些 Calabash 根本无法唤醒的设备? Nexus 4 是其中之一吗?手动打开设备是不可行的,因为我会在许多设备上频繁运行这些测试。
我发现了一些关于这个问题的过时引用。 Adam Niedzielski 于 2012 年在 https://groups.google.com/forum/#!topic/calabash-android/o6lUuEOuGtE 发表的一篇文章建议在 app_life_cycle_hooks.rb
include Calabash::Android::Operations
AfterConfiguration do |config|
wake_up
end
但代码已添加到 Calabash 中的 ruby-gem/bin/calabash-android
中,明确禁止包含 Operations
模块:https://github.com/calabash/calabash-android/commit/995daef9b6636e7e4e572aeb5d4f90d6d072320f所以我想这不再是推荐的方法。如果我删除 include 并只键入 Calabash::Android::Operations.wake_up
,我会得到一个 NameError
。
最佳答案
我偶尔会遇到这个错误,最终将屏幕超时设置为超过一分钟并在开始测试之前运行此方法:
def self.turn_on_screen(device_serial_number)
# Switches on the android devices screen if it isn’t already on.
if `adb -s #{device_serial_number} shell dumpsys input_method | grep mScreenOn`.include? 'false'
`adb -s #{device_serial_number} shell input keyevent KEYCODE_POWER`
end
end
如果屏幕尚未打开,这将模拟按下电源按钮。我已经在大约 4 种不同的设备上使用过它,到目前为止没有遇到任何问题,所以希望它对你有用。
可能值得注意的是,我还关闭了设备的锁屏。
编辑:更新 Lollipop 后,我不得不添加另一张支票。在我的所有测试设备上同时使用两者似乎都可以解决问题。
if `adb shell dumpsys input_method | grep mInteractive`.include? 'false'
`adb shell input keyevent KEYCODE_POWER`
end
关于android - 设备屏幕休眠时测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27322366/
这个问题在这里已经有了答案: What is the JavaScript version of sleep()? (91 个回答) 关闭 9 年前。 是的,我知道 - 这个问题有成千上万的答案。请
有没有办法使用 native NHibernate linq 提供程序执行以下查询? var result = (from e1 in Session.Query() join e2
上下文:我正在尝试将Grails项目从1.0.3升级到1.3.7,并且遇到了很多问题。我刚得到很多DuplicateMappingExceptions,因为该项目同时具有Hibernate XML文件
我有标准: ICriteria criteria = Session.CreateCriteria() .SetFetchMode("Entity1", FetchMo
我正在寻找一种重新启动线程的方法,无论是从该线程的上下文内部还是从线程外部,可能是从另一个进程中。 (这些选项中的任何一个都可以。)我知道使整个进程休眠的困难,而且我很确定线程也会遇到同样的困难。但是
C 中是否有任何函数可以检查计算机是否进入 sleep 、休眠 或锁定 并从这些状态唤醒? 在msdn它们为 C#、C++ 提供,但不为 C 提供。我的操作系统是windows7 如下是我用来检查启动
我对 NHibenate 有疑问。当我运行 queryover 时,出现错误“无法解析属性:User.Name of:MegaOnlineChat.Core.Entities.Message”。我做错
我知道这里被问过很多次,也回答过很多次,这不是应该如何完成的方式,但再一次:) 是否有可能以某种方式调用异步函数(例如计时器/ajax 调用),基本上是常见的异步任务并同步等待直到它结束而不会出现 1
我在persistence.xml中有以下内容 com.merc.model.log.EventLogging org.hibernate.ejb.HibernatePersiste
目前我的存储库有 2 个构造函数。当我从我的 mvc 网站调用这些时,我总是调用第一个构造函数,从而打开一个新 session 。我应该在 session 中通过吗?我该怎么做。 public
hibernate session to list conversion Compilation Error occured when java converted into scala..!!
下面的remove()方法导致“超出了GC开销限制”。从A或B或C中删除ABC中存在的关联时。请您告知错误在哪里吗? 注-ABC是A,B,C的映射表 stacktrace如下: Caused by:
昨天我在 webhosting.net 的 Jelastic v2.2.2 上获得了一个试用帐户,并配置了一个最少 0 个 cloudlets 的环境(最多 8 个,即全部动态,无保留)。然后我部署了
设置:Grails 2.5.6和Hibernate 4.3.10 我有一个带有字符串ID的表。事实是,它的值是数字字符串,当我传入诸如get()这样的值时,这似乎使"000000"变得混乱。 域类:
hibernate session to list conversion Compilation Error occured when java converted into scala..!!
我有一个用于 PDA 的应用程序,它有一个长时间运行的进程,我遇到了一个问题,即 PDA 将在该进程完成之前进入休眠状态。 我无法控制 PDA 上的电源设置,有谁知道我的应用程序阻止 PDA 进入休眠
我正在创建一个将安装在 LaunchAgents 文件夹中的守护程序。关于使其 sleep 的一些问题: 因为它是一个 LaunchAgent 项,所以可执行文件会在用户/系统 sleep 时自动 s
我想使用 AsyncTask 创建启动画面。具体来说,在 doInBackground() 方法中,我使用静态方法 Thread.sleep() 并在它创建一个将应用程序重定向到其他 Activity
在我的网站上,我有一个 JavaScript 函数,它执行 AJAX 调用来获取帐户信息,然后打开一个模式,您可以在其中查看和编辑信息。 AJAX 调用用于更改您选择的数据库中的详细信息,然后刷新原始
除非线程告诉我醒来,否则我想睡 X 时间。在下面的示例中,我想休眠 10 毫秒(1/100 秒)或直到 foo 有 2000 个项目。以先到者为准。我该怎么做呢?我编了函数 主线程: pthread_
我是一名优秀的程序员,十分优秀!