I'm using backstop to test my app, but it fails on random test with message like
COMMAND | Command `test` ended with an error after [155.109s]
COMMAND | BackstopException: TestNameGoesHere on ViewportNameGoesHere: Error: connect ECONNREFUSED 127.0.0.1:9336
Port 9336 is one of the ports used by backstop to connect chromy. Application port is 8082.
The problem occurs only in Windows. Everything works in Linux Mint.
Command for starting test is
backstop test --configPath=backstop-config.js
Configuration is
module.exports = {
viewports,
scenarios,
paths: {
bitmaps_reference: `backstop-smth/bitmaps_reference`,
bitmaps_test: `backstop-smth/bitmaps_test`,
engine_scripts: `backstop/engine_scripts`,
html_report: `backstop-smth/html_report`,
ci_report: `backstop-smth/ci_report`,
},
engine: "chrome",
report: ["browser", "CLI"],
};
each of the scenarios is like following:
scenarios.push({
label,
url,
hideSelectors: ["#debug"],
removeSelectors: [],
selectors: ["body"],
readyEvent: null,
delay: 5000,
onReadyScript: null,
onBeforeScript: null,
});
Here is console output:
Starting Chromy: port:9222 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9223 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9224 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
Starting Chromy: port:9225 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9226 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9227 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
...
Starting Chromy: port:9336 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9337 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9338 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
Starting Chromy: port:9339 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9340 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9341 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
Starting Chromy: port:9342 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9343 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9344 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
Starting Chromy: port:9345 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9346 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9347 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
Starting Chromy: port:9348 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9349 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9350 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
Starting Chromy: port:9351 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=954,735
Starting Chromy: port:9352 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=1024,768
Starting Chromy: port:9353 --disable-gpu,--force-device-scale-factor=1,--disable-infobars=true,--window-size=768,1024
COMMAND | Command `test` ended with an error after [155.109s]
COMMAND | BackstopException: TestNameGoesHere on ViewportNameGoesHere: Error: connect ECONNREFUSED 127.0.0.1:9336
I think problem can happen because specified port is already in use, but I'm not sure. Anyway, as you see, backstop uses all ports from 9222 to 9353 in this run - each test requires a port which was not used before. Is there a way to configure backstop to reuse ports?