我需要在不同的视口大小下测试我的脚本。在我的测试中,我想通过设置page.viewportSize来更改PhantomJS的视口大小。我正在通过grunt-contrib-qunit来运行我的测试,并且我的测试代码中无法访问PhantomJS。有没有办法获得它?在QUnit测试中设置PhantomJS viewportSize
9
A
回答
1
现在在dist版本上是不可能的。
grunt-contrib-qunit依赖于grunt-lib-phantomjs,它不允许使用此功能。 但是,an interesting commit(6天前)from bdowling on github is available。当然,这会帮助你。
你可以自己得到这个提交结束编辑qunit任务来尝试它。
耐心,我年轻的Padawan。忍耐!
1
现在可以做到这一点。这里是我的Gruntfile.js
是什么样子:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
qunit: {
src: ['tests/test.html'],
options: {
page : {
viewportSize : { width: 1280, height: 800 }
}
}
},
});
+0
我找不到任何地方记录,但它的工作原理!谢谢。 – Andy
相关问题
- 1. 在phantomjs中qunit测试期间在iframe中显示JS错误
- 2. 在PhantomJS中从Ant运行异步QUnit测试
- 3. 动态更改PhantomJS中的viewportSize
- 4. 在QUnit测试中重置KnockoutJS ViewModel
- 5. 在Qunit中跳过测试
- 6. 如何设置mocha-phantomjs的测试
- 7. 在QUnit测试中设置$(this)的范围
- 8. QUnit XMLHttpRequest测试
- 9. viewportSize似乎不适用于PhantomJS
- 10. QUnit测试测试用例
- 11. PhantomJS,Qunit,Grunt测试浏览器调整窗口小部件
- 12. 在QUnit等待测试
- 13. Qunit:测试泄漏
- 14. Angularjs和qunit测试
- 15. QUnit测试挂起
- 16. 在Casper.js中运行QUnit测试
- 17. 在QUnit测试中获得$ httpBackend
- 18. 在node.js中用qunit测试http.get()
- 19. 设置用于qunit测试的复选框
- 20. Travis CI上的QUnit测试失败(使用grunt.js在phantomjs上运行)
- 21. 在qunit中使用测试用例来测试jquery小部件
- 22. 在JQueryUI小部件的QUnit测试中可见的测试
- 23. 使用QUnit测试Dojos JsonRest
- 24. QUnit鼠标悬停测试
- 25. QUnit不会运行测试
- 26. QUnit测试覆盖率
- 27. QUnit链异步测试
- 28. qunit - 测试异常消息?
- 29. 使用JsTestDriver + RequireJS + QUnit测试
- 30. QUnit for javascript测试事件
我没赶上,当我在写我的这个问题,但我知道我们同样的事情后...(如果我得到一个答案,你什么也没找到):http://stackoverflow.com/questions/17467324/phantomjs-qunit-grunt-testing-browser-resize-widgets –