master
to mdb.github.io/testing-with-xvfbSubmit a PR fixing the fix-my-code branch based on its failing tests!
Growth means increased responsibility...
Google technology for authoring applications with web components
web-component-tester
assumes a GUI.
And a real web browser(s).
And virtualized CI build agents don't have a display.
docs.travis-ci.com/user/gui-and-headless-browsers
...hence my JSConf 2015 talk.
Much more common!
language: node_js
before_script:
- npm install -g bower web-component-tester
- bower install
addons:
firefox: '46.0'
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
script:
- xvfb-run wct
AKA Xvfb
run GUI applications (like web browsers) with no display!
(how TravisCI runs web browsers)
How GUI displays are rendered on UNIX/UNIX-like systems
Set up your own Ubuntu VM for testing with Xvfb!
ansible
will install and configure all necessary dependencies(not JavaScript)
(not JavaScript)
...
config.vm.network 'forwarded_port', guest: 5900, host: 5901
config.vm.provision :ansible do |ansible|
ansible.playbook = 'playbook.yml'
end
...
playbook.yml
(not JavaScript)
cd /vagrant
git clone https://github.com/PolymerElements/iron-ajax.git
cd core-ajax
bower install
How do we know Chrome and Firefox really ran?
And what about debugging?
sudo apt-get install x11vnc
x11vnc -display :0 &
brew install Caskroom/cask/tigervnc-viewer
...start Tiger VNC Viewer on localhost:5901
remmber this from the Vagrantfile
?
...
config.vm.network 'forwarded_port', guest: 5900, host: 5901
...
VMs are cool but what about containers?
(not JavaScript)
Execute wct
in a Docker container running Xvfb!
Dockerfile
specs out how to build the Docker image.
FROM nodesource/trusty:latest
RUN apt-get update;
# install Chrome
RUN apt-get install -y curl
RUN curl -sL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list.d/google.list
RUN apt-get update
RUN apt-get install -y google-chrome-stable
# install Firefox 46
RUN apt-get install -y wget tar
RUN wget -O /usr/local/firefox-46.0.1.tar.bz2 http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/46.0.1/linux-x86_64/en-US/firefox-46.0.1.tar.bz2
RUN tar xvjf /usr/local/firefox-46.0.1.tar.bz2 -C /usr/local
RUN ln -s /usr/local/firefox/firefox /usr/bin/firefox
# install xvfb
RUN apt-get install -y xvfb;
# install java; needed by selenium
RUN apt-get install -y default-jre
# install web-component-tester & bower globally
RUN npm install -g web-component-tester
RUN npm install -g bower
# configure bower
RUN echo '{ "allow_root": true }' > /root/.bowerrc
github.com/mdb/docker-wct uses TravisCI.
So...read the .travis.yml
if you're confused.
And take a gander at its TravisCI builds.
docker pull clapclapexcitement/wct
...
docker run -it \
-v $(pwd)/iron-ajax:/usr/src/app \
--security-opt seccomp:unconfined \
clapclapexcitement/wct bash \
-c "bower install && xvfb-run wct --skip-selenium-install"
iron-ajax
repo from your Mac into containersecurity-opt
to deal with Chrome's use of seccomp sandboxingHow do we know the browsers really ran?
And what about visual debugging?
I demo'd this for a VM, but what about a container?
VNC could work but let's get weird.
socat
- networking utility; expose the Mac's Xquartz socket to the container on a TCP port$DISPLAY
as the container's $DISPLAY
-e DISPLAY=192.168.65.1:0
Docker option(What's that weird IP? Docker on Mac requires VirtualBox; it's the VirtualBox host IP)