From d77731c270f5118518d0a57cee4aee97ff29a023 Mon Sep 17 00:00:00 2001 From: Michael Giambalvo Date: Fri, 24 Jan 2020 14:03:40 -0800 Subject: [PATCH] fix(release): Pin CircleCI to Chrome v74 We can't upgrade the version of Selenium without transitioning off the control flow and breaking a bunch of people. Chrome v75 introduced the new W3C actions API. Unfortunately, we can't update to support that API without introducing other breakages, so v74 is the last version of Chrome that will work with Protractor 5. You can download a Chrome v74 snapshot from https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/638880/chrome-linux.zip You might also need to pass "--no-sandbox" flag to Chrome --- .circleci/config.yml | 76 ++++++++++++++++++++++++++++++++++++++++++++ circle.yml | 72 ----------------------------------------- spec/environment.js | 9 ++++-- 3 files changed, 83 insertions(+), 74 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..2157ebbbc --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,76 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/node:6.14-browsers + environment: + # Fix issue with selenium-server in containers. + # See http://github.com/SeleniumHQ/docker-selenium/issues/87 + DBUS_SESSION_BUS_ADDRESS: /dev/null + # Chrome v74 is the last version that works perfectly with Protractor. + CHROME_REVISION: 638880 + CHROMEDRIVER_VERSION: 74.0.3729.6 + # To find this revision number: + # 1. Find the exact chrome version you want: https://en.wikipedia.org/wiki/Google_Chrome_version_history + # 2. Put that version in this tool: https://omahaproxy.appspot.com/ + # 3. Take the bumber from "Branch Base Position" + # 4. Look for the closest number to that revision in the snapshots: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/ + # CHROME 74 - 638880 + # CHROME 75 - 652421 + # CHROME 79 - 706915 + steps: + - checkout + - run: + name: Install Dependencies + command: | + sudo apt-get update + sudo apt-get install python-pip openjdk-8-jdk tcpdump + + # Install a specific version of Chrome (not latest) + sudo rm -rf /opt/google + sudo rm /usr/local/bin/chromedriver + wget -q -O chrome.zip https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CHROME_REVISION}/chrome-linux.zip + unzip chrome.zip + rm chrome.zip + sudo ln -sf ${PWD}/chrome-linux/chrome /usr/bin/chromium + sudo ln -sf /usr/bin/chromium /usr/bin/chromium-browser + sudo groupadd -r chrome && sudo useradd -r -g chrome -G audio,video chrome + sudo mkdir -p /home/chrome/reports + sudo chown -R chrome:chrome /home/chrome + + - restore_cache: + key: node_modules-{{ .Branch }}-{{ checksum "package-lock.json" }} + + - run: + name: NPM Install + command: | + npm i + cd testapp && npm i + + - save_cache: + key: node_modules-{{ .Branch }}-{{ checksum "package-lock.json" }} + paths: + - "node_modules" + - "testapp/node_modules" + + - run: + name: Lint + command: ./node_modules/.bin/gulp lint + + - run: + name: Selenium Start + background: true + command: | + ./node_modules/.bin/webdriver-manager update --versions.standalone=3.141.59 --versions.chrome=${CHROMEDRIVER_VERSION} --versions.gecko=v0.26.0 + sudo cp ./node_modules/webdriver-manager/selenium/chromedriver_${CHROMEDRIVER_VERSION} /usr/local/bin/chromedriver + ./node_modules/.bin/webdriver-manager start --versions.standalone=3.141.59 --versions.chrome=${CHROMEDRIVER_VERSION} --versions.gecko=v0.26.0 + + - run: + name: TestApp Start + background: true + command: | + npm start + + - run: + name: Test + command: npm test diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 9a92e3224..000000000 --- a/circle.yml +++ /dev/null @@ -1,72 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: circleci/node:6.14-browsers - environment: - # Fix issue with selenium-server in containers. - # See http://github.com/SeleniumHQ/docker-selenium/issues/87 - DBUS_SESSION_BUS_ADDRESS: /dev/null - steps: - - checkout - - - run: - name: Install Dependencies - command: | - sudo apt-get update - sudo apt-get install python-pip tcpdump - - # Have to update firefox, default is ESR. - sudo pip install --upgrade pip - sudo pip install mozdownload mozinstall - mozdownload --version latest --destination firefox.tar.bz2 - mozinstall firefox.tar.bz2 - sudo cp -R firefox/* /opt/firefox/ - - # Latest chrome is already installed in the default container. - # curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - # sudo dpkg -i google-chrome.deb - # sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome - # rm google-chrome.deb - - - restore_cache: - key: node_modules-{{ .Branch }}-{{ checksum "package-lock.json" }} - - - run: - name: NPM Install - command: | - npm i - cd testapp && npm i - - - save_cache: - key: node_modules-{{ .Branch }}-{{ checksum "package-lock.json" }} - paths: - - "node_modules" - - "testapp/node_modules" - - - run: - name: Lint - command: ./node_modules/.bin/gulp lint - - - run: - name: Selenium Start - background: true - command: | - ./node_modules/.bin/webdriver-manager update - ./node_modules/.bin/webdriver-manager start - - - run: - name: TestApp Start - background: true - command: | - npm start - - # Seems like the new circleci container no longer permits packet introspection on lo, even for root. - # - run: - # name: Extra tcp logging for BlockingProxy - # background: true - # command: sudo tcpdump -i lo 'tcp && dst localhost' -w $CIRCLE_ARTIFACTS/localdump.pcap - - - run: - name: Test - command: npm test diff --git a/spec/environment.js b/spec/environment.js index aa1c99eac..4528ebaef 100644 --- a/spec/environment.js +++ b/spec/environment.js @@ -11,7 +11,12 @@ module.exports = { 'browserName': (process.env.TEST_BROWSER_NAME || 'chrome'), 'version': - (process.env.TEST_BROWSER_VERSION || 'ANY') + (process.env.TEST_BROWSER_VERSION || 'ANY'), + 'chromeOptions': { + args: [ + "--no-sandbox" + ] + } }, // Default http port to host the web server @@ -25,4 +30,4 @@ module.exports = { 'http://' + (process.env.HTTP_HOST || 'localhost') + ':' + (process.env.HTTP_PORT || webServerDefaultPort) -}; \ No newline at end of file +};