-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: switch from PhantomJS to HeadlessChrome #4262
Conversation
The build is failing on cis-jenkins because we don't have Chrome installed in the docker image used to run them. I opened a PR to add Chrome, now I am waiting for @rmg to help me get that change landed and published to production. |
39ab65a
to
9dd2257
Compare
Much better choice. What about the CI failures? |
test/karma.conf.js
Outdated
config.set({ | ||
customLaunchers: { | ||
ChromeDocker: { | ||
base: 'ChromeHeadless', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change this to ChromiumHeadless
it might "just work" since Chromium is installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In c772233, I added a check to see if chromium
or chromium-browser
is in PATH
and then use ChromiumHeadless
instead of ChromeHeadless
. Unfortunately, it seems the check did not pass, because the build is still using Chrome (not Chromium):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below is the Dockerfile I am using to test my setup, it's based on our build images.
###
### Copied from Jenkins base Dockerfile
###
FROM ubuntu:xenial
# Declared first so that during build, nothing ever gets accidentally persisted
VOLUME /tmp
# Simple wrapper for apt-get install that does an update before install and
# cleanup after install to ensure that the resulting layer doesn't contain
# anything extra
COPY docker-friendly-apt-install.sh /bin/docker-friendly-apt-install
# Ensure that package don't give us any trouble when we install them
RUN echo 'DPkg::options { "--force-confdef"; "--force-confnew"; }' \
> /etc/apt/apt.conf.d/60local
# Use bash by default instead of dash
RUN echo "dash dash/sh boolean false" | debconf-set-selections \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
# Set our locale to use UTF-8 by default
RUN docker-friendly-apt-install locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
# ssh and some additional packages that are sufficiently common/popular that
# they are probably wanted/needed in all images.
RUN docker-friendly-apt-install \
ca-certificates \
apt-transport-https \
wget \
curl \
git \
openssh-server \
zip \
unzip \
bzip2 \
xz-utils \
bash \
rsync \
jq
###
### Install Chromium - see xvfb/Dockerfile
###
# For running protractor/selenium based tests
# libgconf-2-4 is a dependency of the selenium chromedriver
RUN docker-friendly-apt-install xvfb chromium-chromedriver libgconf-2-4
###
### Setup Node environment
###
# Install nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
RUN source ~/.nvm/nvm.sh && nvm install 12
###
### Run our tests
###
ENV CI=true
ENV JENKINS_HOME=/tmp
COPY "." "."
CMD ["/bin/bash", "-c", "source ~/.nvm/nvm.sh && nvm run 12 ./node_modules/.bin/grunt karma:unit-once"]
I am running the following command to build & run the tests:
docker build -t loopback-core-tests . && docker run -it loopback-core-tests
When I run this on my machine, Chromium is correctly picked and all tests pass.
@rmg could you please help me to investigate why my tests are failing on cis-jenkins?
As long as Headless Chrome works on those platforms I don't see why not @bajtos. I no longer have access to |
c772233
to
a182075
Compare
Rework browser tests to run in Headless Chrome instead of PhantomJS, because the latter is no longer maintained. This allows us to remove transpilation to ES5 via babelify, which significantly improves speed of our tests. Signed-off-by: Miroslav Bajtoš <[email protected]>
See the discussion in docker/for-linux#496 Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
@slnode test please |
I made an adjustment to the Jenkins config - it was previously using a minimal image that lacked |
Thank you a lot, @rmg! 🙇 |
Rework browser tests to run in Headless Chrome instead of PhantomJS, because the latter is no longer maintained.
This allows us to remove transpilation to ES5 via babelify, which significantly improves speed of our tests.
Fixes #4252
Checklist