Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Add android to ci #1266

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ jobs:
- node_modules
- run:
name: Run integration test
environment:
INTEGRATION_TEST_JOB: "circleci-test-integration"
command: ./scripts/bin/run-integration-test-circleci.sh
android_integration_tests:
docker:
- image: circleci/node:10-browsers
steps:
- checkout
- restore_cache:
key: send-int-{{ checksum "package-lock.json" }}
- run: npm install
- save_cache:
key: send-int-{{ checksum "package-lock.json" }}
paths:
- node_modules
- run:
name: Run integration test
environment:
INTEGRATION_TEST_JOB: "circleci-test-integration:android"
command: ./scripts/bin/run-integration-test-circleci.sh
deploy_dev:
machine: true
Expand Down Expand Up @@ -141,11 +160,18 @@ workflows:
ignore: /.*/
tags:
only: /^v.*/
- android_integration_tests:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
- deploy_stage:
requires:
- build
- test
- integration_tests
- android_integration_tests
filters:
branches:
ignore: /.*/
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"test:frontend": "cross-env NODE_ENV=development node test/frontend/runner.js",
"test:report": "nyc report --reporter=html",
"test-integration": "cross-env NODE_ENV=development wdio test/wdio.docker.conf.js",
"test-integration:android": "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:android": "cross-env NODE_ENV=development ANDROID=1 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",
"android": "cross-env ANDROID=1 npm start",
"prod": "node server/bin/prod.js"
Expand Down
2 changes: 1 addition & 1 deletion scripts/bin/run-integration-test-circleci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ mozdownload --version latest --type daily --destination ~/project/firefox-downlo
export PATH=~/project/firefox:$PATH
mozinstall $(ls -t firefox-downloads/firefox_nightly/*.tar.bz2 | head -1)
firefox --version
npm run circleci-test-integration
npm run ${INTEGRATION_TEST_JOB}
26 changes: 26 additions & 0 deletions test/testServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,38 @@ module.exports = {
const wpm = middleware(webpack(config(null, { mode: 'development' })), {
logLevel: 'silent'
});
const ID_REGEX = '([0-9a-fA-F]{10})';

app.use(wpm);

function android(req, res) {
const index = wpm.fileSystem
.readFileSync(wpm.getFilenameFromUrl('/android.html'))
.toString()
.replace(
'<base href="file:///android_asset/" />',
'<base href="http://localhost:8000/" />'
);
res.set('Content-Type', 'text/html');
res.send(index);
}
if (process.env.ANDROID) {
// map all html routes to the android index.html
app.get('/', android);
app.get('/legal', android);
app.get(`/share/:id${ID_REGEX}`, android);
app.get('/completed', android);
app.get('/preferences', android);
app.get('/options', android);
app.get('/oauth', android);
}

assets.setMiddleware(wpm);
expressWs(app, null, { perMessageDeflate: false });
app.ws('/api/ws', require('../server/routes/ws'));
routes(app);
tests(app);

wpm.waitUntilValid(() => {
server = app.listen(8000, resolve);
});
Expand Down
6 changes: 2 additions & 4 deletions test/wdio.local.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ const ip = require('ip');
const common = require('./wdio.common.conf');

/*/

Config for running selenium against localhost

/*/

exports.config = Object.assign({}, common.config, {
baseUrl: `http://${ip.address()}:8000`,
baseUrl: `http://${ip.address()}:8080`,
maxInstances: 1,
bail: 1,
services: [require('./testServer')]
services: [require('./testServer'), 'selenium-standalone']
});