焦点问题使得测试失败 [英] Focus issues make tests failing

查看:123
本文介绍了焦点问题使得测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OSX 10.9.2,量角器0.21.0,硒服务器独立2.40.0和chromedriver 2.9。

I'm using osx 10.9.2, protractor 0.21.0, selenium-server-standalone 2.40.0 and chromedriver 2.9.

我有一些问题,这(我相信)是由于窗口聚焦问题。

I'm having some problems, which (I believe) was due to window focusing issue.

当我用量角器运行我的E2E测试,浏览器窗口会显示,但我的终端仍然会成为一个焦点。这是从终端显然仍显示在我的菜单栏,而不是铬(OSX的行为,表示该应用程序处于焦点)。

When I run my e2e test using protractor, the browser window would show but my terminal will still be the one in focus. This is apparent from "Terminal" was still shown in my menu bar rather than "Chrome" (osx behavior that indicates which app is in focus).

我试图这样做无济于事亡羊补牢:

I tried to remedy the situation by doing this to no avail:

browser.driver.getAllWindowHandles().then(function(handles) {
  console.log(handles[0]);
  browser.driver.switchTo().window(handles[0]);
});

这种情况会导致我的一些测试失败。例如,包括点击一个场与引导日期选择器将不会显示日历,使我的测试的测试不能与日期选择日历交互。

This situation causes some of my tests to fail. For example, tests that include clicking a field with bootstrap datepicker won't show the calendar and making my test cannot interact with the datepicker calendar.

的情况是,即使在Firefox差。火狐甚至不会显示任何下拉菜单中,如果浏览器不在焦点时点击。

The situation is even worse on firefox. Firefox won't even show any dropdown menu when clicked if the browser is not in focus.

有趣地,当我手动点击浏览器窗口,它显示了第一次后,测试将正常工作。

Funnily, when I click the browser window manually after it shows up the first time, the tests will work normally.

当我尝试了不同的方法:在对新安装的Debian Linux的测试,仍然没有工作。如上所述行为是类似的。

When I tried a different approach: Doing the test on a freshly installed debian linux, still not working. Behavior is similar as described above.

这是我的配置文件: https://gist.github.com/giosakti/ca24a13705d15f4374b0

推荐答案

我找到了一线希望!我使用降级安装了Chrome浏览器的 http://google-chrome.en.uptodown.com/ MAC /老和焦点问题都没有了。(问题仍然存在在Firefox虽然)..

I found a silver lining! I downgrade the chrome using installer from http://google-chrome.en.uptodown.com/mac/old and the focus issues are gone.. (the issues still persist on firefox though)..

如果你在谷歌搜索铬34的焦点问题,你会发现一些报道说,也许这个问题相关。例如: https://productforums.google.com/forum/#​​!topic/镀铬/ pN5pYf2kolc

If you search "chrome 34 focus issues" on google, you will find several reports that maybe correlate with this issue. for example: https://productforums.google.com/forum/#!topic/chrome/pN5pYf2kolc

但我仍然不知道这是否是我现在阻止谷歌更新和使用Chrome 33 bug或铬34左右的预期行为。

but I still don't know whether this was a bug or expected behavior of chrome 34. So for now I block google updater and use Chrome 33.

这篇关于焦点问题使得测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆