-
Notifications
You must be signed in to change notification settings - Fork 37
"Stream not Writeable" Error When Running WDIO Tests #642
Comments
@pmoeller91 Do you have a link to the specific test(s) in your project showing how your test(s) is written where you encountered this error? |
@benbcai This was the specific test where the error would show up, however it was very sensitive to starting conditions: https://gist.github.com/benbcai/e2e214c50fd6415f80842d3712b7dc5b#file-encounters-columns-spec-js-L110 Tests are very simple in this file, just UX validation. Error also appears to happen in CI, was hoping it was more sensitive than that.. |
The following is the conversation with @pmoeller91 that provides more information about this error.
Error from CI build
Additional observations and information provided by @pmoeller91
|
Spike SummaryAttempt to recreate with Terra projectsUnable to recreate in terra-core, terra-framework, or terra-clinical, all of which have a very large number of tests capturing several thousand screenshots altogether. One notable difference between these monorepos and encounter-js where the error is reproducible is that it has many tests that load a new url many times within the test. Not certain if this has any impact in triggering the error. Cause of the error (node-resemble-js and pngjs)
Current situation
Our options
05/05/2021 edit: @mirzazeyrek/node-resemble-js v1.2.1 just got released. Tested with this version using encounter-js and no longer get the |
great investigation @benbcai !! 🎉 |
Bug Report
Description
Sometimes, when running WDIO tests, under some circumstances, an outdated version of PNGJS (a dependency of node-resemble-js) will encounter a race condition of some kind. This will cause an error when trying to write a screenshot, throwing a "Stream not writeable!" message. It seems very similar to what is described here: https://stackoverflow.com/questions/37776746/node-js-pngjs-error-stream-not-writable-randomly although in my case it seemed highly sensitive to initial conditions. The error would consistently occur in a particular wdio test file, but when any of the starting conditions were changed it would cause the error to not occur.
I wanted to report this early as I'm afraid this may come up randomly as more people start to adopt @cerner/terra-functional-testing in their components.
Steps to Reproduce
Additional Context / Screenshots
This is an example of the error occurring. This error would not occur when only running this test, or when running basically any other combination of tests still including this test, but under whatever specific circumstances I am experiencing this would consistently happen.
Expected Behavior
Pngjs should not have nasty race conditions that cause a stream to be marked as not writeable prior to completing output.
Possible Solution
Update or fork node-resemble-js to use a newer version of pngjs may be one possible solution. The whole library seems to be rather old and unmaintained, which is itself perhaps a red flag.
Environment
@ Mentions
The text was updated successfully, but these errors were encountered: