Docker fails immediately, but docker command works by itself
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 621
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm trying to use the `--docker` flag for my tests, and it fails immediately with this error:
```
[1] BackstopJS v4.5.0
[1] Loading config: /Users/perry/mycompany/bots-js/backstop.json
[1]
[1] COMMAND | Executing core for "test"
[1] Delegating command to Docker... docker run --rm -it --mount type=bind,source="/Users/perry/mycompany/bots-js",target=/src backstopjs/backstopjs:4.5.0 test "--moby"
[1] the input device is not a TTY
[1] COMMAND | Executing core for "openReport"
[1] openReport | Attempting to ping
[1] COMMAND | Command "test" ended with an error after [0.066s]
[1] COMMAND | Error: docker run --rm -it --mount type=bind,source="/Users/perry/mycompany/bots-js",target=/src backstopjs/backstopjs:4.5.0 test "--moby" returned 1
[1] at ChildProcess. (/Users/perry/mycompany/bots-js/node_modules/backstopjs/core/util/runDocker.js:68:18)
[1] at ChildProcess.emit (events.js:210:5)
[1] at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
[1] openReport | Remote not found. Opening test/backstop/html_report/index.html
[1] npm ERR! code ELIFECYCLE
npm ERR! errno 1
[1] npm ERR! @mycompany/bots@0.3.2 vis:backstop: `sleep 5 && backstop test --docker`
[1] npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the @mycompany/bots@0.3.2 vis:backstop script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR! /Users/perry/.npm/_logs/2020-03-17T12_29_49_745Z-debug.log
[1] npm run vis:backstop exited with code 1
```
If I run the output docker command by itself, it succeeds:
```
$ docker run --rm -it --mount type=bind,source="/Users/perry/mycompany/bots-js",target=/src backstopjs/backstopjs:4.5.0 test "--moby"
BackstopJS v4.5.0
Loading config: /src/backstop.json
COMMAND | Executing core for "test"
createBitmaps | Selected 3 of 3 scenarios.
Cookie state restored with: []
Cookie state restored with: []
Cookie state restored with: []
Cookie state restored with: []
Cookie state restored with: []
Browser Console Log 0: JSHandle:BackstopTools have been installed.
Browser Console Log 0: JSHandle:BackstopTools have been installed.
Browser Console Log 0: JSHandle:BackstopTools have been installed.
Browser Console Log 0: JSHandle:BackstopTools have been installed.
Browser Console Log 0: JSHandle:BackstopTools have been installed.
SCENARIO > Single text input
SCENARIO > Submit button full
SCENARIO > Dropdown
SCENARIO > Submit button full
x Close Browser
x Close Browser
SCENARIO > Single text input
x Close Browser
x Close Browser
x Close Browser
Cookie state restored with: []
Browser Console Log 0: JSHandle:BackstopTools have been installed.
SCENARIO > Dropdown
x Close Browser
COMMAND | Executing core for "report"
compare | OK: Single text input backstop_default_Single_text_input_0_ld-input-cont_1_pc.png
compare | OK: Submit button full backstop_default_Submit_button_full_0_ld-button_0_phone.png
compare | OK: Submit button full backstop_default_Submit_button_full_0_ld-button_1_pc.png
compare | OK: Single text input backstop_default_Single_text_input_0_ld-input-cont_0_phone.png
compare | OK: Dropdown backstop_default_Dropdown_0_ld-dropdown-cont_0_phone.png
compare | OK: Dropdown backstop_default_Dropdown_0_ld-dropdown-cont_1_pc.png
report | Test completed...
report | 6 Passed
report | 0 Failed
report | Writing browser report
report | Resources copied
report | Copied jsonp report to: /src/test/backstop/html_report/config.js
report | Copied json report to: /src/test/backstop/bitmaps_test/20200317-123511/report.json
COMMAND | Executing core for "openReport"
openReport | Attempting to ping
openReport | Remote not found. Opening test/backstop/html_report/index.html
COMMAND | Command "report" successfully executed in [0.374s]
COMMAND | Command "test" successfully executed in [3.436s]
```
So I suspect that there's something wrong with how Backstop is executing docker, if it's as easy as me copy+pasting the command.
My backstop config:
```json
{
"id": "backstop_default",
"viewports": [
{
"label": "phone",
"width": 320,
"height": 480
},
{
"label": "pc",
"width": 1920,
"height": 1080
}
],
"onBeforeScript": "puppet/onBefore.js",
"onReadyScript": "puppet/onReady.js",
"scenarios": [
{
"label": "Submit button full",
"url": "http://host.docker.internal:8081/components.html?component=submit",
"selectors": [
".ld-button"
],
"delay": 750
},
{
"label": "Single text input",
"url": "http://host.docker.internal:8081/components.html?component=input-single",
"selectors": [
".ld-input-cont"
],
"delay": 750
},
{
"label": "Dropdown",
"url": "http://host.docker.internal:8081/components.html?component=dropdown",
"selectors": [
".ld-dropdown-cont"
],
"delay": 750
}
],
"paths": {
"bitmaps_reference": "test/backstop/bitmaps_reference",
"bitmaps_test": "test/backstop/bitmaps_test",
"engine_scripts": "test/backstop/engine_scripts",
"html_report": "test/backstop/html_report",
"ci_report": "test/backstop/ci_report"
},
"report": ["browser"],
"engine": "puppeteer",
"engineOptions": {
"args": ["--no-sandbox"]
},
"asyncCaptureLimit": 5,
"asyncCompareLimit": 50,
"debug": false,
"debugWindow": false
}
```
Contributor guide
Assessment
This issue has not been assessed yet.