首页 文章

Ember升级打破了一个测试,仅在Safari中

提问于
浏览
28

我想赶上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传递 .

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

这是一个集成测试,并验证当输入中的值更改时,输入将使用从服务器返回的值进行更新 . 在测试中,“服务器”是Pretender实例 . 这是测试本身的样子:

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 事件 .

考虑到这个测试通过了一个只有Ember CLI更新不同的分支......可能会有什么变化才能实现这个突破?

ETA:我已经单独回滚了此更新中更新的所有库,测试仍然失败 . 唯一可行的改变就是回归Ember本身 . 它以与1.11.1相同的方式在1.11.0中打破,因此更改在1.10.0和1.11.0之间 . (这只留下我约600次提交筛选......)

ETA2:我试图使用bower linkuse local builds of ember但是到目前为止,在执行测试时,余烬构建是不可靠的,并且这两个标签的关系不是导致有效二等分的关系 .

1 回答

  • 6

    我可以很难 . 你提到的标签之间有49个补丁 . 一个 git cherry-pick 命令流给我上传的分支https://github.com/rdebath/test/tree/ember.js

    该分支上的每个提交(在v1.11.0-beta.5标记之后)来自您提到的标记之间的“好”路由 . 提交哈希值都是不同的(显然),但最终的树哈希值与v1.11.0相同,所以这应该是git bisect的一个好路径 .

    构建问题也可以避免,例如,我建议使用bisect来找到导致它们的补丁,尽可能晚地找到补丁 . [1816732_] . 这应该在它旁边提出一个问题's fix; but it'对于那些提交可能不是一个好主意,因为你希望能够将所有内容与真实树相关联 .

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

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

    有了这个“好”的道路是相当明显的 .

相关问题