Skip to content

Commit

Permalink
Merge pull request #944 from /issues/942/1
Browse files Browse the repository at this point in the history
Fixes #942. Split up tests so non-auth functional tests can run for PRs from forks.
  • Loading branch information
Mike Taylor committed Mar 5, 2016
2 parents fac6a52 + a2da771 commit 827ffdc
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 14 deletions.
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ cache:
- $HOME/.pip-cache/
- $HOME/.selenium/

# limit the depth of the commits we clone
git:
depth: 5

addons:
firefox: "42.0"
firefox: "44.0"

env:
global:
Expand All @@ -25,8 +29,8 @@ env:
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "mkdir -p $HOME/.selenium && cd $HOME/.selenium && wget -nc http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.0.jar"
- java -jar selenium-server-standalone-2.48.0.jar &> /dev/null &
- "mkdir -p $HOME/.selenium && cd $HOME/.selenium && wget -nc http://selenium-release.storage.googleapis.com/2.52/selenium-server-standalone-2.52.0.jar"
- java -jar selenium-server-standalone-2.52.0.jar &> /dev/null &
- cd -

install:
Expand All @@ -45,6 +49,9 @@ before_script:
- grunt

# now run the tests!
# if this is a pull request from a fork, TRAVIS_SECURE_ENV_VARS will be false, so
# just run the non-auth tests. otherwise, run everything.
script:
- nosetests
- node_modules/.bin/intern-runner reporters=console config=tests/intern user="$USER" pw="$PW"
- [ "${TRAVIS_SECURE_ENV_VARS}" = "false" ] && node_modules/.bin/intern-runner reporters=console config=tests/intern functionalSuites=tests/functional-nonauth
- [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ] && node_modules/.bin/intern-runner reporters=console config=tests/intern user="$USER" pw="$PW"
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Note: If you install Python on Windows using the MSI installer, it is highly rec
Windows typically doesn't have the *make* tool installed. Windows users without *make* should look at the "detailed setup" section below.
As an alternative to Windows, a cloud IDE such as [Cloud 9](https://c9.io) can be used for a relatively easier setup. If you take this route, please update to the latest Python version with the following. (This is to avoid `InsecurePlatformWarning` errors that arise when the default Python 2.7.6 is used).
As an alternative to Windows, a cloud IDE such as [Cloud 9](https://c9.io) can be used for a relatively easier setup. If you take this route, please update to the latest Python version with the following. (This is to avoid `InsecurePlatformWarning` errors that arise when the default Python 2.7.6 is used).
```
sudo apt-add-repository ppa:fkrull/deadsnakes-python2.7
Expand Down Expand Up @@ -385,9 +385,12 @@ We use [Intern](http://theintern.io/) to run functional tests.
To run them, make sure you download the Selenium standalone server from the repo root:
``` bash
wget http://selenium-release.storage.googleapis.com/2.46/selenium-server-standalone-2.46.0.jar
wget http://selenium-release.storage.googleapis.com/2.52/selenium-server-standalone-2.52.0.jar
```
**Note: This version is known to work with Firefox 44. If things aren't working with the current stable version of Firefox, check to see
if there isn't a newer version of the Selenium standalone server and file a bug on these docs!**
The `firefox` binary will also need to be in your `PATH`. Here's how this can be done on OS X:
``` bash
Expand All @@ -397,7 +400,7 @@ export PATH="/Applications/Firefox.app/Contents/MacOS/:$PATH"
Now start Selenium:
``` bash
java -jar selenium-server-standalone-2.46.0.jar
java -jar selenium-server-standalone-2.52.0.jar
```
In a separate terminal window or tab, start the application servers:
Expand Down
6 changes: 4 additions & 2 deletions tests/functional.js → tests/functional-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*
To run a single test suite, use the following from the project root.
node_modules/.bin/intern-runner config=tests/intern functionalSuites=tests/functional/foo.js user="username" pw="secret_lies"
node_modules/.bin/intern-runner config=tests/intern \
functionalSuites=tests/functional/foo.js \
user="github_username" \
pw="github_password"
*/

define([
Expand Down
24 changes: 24 additions & 0 deletions tests/functional-nonauth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*
This file is provided so we can run tests on Travis for pull requests
from forks that don't have access to encrypted environment variables.
node_modules/.bin/intern-runner config=tests/intern \
functionalSuites=tests/functional-nonauth
*/

define([
'./functional/reporting-non-auth.js',
'./functional/comments-non-auth.js',
'./functional/contributors-non-auth.js',
'./functional/index-non-auth.js',
'./functional/issue-list-non-auth.js',
'./functional/issues-non-auth.js',
'./functional/history-navigation-non-auth.js',
'./functional/search-non-auth.js'
], function() {
'use strict';
});
10 changes: 5 additions & 5 deletions tests/intern.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
// These default settings work OK for most people. The options that *must* be changed below are the
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.
define(['intern/lib/args'], function (args) {
define(['intern/lib/args'], function(args) {
'use strict';

var siteRoot = args.siteRoot ? args.siteRoot : 'http://localhost:5000';
Expand All @@ -15,8 +15,8 @@ define(['intern/lib/args'], function (args) {
wc: {
pageLoadTimeout: args.wcPageLoadTimeout ? parseInt(args.wcPageLoadTimeout, 10) : 10000,
// user and pw need to be passed in as command-line arguments. See CONTRIBUTING.md
user: args.user || "some username",
pw: args.pw || "some password"
user: args.user || 'some username',
pw: args.pw || 'some password'
},

// The port on which the instrumenting proxy will listen
Expand All @@ -33,8 +33,8 @@ define(['intern/lib/args'], function (args) {
// Beauty, Bob.
reporters: 'pretty',

// Functional test suite(s) to run in each browser once non-functional tests are completed
functionalSuites: [ 'tests/functional' ],
// Unless you pass in a command-line arg saying otherwise, we run all tests by default.
functionalSuites: [ 'tests/functional-all' ],

// A regular expression matching URLs to files that should not be included in code coverage analysis
excludeInstrumentation: /./
Expand Down

0 comments on commit 827ffdc

Please sign in to comment.