Reputation: 63
When running the E2E tests in the CI (BitBucket) using chromium:headless, they break with following error:
Error: Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
at BrowserSet._waitConnectionsOpened (/opt/atlassian/pipelines/agent/build/node_modules/testcafe/src/runner/browser-set.js:83:30)
at Promise.resolve.then (/opt/atlassian/pipelines/agent/build/node_modules/testcafe/src/runner/browser-set.js:106:35)
Here comes the weird part, the CI run the custom E2E pipeline at 9th November 2019 at 11:34pm, then at 10th November 2019 at 11:34pm it starts failing, exact same code and it was running inside the same dockerfile as the 9th Nov one.
What I have done? I tried updating TestCafe to latest version - 1.6.1, not working Updating Gherking-Testcafe to latest version - 2.4.2
Tried running with:
‘chromium ----no-sandbox’
‘chromium:headless ----no-sandbox’
With no success
Tried running firefox:headless, a lot of tests starts too fail, might have to dig into why they are failing...
Updated the docker container with newer versions of everything, same error
Asked TestCafe to list the browsers and Chromium is in the list
+ npx testcafe --list-browsers
firefox
chromium
The Docker file:
# using debian:jessie for it's smaller size over ubuntu
FROM debian:jessie
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Set environment variables
ENV appDir /var/www/app/current
# Run updates and install deps
RUN echo "deb http://packages.linuxmint.com debian import" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y -q --force-yes \
python python-pip chromium chromium-l10n firefox xvfb curl wget\
&& pip install --upgrade awscli s3cmd python-magic \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -y autoclean
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 10.8.0
# Install NPM packages
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash \
&& source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& npm install -g serve \
&& nvm alias default $NODE_VERSION \
&& nvm use default
# Set up our PATH correctly so we don't have to long-reference npm, node, &c.
ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
EXPOSE 1337 1338
I had to re-do our old one, because Gulp was creating issues with latest Node, so, needed a way to control the node version using NVM
Bug logged on TestCafes GitHub's page: https://github.com/DevExpress/testcafe/issues/4489
Upvotes: 3
Views: 3753
Reputation: 63
I was able to get to work by changing:
chromium:headless
to 'chromium --headless --no-sandbox'
It is still weird to me how it worked one day and within 24 with the same source code, docker image, it broke! Still curious to see what the TestCafe team will find, they are tracking the issue here: https://github.com/DevExpress/testcafe/issues/4489#issuecomment-555061246
Upvotes: 3
Reputation: 3093
why ----no-sandbox
? Had similar issues this week with Bitbucket Pipelines where I forgot to add --no-sandbox
, but adding as written seemed to fix the issue...
Also, adding a .testcafe.json
file to specify your options makes writing the options a lot easier...
Upvotes: 2