How to debug browser tests with the new test package

旧城冷巷雨未停 提交于 2019-12-10 20:18:05

问题


browser tests need to be run from command line like pub run test -pdartium. Is there a way to debug such tests.


回答1:


pub run test -pdartium --pause-after-load

starts the test only after I click a "play" button on the test page. This gives me time to open up Dev Tools in Dartium and set breakpoints. I can also open up the Observatory and do stuff there.




回答2:


The Dart team is working hard to make tests with the new test package debuggable. Until the related issues are fixed you can use this workaround:

To run browser tests with the new test package, for example from WebStrom, including debugging, just replace the <x-test-dart ...> tag with a normal Dart script tag pointing to your test file and run it like any Dart browser application from WebStorm.

This also works for Polymer tests. Ensure you run await initPolymer(); or the appropriate initialization necessary for the used Polymer version.

I usually create a copy of the test entry page file where I can keep the replaced script tag.



来源:https://stackoverflow.com/questions/33165457/how-to-debug-browser-tests-with-the-new-test-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!