Update config for running download tests on CI

This commit is contained in:
Benjamin Forehand Jr 2019-03-12 20:47:54 -04:00
parent 15704cb6dc
commit bada0707c5
6 changed files with 45 additions and 11 deletions

View File

@ -35,8 +35,7 @@ jobs:
path: coverage path: coverage
integration_tests: integration_tests:
docker: docker:
- image: circleci/node:10 - image: circleci/node:10-browsers
- image: selenium/standalone-firefox
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
@ -46,7 +45,9 @@ jobs:
key: send-int-{{ checksum "package-lock.json" }} key: send-int-{{ checksum "package-lock.json" }}
paths: paths:
- node_modules - node_modules
- run: npm run circleci-test-integration - run:
name: Run integration test
command: ./scripts/bin/run-integration-test-circleci.sh
deploy_dev: deploy_dev:
machine: true machine: true
steps: steps:

View File

@ -25,7 +25,7 @@
"test:backend": "nyc --reporter=lcovonly mocha --reporter=min test/backend", "test:backend": "nyc --reporter=lcovonly mocha --reporter=min test/backend",
"test:frontend": "cross-env NODE_ENV=development node test/frontend/runner.js", "test:frontend": "cross-env NODE_ENV=development node test/frontend/runner.js",
"test:report": "nyc report --reporter=html", "test:report": "nyc report --reporter=html",
"test-integration": "cross-env NODE_ENV=development wdio test/wdio.docker.conf.js", "test-integration": "cross-env NODE_ENV=development ANDROID=1 wdio test/wdio.local.conf.js",
"circleci-test-integration": "cross-env NODE_ENV=development wdio test/wdio.circleci.conf.js", "circleci-test-integration": "cross-env NODE_ENV=development wdio test/wdio.circleci.conf.js",
"start": "npm run clean && cross-env NODE_ENV=development FXA_CLIENT_ID=fced6b5e3f4c66b9 BASE_URL=http://localhost:8080 webpack-dev-server --mode=development", "start": "npm run clean && cross-env NODE_ENV=development FXA_CLIENT_ID=fced6b5e3f4c66b9 BASE_URL=http://localhost:8080 webpack-dev-server --mode=development",
"android": "cross-env ANDROID=1 npm start", "android": "cross-env ANDROID=1 npm start",
@ -126,6 +126,7 @@
"wdio-firefox-profile-service": "^0.1.3", "wdio-firefox-profile-service": "^0.1.3",
"wdio-mocha-framework": "^0.6.3", "wdio-mocha-framework": "^0.6.3",
"wdio-sauce-service": "^0.4.14", "wdio-sauce-service": "^0.4.14",
"wdio-selenium-standalone-service": "0.0.12",
"wdio-spec-reporter": "^0.1.5", "wdio-spec-reporter": "^0.1.5",
"webdriverio": "^4.14.3", "webdriverio": "^4.14.3",
"webpack": "4.28.4", "webpack": "4.28.4",
@ -152,6 +153,7 @@
"node-fetch": "^2.3.0", "node-fetch": "^2.3.0",
"raven": "^2.6.4", "raven": "^2.6.4",
"redis": "^2.8.0", "redis": "^2.8.0",
"selenium-standalone": "^6.15.6",
"ua-parser-js": "^0.7.19", "ua-parser-js": "^0.7.19",
"websocket-stream": "^5.1.2" "websocket-stream": "^5.1.2"
}, },

View File

@ -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

View File

@ -51,9 +51,10 @@ describe('Firefox Send', function() {
browser.waitForExist(downloadPage.downloadComplete); browser.waitForExist(downloadPage.downloadComplete);
browser.back(); browser.back();
browser.waitForExist('send-archive'); browser.waitForExist('send-archive');
assert.equal( assert(
browser.getText('send-archive > div:first-of-type').substring(0, 24), browser
'Expires after 1 download' .getText('send-archive > div:first-of-type')
.includes('Expires after 1 download')
); );
}); });
}); });

View File

@ -3,12 +3,16 @@ const assert = require('assert');
const HomePage = require('./pages/desktop/home_page'); const HomePage = require('./pages/desktop/home_page');
describe('Firefox Send homepage', function() { describe('Firefox Send homepage', function() {
this.retries(2);
const homePage = new HomePage(); const homePage = new HomePage();
const baseUrl = browser.options['baseUrl']; const baseUrl = browser.options['baseUrl'];
const footerLinks = ['mozilla', 'legal', 'legal', 'cookies', 'github']; const footerLinks = ['mozilla', 'legal', 'legal', 'cookies', 'github'];
beforeEach(function() { beforeEach(function() {
homePage.open(); homePage.open();
if (process.env.ANDROID) {
this.skip();
}
}); });
it('should have the right title', function() { it('should have the right title', function() {

View File

@ -1,6 +1,5 @@
// eslint-disable-next-line node/no-extraneous-require // eslint-disable-next-line node/no-extraneous-require
const ip = require('ip'); const ip = require('ip');
const path = require('path');
const common = require('./wdio.common.conf'); const common = require('./wdio.common.conf');
/*/ /*/
@ -10,9 +9,8 @@ Config for running selenium from a circleci docker container against localhost
/*/ /*/
exports.config = Object.assign({}, common.config, { exports.config = Object.assign({}, common.config, {
baseUrl: `http://${ip.address()}:8000`, baseUrl: `http://${ip.address()}:8080`,
exclude: [path.join(__dirname, './integration/download-tests.js')],
maxInstances: 1, maxInstances: 1,
bail: 1, bail: 1,
services: [require('./testServer')] services: [require('./testServer'), 'selenium-standalone']
}); });