language: node_js
dist: trusty
addons:
  apt:
    packages:
      # This is required to run new chrome on old trusty
      - libnss3
notifications:
  email: false
cache:
  directories:
    - node_modules
sudo: required
node_js:
  - "12.13.0"
env:
  #global:
  #  - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=0
# allow headful tests
before_install:
  ###- node node_modules/puppeteer/install.js //used to work, but now breaks
  # Enable user namespace cloning
  - "sysctl kernel.unprivileged_userns_clone=1"
  # Launch XVFB
  - "export DISPLAY=:99.0"
  # - export CHROME_PATH="$(pwd)/chrome-linux/chrome"
  - "sh -e /etc/init.d/xvfb start"
  # wait for xvfb to boot 
  - sleep 3 
  # start your web application and listen on `localhost`
  # - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
install:
  - npm install
  - npm install -g puppeteer --unsafe-perm=true --allow-root
  # - yarn add --dev jest-puppeteer
  # - yarn add puppeteer
script:
  - npm run testCI