├── .gitignore ├── README.md ├── Vagrantfile ├── files ├── bowerrc └── deb_nodesource_com_node.pref └── playbook.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | iron-ajax 3 | playbook.retry 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # polymer-testing-box 2 | 3 | A ready-to-go headless Ubuntu box for running Polymer [web-component-tester](https://github.com/Polymer/web-component-tester) 4 | in Chrome and Firefox headlessly via Xvfb. 5 | 6 | This also provides Flash support via Google Chrome, which ships with the Flash Pepper plugin. 7 | 8 | ## Technologies 9 | 10 | * Node.js, bower, web-component-tester 11 | * Firefox, Google Chrome 12 | * Xvfb 13 | 14 | ## Getting started 15 | 16 | Install [Vagrant](https://www.vagrantup.com) & [ansible](http://www.ansible.com). 17 | 18 | 1. `vagrant up` to provision the box with the ansible playbook 19 | 2. `vagrant ssh` to shell into the box 20 | 3. `cd /vagrant` to enter the directory syncd to your host machine 21 | 4. `git clone https://github.com/PolymerElements/iron-ajax.git` to clone a Polymer web component 22 | 5. `cd iron-ajax` 23 | 5. `git checkout 1.3.0` to check out an official release with passing tests 24 | 6. `bower install` 25 | 7. `xvfb-run wct` to run web-component-tester in Firefox & Chrome. 26 | 27 | ## Bonus - debug from your Mac via VNC 28 | 29 | The Vagrant box has no GUI, but your Mac does! Connect to the Vagrant box from 30 | your Mac via VNC to observe and debug. 31 | 32 | Install & run x11vnc on the vagrant box 33 | 34 | 1. `vagrant ssh` 35 | 2. `sudo apt-get install x11vnc` 36 | 3. `x11vnc -display :0 &` 37 | 38 | Install and run Tiger VNC Viewer on your Mac 39 | 40 | 1. `brew install Caskroom/cask/tigervnc-viewer` 41 | 2. start Tiger VNC viewer on `localhost:5901` 42 | 43 | Run the tests on the Vagrant box and watch from Tiger VNC Viewer: 44 | 45 | ``` 46 | DISPLAY=:0 xvfb-run wct 47 | ``` 48 | 49 | ## Next Steps 50 | 51 | Deploy to AWS? Digital Ocean? OpenStack? 52 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | VAGRANTFILE_API_VERSION = "2" 5 | 6 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 7 | config.vm.box = "ubuntu/xenial64" 8 | 9 | config.vm.network 'forwarded_port', guest: 5900, host: 5901 10 | 11 | config.vm.provision :ansible do |ansible| 12 | ansible.playbook = 'playbook.yml' 13 | end 14 | 15 | # bump up the allocated video memory beyond the 12MB VirtualBox default 16 | # this seemingly allows more successful Flash video playback w/out crashing 17 | config.vm.provider :virtualbox do |vb| 18 | vb.customize ['modifyvm', :id, '--vram', '30'] 19 | vb.memory = 1024 20 | vb.cpus = 2 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /files/bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "allow_root": true 3 | } 4 | -------------------------------------------------------------------------------- /files/deb_nodesource_com_node.pref: -------------------------------------------------------------------------------- 1 | Package: * 2 | Pin: release o=Node Source 3 | Pin-Priority: 500 4 | -------------------------------------------------------------------------------- /playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: yes 4 | vars: 5 | firefox_version: 46.0 6 | 7 | pre_tasks: 8 | - name: install python2 9 | raw: sudo apt-get -y install python-simplejson 10 | 11 | tasks: 12 | - name: add Google public key to apt 13 | apt_key: 14 | url: https://dl-ssl.google.com/linux/linux_signing_key.pub 15 | state: present 16 | 17 | - name: add Google to apt-get repositories 18 | apt_repository: 19 | repo: 'deb http://dl.google.com/linux/chrome/deb/ stable main' 20 | state: present 21 | 22 | - name: Add Nodesource apt key 23 | apt_key: 24 | url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280 25 | id: "68576280" 26 | state: present 27 | 28 | - name: add NodeSource deb repository 29 | apt_repository: 30 | repo: 'deb https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main' 31 | state: present 32 | 33 | - name: add NodeSource deb-src repository 34 | apt_repository: 35 | repo: 'deb-src https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main' 36 | state: present 37 | 38 | - name: add NodeSource repository preferences 39 | copy: 40 | src: files/deb_nodesource_com_node.pref 41 | dest: /etc/apt/preferences.d/deb_nodesource_com_node.pref 42 | 43 | - apt: "name={{ item }} state=installed update_cache=yes" 44 | with_items: 45 | - dbus-x11 46 | - default-jre 47 | - git 48 | - google-chrome-stable 49 | - nodejs 50 | - python 51 | - xvfb 52 | 53 | - name: download Firefox 54 | get_url: 55 | url: "http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/{{ firefox_version }}/linux-x86_64/en-US/firefox-{{ firefox_version }}.tar.bz2" 56 | dest: "/tmp/firefox-{{ firefox_version }}.tar.bz2" 57 | mode: 0644 58 | 59 | - name: Unarchive Firefox 60 | unarchive: 61 | src: "/tmp/firefox-{{ firefox_version }}.tar.bz2" 62 | dest: /opt/ 63 | copy: no 64 | 65 | - name: symlink /opt/firefox/firefox to /usr/bin/firefox 66 | file: 67 | src: /opt/firefox/firefox 68 | dest: /usr/bin/firefox 69 | state: link 70 | 71 | - name: symlink /user/bin/nodejs to /usr/bin/node 72 | file: 73 | src: /usr/bin/nodejs 74 | dest: /usr/bin/node 75 | state: link 76 | 77 | - name: install bower and web-component-tester via npm 78 | npm: "name={{ item }} global=yes" 79 | with_items: 80 | - bower 81 | - web-component-tester 82 | 83 | - name: configure bower 84 | copy: 85 | src: files/bowerrc 86 | dest: /root/.bowerrc 87 | --------------------------------------------------------------------------------