Automated UI tests for the dashboard.
This is the best option for rapid iteration while writing a new test. ChromeDriver will run your tests in a new window on your machine.
- Download the chromedriver
- Start the chromedriver in the background (or a separate window):
/path/to/your/downloaded/chromedriver &
cd
to the directory of this README.bundle install
rbenv rehash
./runner.rb -l
-l
makes it use the chromedriver, and specifies local dashboard and pegasus domains- a window will pop up in the background in which you can watch the tests happen
- In a separate window, run
tail -f *.log
to watch the results of your tests
-f
streams the log in your shell, so it will be updated as new lines are written
- To run a single ui test, you can simply run
rake test:ui feature=path/to/test.feature
Running tests remotely on Saucelabs lets you review results, view visual logs of test runs and even watch live video of your tests running on different browsers in real-time.
We currently have 120 available browsers, and the automated ui tests attempt to run 110.
Saucelabs requires credentials to be set in locals.yml first.
# code-dot-org/locals.yml
saucelabs_username: 'yourusername'
saucelabs_authkey: 'xxxxxx-xxxx-xxxx-xxx-xxxxxxxxx'
You can find the values for these settings in your saucelabs account. It says "welcome, [username]" up top, and the access key is at the bottom of the grey box on the left.
If you want to run tests on saucelabs against localhost you need to set up your tunnel:
- Download and run the saucelabs tunnel
~/bin/sc/ -u $SAUCELABS_USERNAME -k SAUCELABS_ACCESS_KEY
(the above documentation link has a example command line with your credentials that you can copy)./runner.rb -d localhost-studio.code.org:3000 <whatever other arguments you want>
You can now watch your tests run at the saucelabs dashboard
Here are some example command line options. Run ./runner.rb --help
for a full list.
Run all UI tests on all browsers against your local host (by default, tests point to staging.code.org). Takes some around 45 minutes to run depending on your setup. If you are testing browsers against your localhost other than Chrome, you need to setup SauceConnect - instructions are here https://wiki.saucelabs.com/display/DOCS/Setting+Up+Sauce+Connect.
./runner.rb -d localhost.studio.code.org:3000
Alternatively, ./runner.rb -d localhost.studio.code.org:3000 -p <some number>
will run "some number" of tests in parallel - it might be faster though too high a number will overwhelm your host. 5 seems to work well.
Run all UI tests using the local chromedriver against your localhost. Faster than running through Saucelabs.
./runner.rb -l
Run all UI tests for a given browser/os combination - full list of combinations is in browsers.json
./runner.rb --config ChromeLatestWin7
Run all UI tests for a given browser
./runner.rb --browser Chrome
Run all tests in a given feature file for all browser/os combinations
./runner.rb --feature features/awesomeStuff.feature
Run exactly one UI test in a given feature file for all browser/os combinations
./runner.rb --feature features/awesomeStuff.feature:40
will run the feature on line 40
Run the eyes tests
./runner.rb --eyes
- If you're new to Cucumber, read about Cucumber scenarios, especially the keywords Given When Then.
- When debugging test scripts, it can be helpful to add pauses, such as:
And I wait for 5 seconds
.