Ember升级会打破一个测试,只能在Safari中 [英] Ember upgrade breaks one test, and only in Safari

查看:94
本文介绍了Ember升级会打破一个测试,只能在Safari中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在抓住一个 Heisenbug

我正在将我们的项目从Ember CLI 0.2.0和Ember 1.10.0更新为Ember CLI 0.2.3和Ember 1.11.1。这是一个非常痛苦的过程,但我只有一个测试,现在在Safari(7.1.5)中失败。它通过PhantomJS,Chrome和Firefox。

I'm updating our project from Ember CLI 0.2.0 and Ember 1.10.0 to Ember CLI 0.2.3 and Ember 1.11.1. This has been a pretty pain-free process, but I have exactly one test which now fails in Safari (7.1.5) only. It passes in PhantomJS, Chrome and Firefox.

令人遗憾的是,测试仅在Testem启动测试运行时失败(即,当代码的更改触发自动更新测试运行)。如果我从Qunit Web界面内启动测试,它会通过。无论测试分组如何,这两个都是真实的。被测试的功能在浏览器中手动运行时工作正常。

Annoyingly, the test only fails when the test run is initiated by Testem (that is, when a change in the code triggers an auto-update test run). If I initiate tests from inside the Qunit web interface, it passes. Both of these things are true regardless of the test grouping. The feature being tested works just fine when run manually in the browser.

这是一个集成测试,并验证当输入中的值被更改时,输入更新为从服务器返回的值。在测试中,server是一个Pretender实例。以下是测试本身的样子:

It's an integration test and verifies that when a value is changed in an input, the input updates with the value returned from the server. In the tests, the "server" is a Pretender instance. Here's what the test itself looks like:

test('Editing allocation cell', function() {
  visit('/district/periods');

  fillIn(SELECTORS.definitionRowInput(1,0), '100');
  triggerEvent(SELECTORS.definitionRowInput(1,0), 'focusout');
  // The triggerEvent should be tripping the focusOut event on a particular
  // Ember.Textfield subclass, which subsequently leads to a POST request to
  // the server. On Safari, however, the focusOut event isn't being called here.
  // It is called elsewhere in the app, and it works in production.
  // Things that also don't work: keyEvent(element, 'keypress', 16) (a tab), 
  // sending 'blur', sending 'focus-out'.
  // 'focus-out' also fails in Firefox, 'blur' and tab fail in all 4 envs

  andThen(function() {
    equal($(SELECTORS.definitionRowInput(1,0)).val(), '90', 'The updated input takes the return value from the server (even if it is different from input)');
    equal($(SELECTORS.gradeTotal(2)).text(), '120', 'Grade total updates with the new sum');
  });
});

请注意第二个 andThen()块:通过向控件发送 focusout ,我们应该在后台组件中提示代码将数据更新回服务器。其他浏览器这样做 - 我在Pretender应答器中放置了一个 console.log()来验证它 - 但是Safari没有。我猜测它没有正确地响应 focusout 事件。

Note the second andThen() block: by sending focusout to the control, we should be prompting code in the backing component to update the data back to the server. The other browsers do this - I put a console.log() in the Pretender responder to verify it - but Safari doesn't. I'm guessing it's not responding properly to the focusout event.

考虑到这个测试通过了一个分支只有Ember CLI更新才有所不同...有可能改变了这个休息?

Considering that this test passes in a branch which only differs by the Ember CLI update... what's likely to have changed to make this break?

ETA:我已经单独回滚此更新中更新的所有库测试继续失败。唯一的改变似乎是反转Ember本身。它以1.11.1的方式打破1.11.0,所以变化在1.10.0和1.11.0之间。 (这只剩下我〜600个请求筛选...)

ETA: I've individually rolled back all the libraries updated in this update and the test continues to fail. The only change which seems to work is rolling back Ember itself. It breaks in 1.11.0 in the same way as 1.11.1, so the change is between 1.10.0 and 1.11.0. (That only leaves me ~600 commits to sift through...)

ETA2:我将范围缩小到1.11.0-beta.5和1.11之间。 0。我正在尝试使用 bower链接使用本地建立的余烬,但是ember构建在运行测试中至今不可靠,而这两个标签的关系不是导致有效的平分。

ETA2: I've narrowed the scope to between 1.11.0-beta.5 and 1.11.0. I'm trying to use bower link to use local builds of ember but the ember builds have been unreliable so far in running the tests and the relationship of those two tags isn't one which leads to effective bisecting.

推荐答案

我无法帮助您实际运行测试,但是平坦化历史并不困难。您提到的标签之间有49个补丁。 git cherry-pick 命令的流可以让我在 https://github.com/rdebath/test/tree/ember.js

I can't help you with actually running your tests, but flattening the history isn't that difficult. There are 49 patches between the tags you mention. A stream of git cherry-pick commands gives the branch I've uploaded at https://github.com/rdebath/test/tree/ember.js

每个提交的提交该分支(v1.11.0-beta.5标签之后)来自您提到的标签之间的漂亮路线。提交散列都是不同的(显然),但最终的树哈希与v1.11.0相同,所以这应该是git bisect的一个很好的路径。

Each one of the commits on that branch (after the v1.11.0-beta.5 tag) comes from a 'nice' route between the tags you mentioned. The commit hashes are all different (obviously) but the final tree hash is the same as v1.11.0 so this should be a good path for git bisect.

构建问题也可以避免,例如,我建议使用二等分查找导致它们的修补程序,并尽可能晚地找到 git rebase -i 该修补程序。这应该在它的修复旁边出现问题;但是,如果您希望将所有内容与真实树结合在一起,那么挤压这些提交可能不是一个好主意。

The build problems can also be avoided, for example, I would suggest using a bisect to find the patch that causes them and git rebase -i that patch as late as you can. That should put a problem right next to it's fix; but it's probably not a good idea to "squash" those commits as you want to be able to relate everything back to the real tree.

为了帮助选择我使用命令的提交列表:

To help choose the list of commits I used the command:

git log --graph --decorate --oneline --date-order --all

好的路径是相当明显的。

With that the "nice" path is reasonably obvious.

这篇关于Ember升级会打破一个测试,只能在Safari中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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