BackstopJS test execution failing: "Error: Stream not writable"
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 621
- PR merge metrics
- No merged PRs in 30d
Description
So I've just started tinkering with BackstopJS. I setup some basic tests and was trying to work it into my normal build process in gulp.
For some reason though, the script just stopped executing correctly. The test worked fine several times earlier today, I came back later, made some CSS changes in my project, ran another test, and received this error:
````
Bitmap file generation completed.
COMMAND | Executing core for `report`
events.js:141
throw er; // Unhandled 'error' event
^
Error: Stream not writable
at ChunkStream.write (/Users/*****/Sites/*****/node_modules/pngjs/lib/chunkstream.js:46:24)
at PNG.write (/Users/*****/Sites/*****/node_modules/pngjs/lib/png.js:92:16)
at ReadStream.ondata (_stream_readable.js:525:20)
at emitOne (events.js:77:13)
at ReadStream.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at ReadStream.Readable.push (_stream_readable.js:110:10)
at onread (fs.js:1738:12)
at FSReqWrap.wrapper [as oncomplete] (fs.js:576:17)
````
For comparison, here is the same output from earlier today:
````
Bitmap file generation completed.
COMMAND | Executing core for `report`
compare | ERROR { size: isDifferent, content: 40.95%, threshold: 0.1% }: ***** *****_0_document_0_phone.png
See: /Users/*****/Sites/*****/backstop_data/bitmaps_test/20161115-135709/failed_diff_*****_0_document_0_phone.png
compare | OK: ***** *****_0_document_0_phone.png
compare | OK: ***** *****_0_document_0_phone.png
compare | ERROR { size: ok, content: 1.06%, threshold: 0.1% }: ***** *****_0_document_1_tablet_v.png
See: /Users/*****/Sites/*****/backstop_data/bitmaps_test/20161115-135709/failed_diff_*****_0_document_1_tablet_v.png
compare | OK: ***** *****_0_document_1_tablet_v.png
compare | OK: ***** *****_0_document_1_tablet_v.png
compare | ERROR { size: ok, content: 0.60%, threshold: 0.1% }: ***** *****_0_document_2_tablet_h.png
See: /Users/*****/Sites/*****/backstop_data/bitmaps_test/20161115-135709/failed_diff_*****_0_document_2_tablet_h.png
compare | OK: ***** *****_0_document_2_tablet_h.png
compare | OK: ***** *****_0_document_2_tablet_h.png
report |
Test completed...
report | 6 Passed
report | 3 Failed
````
I tried deleting the `html_report` directory and rerunning the script. That didn't work. I tried deleting `bitmaps_reference` and `bitmaps_test`. It could recreate the images, but the test failed in the same fashion.
There's also nothing fancy about the backstop.json file. I think it's just adapted from one of the demos:
````
{
"id": "*****",
"viewports": [
{
"name": "phone",
"width": 320,
"height": 480
},
{
"name": "tablet_v",
"width": 568,
"height": 1024
},
{
"name": "tablet_h",
"width": 1024,
"height": 768
}
],
"scenarios": [
{
"label": "*****",
"url": "*****/*****/index.html",
"readyEvent": "backstopjs_ready",
"misMatchThreshold" : 0.1,
"onBeforeScript": "onBefore.js",
"onReadyScript": "onReady.js"
},
{
"label": "*****",
"url": "*****/*****/index.html",
"readyEvent": "backstopjs_ready",
"misMatchThreshold" : 0.1,
"onBeforeScript": "onBefore.js",
"onReadyScript": "onReady.js"
},
{
"label": "*****",
"url": "*****/*****/index.html",
"readyEvent": "backstopjs_ready",
"misMatchThreshold" : 0.1,
"onBeforeScript": "onBefore.js",
"onReadyScript": "onReady.js"
}
],
"paths": {
"bitmaps_reference": "backstop_data/bitmaps_reference",
"bitmaps_test": "backstop_data/bitmaps_test",
"casper_scripts": "backstop_data/casper_scripts",
"html_report": "backstop_data/html_report",
"ci_report": "backstop_data/ci_report"
},
"casperFlags": [],
"engine": "phantomjs",
"report": ["browser"],
"debug": false
}
````
Does anyone have any ideas?
Contributor guide
Research direction
Start by reproducing the `report` command with the supplied BackstopJS configuration and inspect the stack trace locations in `node_modules/pngjs/lib/chunkstream.js` and `node_modules/pngjs/lib/png.js`. Compare the failing run with the earlier successful output; done means report generation completes and produces the expected comparison results without the stream error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100