Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging UI Tests written with Testcafe

UPDATE:

Regarding to another(hammerhead) bug we were forced to use minified code in testcafe test. Since this bug is resolved we're now able to run the tests against non minified code.

But still, we have the problem that source maps get removed by testcafe. When we run the webpack dev server normally we see all the source maps and are able do set breakpoints and debug the application code.

Nevertheless during tests source maps are not available any more. You can see the attached screenshots showing the 2 cases.

Are we doing something wrong here?

Image without Testcafe

Image with testcafe


We are using Testcafe + Webpack + Vue.js for our project. I know that it is possible to debug the test code either by t.debug() directive or --inspect flag of node.js.

However, I can only see the production code (build.js) which is obfuscated and not really debuggable. I wonder if it is possible to have a configuration so that the testcafe does not use the bundled code but rather the original source code (probably with sourcemaps?). I am using source-map as the devtool option in webpack.

I am aware that the UI tests should test the production code but it would be nice to have such a configuration while developing. Any ideas?

like image 656
C.d. Avatar asked Sep 04 '17 12:09

C.d.


People also ask

How do you Debug tests in TestCafe?

Client-Side Debugging TestCafe provides the t. debug method that pauses the test and allows you to debug it with the browser's developer tools. You can also use the --debug-mode command line option to pause the test before the first action or assertion.

How do I Debug a TestCafe selector?

TestCafe outputs the Debugger URL to the Console when you launch the test. In Visual Studio Code, open the “Run” menu and click “Start Debugging”. Click the “Debug URL” button in the “Run and Debug” pane and input the URL from the command line.


1 Answers

Testcafe drops source maps declarations from client scripts. Unfortunately, now you cannot debug client scripts using source maps mechanism. I've created the proposal for this. You can track this issue on Github to be aware of progress.

like image 195
mlosev Avatar answered Sep 23 '22 10:09

mlosev