diff --git a/circle.yml b/circle.yml index 7f60d0ca..b7e6234f 100644 --- a/circle.yml +++ b/circle.yml @@ -35,8 +35,7 @@ jobs: path: coverage integration_tests: docker: - - image: circleci/node:10 - - image: selenium/standalone-firefox + - image: circleci/node:10-browsers steps: - checkout - restore_cache: @@ -46,7 +45,9 @@ jobs: key: send-int-{{ checksum "package-lock.json" }} paths: - node_modules - - run: npm run circleci-test-integration + - run: + name: Run integration test + command: ./scripts/bin/run-integration-test-circleci.sh deploy_dev: machine: true steps: diff --git a/package.json b/package.json index 659c77b1..a6a02305 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,7 @@ "wdio-firefox-profile-service": "^0.1.3", "wdio-mocha-framework": "^0.6.3", "wdio-sauce-service": "^0.4.14", + "wdio-selenium-standalone-service": "0.0.12", "wdio-spec-reporter": "^0.1.5", "webdriverio": "^4.14.3", "webpack": "4.28.4", @@ -152,6 +153,7 @@ "node-fetch": "^2.3.0", "raven": "^2.6.4", "redis": "^2.8.0", + "selenium-standalone": "^6.15.6", "ua-parser-js": "^0.7.19", "websocket-stream": "^5.1.2" }, diff --git a/scripts/bin/run-integration-test-circleci.sh b/scripts/bin/run-integration-test-circleci.sh new file mode 100755 index 00000000..183e478c --- /dev/null +++ b/scripts/bin/run-integration-test-circleci.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -ex + +GECKODRIVER_URL=$( + curl -s 'https://api.github.com/repos/mozilla/geckodriver/releases/latest' | + python -c "import sys, json; r = json.load(sys.stdin); print([a for a in r['assets'] if 'linux64' in a['name']][0]['browser_download_url']);" +); + + +curl -L -o geckodriver.tar.gz $GECKODRIVER_URL +gunzip -c geckodriver.tar.gz | tar xopf - +chmod +x geckodriver +sudo mv geckodriver /bin +geckodriver --version +# Install pip +sudo apt-get install python-pip +sudo pip install --upgrade pip + +sudo pip install mozdownload mozinstall==1.15 + +mkdir -p ~/project/firefox-downloads/ +find ~/project/firefox-downloads/ -type f -mtime +90 -delete +mozdownload --version latest --type daily --destination ~/project/firefox-downloads/firefox_nightly/ + +export PATH=~/project/firefox:$PATH +mozinstall $(ls -t firefox-downloads/firefox_nightly/*.tar.bz2 | head -1) +firefox --version + npm run circleci-test-integration \ No newline at end of file diff --git a/test/integration/download-tests.js b/test/integration/download-tests.js index b1d8aab9..49373467 100644 --- a/test/integration/download-tests.js +++ b/test/integration/download-tests.js @@ -51,9 +51,10 @@ describe('Firefox Send', function() { browser.waitForExist(downloadPage.downloadComplete); browser.back(); browser.waitForExist('send-archive'); - assert.equal( - browser.getText('send-archive > div:first-of-type').substring(0, 24), - 'Expires after 1 download' + assert( + browser + .getText('send-archive > div:first-of-type') + .includes('Expires after 1 download') ); }); }); diff --git a/test/integration/homepage-tests.js b/test/integration/homepage-tests.js index 2c98e207..22a3e9d4 100644 --- a/test/integration/homepage-tests.js +++ b/test/integration/homepage-tests.js @@ -3,12 +3,16 @@ const assert = require('assert'); const HomePage = require('./pages/desktop/home_page'); describe('Firefox Send homepage', function() { + this.retries(2); const homePage = new HomePage(); const baseUrl = browser.options['baseUrl']; const footerLinks = ['mozilla', 'legal', 'legal', 'cookies', 'github']; beforeEach(function() { homePage.open(); + if (process.env.ANDROID) { + this.skip(); + } }); it('should have the right title', function() { diff --git a/test/wdio.circleci.conf.js b/test/wdio.circleci.conf.js index 176efc35..64f4f4b8 100644 --- a/test/wdio.circleci.conf.js +++ b/test/wdio.circleci.conf.js @@ -1,6 +1,5 @@ // eslint-disable-next-line node/no-extraneous-require const ip = require('ip'); -const path = require('path'); const common = require('./wdio.common.conf'); /*/ @@ -11,8 +10,7 @@ Config for running selenium from a circleci docker container against localhost exports.config = Object.assign({}, common.config, { baseUrl: `http://${ip.address()}:8000`, - exclude: [path.join(__dirname, './integration/download-tests.js')], maxInstances: 1, bail: 1, - services: [require('./testServer')] + services: [require('./testServer'), 'selenium-standalone'] });