|
| 1 | +version: 2 |
| 2 | +jobs: |
| 3 | + build: |
| 4 | + docker: |
| 5 | + - image: circleci/node:6.14-browsers |
| 6 | + environment: |
| 7 | + # Fix issue with selenium-server in containers. |
| 8 | + # See http://github.com/SeleniumHQ/docker-selenium/issues/87 |
| 9 | + DBUS_SESSION_BUS_ADDRESS: /dev/null |
| 10 | + # Chrome v74 is the last version that works perfectly with Protractor. |
| 11 | + CHROME_REVISION: 638880 |
| 12 | + CHROMEDRIVER_VERSION: 74.0.3729.6 |
| 13 | + # To find this revision number: |
| 14 | + # 1. Find the exact chrome version you want: https://en.wikipedia.org/wiki/Google_Chrome_version_history |
| 15 | + # 2. Put that version in this tool: https://omahaproxy.appspot.com/ |
| 16 | + # 3. Take the bumber from "Branch Base Position" |
| 17 | + # 4. Look for the closest number to that revision in the snapshots: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/ |
| 18 | + # CHROME 74 - 638880 |
| 19 | + # CHROME 75 - 652421 |
| 20 | + # CHROME 79 - 706915 |
| 21 | + steps: |
| 22 | + - checkout |
| 23 | + - run: |
| 24 | + name: Install Dependencies |
| 25 | + command: | |
| 26 | + sudo apt-get update |
| 27 | + sudo apt-get install python-pip openjdk-8-jdk tcpdump |
| 28 | +
|
| 29 | + # Install a specific version of Chrome (not latest) |
| 30 | + sudo rm -rf /opt/google |
| 31 | + sudo rm /usr/local/bin/chromedriver |
| 32 | + wget -q -O chrome.zip https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CHROME_REVISION}/chrome-linux.zip |
| 33 | + unzip chrome.zip |
| 34 | + rm chrome.zip |
| 35 | + sudo ln -sf ${PWD}/chrome-linux/chrome /usr/bin/chromium |
| 36 | + sudo ln -sf /usr/bin/chromium /usr/bin/chromium-browser |
| 37 | + sudo groupadd -r chrome && sudo useradd -r -g chrome -G audio,video chrome |
| 38 | + sudo mkdir -p /home/chrome/reports |
| 39 | + sudo chown -R chrome:chrome /home/chrome |
| 40 | +
|
| 41 | + - restore_cache: |
| 42 | + key: node_modules-{{ .Branch }}-{{ checksum "package-lock.json" }} |
| 43 | + |
| 44 | + - run: |
| 45 | + name: NPM Install |
| 46 | + command: | |
| 47 | + npm i |
| 48 | + cd testapp && npm i |
| 49 | +
|
| 50 | + - save_cache: |
| 51 | + key: node_modules-{{ .Branch }}-{{ checksum "package-lock.json" }} |
| 52 | + paths: |
| 53 | + - "node_modules" |
| 54 | + - "testapp/node_modules" |
| 55 | + |
| 56 | + - run: |
| 57 | + name: Lint |
| 58 | + command: ./node_modules/.bin/gulp lint |
| 59 | + |
| 60 | + - run: |
| 61 | + name: Selenium Start |
| 62 | + background: true |
| 63 | + command: | |
| 64 | + ./node_modules/.bin/webdriver-manager update --versions.standalone=3.141.59 --versions.chrome=${CHROMEDRIVER_VERSION} --versions.gecko=v0.26.0 |
| 65 | + sudo cp ./node_modules/webdriver-manager/selenium/chromedriver_${CHROMEDRIVER_VERSION} /usr/local/bin/chromedriver |
| 66 | + ./node_modules/.bin/webdriver-manager start --versions.standalone=3.141.59 --versions.chrome=${CHROMEDRIVER_VERSION} --versions.gecko=v0.26.0 |
| 67 | +
|
| 68 | + - run: |
| 69 | + name: TestApp Start |
| 70 | + background: true |
| 71 | + command: | |
| 72 | + npm start |
| 73 | +
|
| 74 | + - run: |
| 75 | + name: Test |
| 76 | + command: npm test |
0 commit comments