我有一个 donejs 插件 ( https://github.com/riescorp/donejs-typeahead ),我决定使用 funcunit ( http://funcunit.com/ ) 进行 GUI 交互测试。在我的电脑上一切正常,无论是运行测试页面(http://localhost:8080/test/test.html)还是npm test
在控制台上运行。
问题是在 CircleCI 或 Travis CI 上运行测试时,测试不会通过。错误类似于“xxxxx 页面未及时加载!” (见下面的例子)。
有一个简化的分支来显示正在发生的事情(https://github.com/riescorp/donejs-typeahead/tree/testing-open),您可以克隆它,然后运行npm install
,npm test
您会看到它有效。
您可以在此处查看 CircleCI 中错误的详细信息:
- https://circleci.com/gh/riescorp/donejs-typeahead/tree/testing-open
- https://circleci.com/gh/riescorp/donejs-typeahead/74(样本)
Travis 生成相同的错误,但它会失败,因为我正在测试 firefox 和 chrome(travis 不支持 chrome)
示例错误:
1) QUnit "test/test.html" on Chrome 53.0.2785 / Linux 0.0.0: donejs-typeahead GUI Interaction DEBUG TESTS DEBUG 1 Page //../src/donejs-typeahead.html not loaded in time!:
Error: Expected true but was false
at Object.ok (http://localhost:3996/node_modules/steal-qunit/node_modules/qunitjs/qunit/qunit.js:2194:12)
at Object.assertOK (http://localhost:3996/node_modules/funcunit/browser/adapters/qunit.js:12:10)
at http://localhost:3996/node_modules/funcunit/browser/queue.js:168:27