GraphicsMagick fails when image files are deleted between tests
I've found an issue with WebdriverCSS where gm will return an error when the image/baseline files are deleted in-between running two tests. The problem doesn't occur when the node server is restarted between tests, only when the files are deleted as the server process is on.
The error I get is this:
Error: [webdrivercss("test",{"name":"body","elem":"body"})] <=
Command failed: gm convert: Unable to open file (images/active/baselines/test.720px.png) [No such file or directory].
I've created the smallest possible test server for this. It can be found here: https://gist.github.com/JamEngulfer/a84dcd335952956e7d17
This is a problem, because other than deleting the files and running tests again, there's no practical way to create new baseline images (apart from running a failed test multiple times, but I'm discounting that).
An important note, if the screenWidth property is undefined, this problem doesn't appear.
The line on which the error occurs is most likely cropImage.js:67, based on the line numbers in the current repo. The line is return shot.write(that.filename || that.baselinePath, cb);
Upon a little more investigation, it looks like when the test is run after the images have been deleted, webdrivercss doesn't save the result of the screenshot to the file path, but continues looking for it anyway.