Skip to content

Commit 827ffdc

Browse files
author
Mike Taylor
committed
Merge pull request #944 from /issues/942/1
Fixes #942. Split up tests so non-auth functional tests can run for PRs from forks.
2 parents fac6a52 + a2da771 commit 827ffdc

File tree

5 files changed

+50
-14
lines changed

5 files changed

+50
-14
lines changed

.travis.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ cache:
1313
- $HOME/.pip-cache/
1414
- $HOME/.selenium/
1515

16+
# limit the depth of the commits we clone
17+
git:
18+
depth: 5
19+
1620
addons:
17-
firefox: "42.0"
21+
firefox: "44.0"
1822

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

3236
install:
@@ -45,6 +49,9 @@ before_script:
4549
- grunt
4650

4751
# now run the tests!
52+
# if this is a pull request from a fork, TRAVIS_SECURE_ENV_VARS will be false, so
53+
# just run the non-auth tests. otherwise, run everything.
4854
script:
4955
- nosetests
50-
- node_modules/.bin/intern-runner reporters=console config=tests/intern user="$USER" pw="$PW"
56+
- [ "${TRAVIS_SECURE_ENV_VARS}" = "false" ] && node_modules/.bin/intern-runner reporters=console config=tests/intern functionalSuites=tests/functional-nonauth
57+
- [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ] && node_modules/.bin/intern-runner reporters=console config=tests/intern user="$USER" pw="$PW"

CONTRIBUTING.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Note: If you install Python on Windows using the MSI installer, it is highly rec
196196
197197
Windows typically doesn't have the *make* tool installed. Windows users without *make* should look at the "detailed setup" section below.
198198
199-
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).
199+
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).
200200
201201
```
202202
sudo apt-add-repository ppa:fkrull/deadsnakes-python2.7
@@ -385,9 +385,12 @@ We use [Intern](http://theintern.io/) to run functional tests.
385385
To run them, make sure you download the Selenium standalone server from the repo root:
386386
387387
``` bash
388-
wget http://selenium-release.storage.googleapis.com/2.46/selenium-server-standalone-2.46.0.jar
388+
wget http://selenium-release.storage.googleapis.com/2.52/selenium-server-standalone-2.52.0.jar
389389
```
390390
391+
**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
392+
if there isn't a newer version of the Selenium standalone server and file a bug on these docs!**
393+
391394
The `firefox` binary will also need to be in your `PATH`. Here's how this can be done on OS X:
392395
393396
``` bash
@@ -397,7 +400,7 @@ export PATH="/Applications/Firefox.app/Contents/MacOS/:$PATH"
397400
Now start Selenium:
398401
399402
``` bash
400-
java -jar selenium-server-standalone-2.46.0.jar
403+
java -jar selenium-server-standalone-2.52.0.jar
401404
```
402405
403406
In a separate terminal window or tab, start the application servers:

tests/functional.js tests/functional-all.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
/*
6-
76
To run a single test suite, use the following from the project root.
87
9-
node_modules/.bin/intern-runner config=tests/intern functionalSuites=tests/functional/foo.js user="username" pw="secret_lies"
8+
node_modules/.bin/intern-runner config=tests/intern \
9+
functionalSuites=tests/functional/foo.js \
10+
user="github_username" \
11+
pw="github_password"
1012
*/
1113

1214
define([

tests/functional-nonauth.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
/*
6+
This file is provided so we can run tests on Travis for pull requests
7+
from forks that don't have access to encrypted environment variables.
8+
9+
node_modules/.bin/intern-runner config=tests/intern \
10+
functionalSuites=tests/functional-nonauth
11+
*/
12+
13+
define([
14+
'./functional/reporting-non-auth.js',
15+
'./functional/comments-non-auth.js',
16+
'./functional/contributors-non-auth.js',
17+
'./functional/index-non-auth.js',
18+
'./functional/issue-list-non-auth.js',
19+
'./functional/issues-non-auth.js',
20+
'./functional/history-navigation-non-auth.js',
21+
'./functional/search-non-auth.js'
22+
], function() {
23+
'use strict';
24+
});

tests/intern.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
66
// These default settings work OK for most people. The options that *must* be changed below are the
77
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.
8-
define(['intern/lib/args'], function (args) {
8+
define(['intern/lib/args'], function(args) {
99
'use strict';
1010

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

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

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

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

0 commit comments

Comments
 (0)