From d3c86757ebf4764e6310875586fe29edad37f4b3 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 4 Mar 2016 21:31:23 -0600 Subject: [PATCH 1/5] Issue #942. Rename functional.js to functional-all.js --- tests/{functional.js => functional-all.js} | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename tests/{functional.js => functional-all.js} (79%) diff --git a/tests/functional.js b/tests/functional-all.js similarity index 79% rename from tests/functional.js rename to tests/functional-all.js index 981ebaa00..788b46c2c 100644 --- a/tests/functional.js +++ b/tests/functional-all.js @@ -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([ From d42e46c8f6fe92b5c3dc762e94d703200d30e7d6 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 4 Mar 2016 21:31:50 -0600 Subject: [PATCH 2/5] Issue #942. Run functional-all by default in intern config. --- tests/intern.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/intern.js b/tests/intern.js index 32f3b5443..6822a0d02 100644 --- a/tests/intern.js +++ b/tests/intern.js @@ -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: /./ From d69242291dec4ac0cce35dc650334f5b24ca56b6 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 4 Mar 2016 21:32:16 -0600 Subject: [PATCH 3/5] Issue #942. Add a functionalSuite file for nonauth scenarios. --- tests/functional-nonauth.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/functional-nonauth.js diff --git a/tests/functional-nonauth.js b/tests/functional-nonauth.js new file mode 100644 index 000000000..f7d72a5bb --- /dev/null +++ b/tests/functional-nonauth.js @@ -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'; +}); From 0a49ffb1b67c6d6e1ac49a4725a9d2da821ed000 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 4 Mar 2016 21:35:22 -0600 Subject: [PATCH 4/5] Issue #942. Update Travis to use Firefox 44 and Selenium server 2.52.0. Also update docs in CONTRIBUTING.md --- .travis.yml | 6 +++--- CONTRIBUTING.md | 9 ++++++--- tests/intern.js | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63a869ed0..8dc46f49d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ cache: - $HOME/.selenium/ addons: - firefox: "42.0" + firefox: "44.0" env: global: @@ -25,8 +25,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: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba7a5b0b5..ea5d77cf8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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 @@ -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: diff --git a/tests/intern.js b/tests/intern.js index 6822a0d02..71c87daac 100644 --- a/tests/intern.js +++ b/tests/intern.js @@ -5,7 +5,7 @@ // Learn more about configuring this file at . // 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'; @@ -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 From a2da771274d2adf20744eea19927e8a1fcb1f582 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 4 Mar 2016 21:47:37 -0600 Subject: [PATCH 5/5] Issue #942. Add conditional test running to Travis, based on access to TRAVIS_SECURE_ENV_VARS. --- .travis.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8dc46f49d..f865c47b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,10 @@ cache: - $HOME/.pip-cache/ - $HOME/.selenium/ +# limit the depth of the commits we clone +git: + depth: 5 + addons: firefox: "44.0" @@ -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"