Skip to content

Commit

Permalink
Nightwatch tests on Sauce Labs (#3572)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdesjardins authored Nov 2, 2016
1 parent cd7fefb commit 6b66b09
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ sudo: false
language: node_js
node_js:
- 6
env:
global:
- SAUCE_USERNAME=RES-Auto
addons:
jwt:
# SAUCE_ACCESS_KEY=<secure>
secure: hHF06xHY6pLdxscwYhUHdSRuUH2CPA61AUrvPiW54lnMwwkDvCQakR+aY5HbjptFIfOwkWsS4xoqXH4pZTfhMOji32S/+ELT+AqLdkIgnLYDfBj4RcsZoXyvuiLx29i4PVCnGMikctBp4dM6wORgfd1tu3uwhcoQrBjxCMW1qmY=
script:
- npm run eslint
- npm run sass-lint
Expand All @@ -10,6 +17,11 @@ script:
- npm run jpm -- xpi
- npm run jpm-beta -- xpi
- node dist/node/loader.entry.js
# do not run integration tests on deploy builds
- |
if [ -z "$TRAVIS_TAG" ]; then
npm run test-integration
fi
after_success:
- npm run report-coverage
branches:
Expand Down
27 changes: 27 additions & 0 deletions nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-disable import/no-commonjs, import/no-nodejs-modules */

const fs = require('fs');

const chromeManifest = require('./chrome/manifest.json');

const chromePackage = fs.readFileSync('dist/zip/chrome.zip').toString('base64');

module.exports = {
src_folders: ['tests'],
test_settings: {
default: {
selenium_host: 'ondemand.saucelabs.com',
selenium_port: 80,
username: process.env.SAUCE_USERNAME,
access_key: process.env.SAUCE_ACCESS_KEY,
desiredCapabilities: {
browserName: 'chrome',
version: chromeManifest.minimum_chrome_version,
chromeOptions: {
args: ['--no-sandbox'],
extensions: [chromePackage],
},
},
},
},
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"lint-fix": "eslint . --fix",
"test": "cross-env NODE_ENV=test ava",
"coverage": "cross-env NODE_ENV=test nyc ava",
"test-integration": "nightwatch",
"report-coverage": "nyc report --reporter=text-lcov | coveralls",
"version": "node build/version.js"
},
Expand Down Expand Up @@ -112,6 +113,7 @@
"jsdom": "9.6.0",
"json-loader": "0.5.4",
"mustache-loader": "0.4.0",
"nightwatch": "0.9.8",
"node-sass": "3.10.1",
"nyc": "8.3.1",
"postcss-loader": "0.13.0",
Expand Down
5 changes: 5 additions & 0 deletions tests/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"import/no-commonjs": 0
}
}
10 changes: 10 additions & 0 deletions tests/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
'settings button exists': browser => {
browser
// lightweight page that still has the userbar
.url('https://www.reddit.com/wiki/pages')
.waitForElementVisible('#header', 1000)
.waitForElementVisible('#RESSettingsButton', 1000)
.end();
}
};

0 comments on commit 6b66b09

Please sign in to comment.