Skip to content

Latest commit

 

History

History
61 lines (37 loc) · 2.81 KB

testing-with-applitools-eyes.md

File metadata and controls

61 lines (37 loc) · 2.81 KB

Writing UI tests with Applitools Eyes

Applitools Eyes is a service that lets us upload and compare screenshots of our site over time.

Getting an account

Consult the Getting Started as a Developer at Code.org document for details on how to gain access to Sauce Labs.

Add your feature to the eyes file

Either add your test to /dashboard/test/ui/features/eyes.feature

OR

add your test to a new .feature file, annotating it with @eyes

If you need to write an eyes test that is specific to a mobile device, make sure it is annotated with @eyes_mobile and not @eyes. By default, @eyes tests will only run against Chrome 33 and @eyes_mobile tests will only run against iPhone.

Run the test

To run locally, you must have the Applitools secret key installed in your locals.yml.

# code-dot-org/locals.yml
applitools_eyes_api_key: 'my_applitools_eyes_key'

You can find that key by logging in and pressing (Profile Icon) -> My API Key.

Try it locally

  1. ./runner.rb -l --html --eyes -f ./path/to/your.feature (running Chromedriver)
  2. Toggle ONLY running @eyes annotated tests with --eyes
  3. Usually the first test run will fail due to there being no baseline yet. In error.log you can see the exact error which usually includes a link to the session
  4. to see your browser run the tests, append --headed to the command
  5. Visit the Applitools sessions dashboard to see your test run
  6. Accept the changes and Save (bottom right)

Try it targeting Sauce Labs

See the UI Testing Instructions for details about running tests in Sauce Labs.

Watch for run on CircleCI and test server deploy

Both on CircleCI In aws/build.rake, as part of the test.code.org CI script, the eyes tests will be run (as of writing, currently only against the Chrome 33 browser and iPhone).

Results will show up in the Selenium HTML output when changes occur. You can navigate to the reported URL from there to accept the new baseline.

CircleCI branch and merge handling

Each time an Eyes UI test is run, it is run with branch set to that branch, and parent_branch set to either the target of a PR with that branch or the default base branch for that given branch (test -> production, staging -> test, [feature branches, etc.] -> staging).

Per Applitools' documentation, we use the copybranch API endpoint to merge baselines when a merge commit is detected on a given branch.

See Also