scratch-www/test
2024-10-25 11:19:37 +03:00
..
__mocks__ mock MediaQuery 2019-08-18 04:47:06 +02:00
fixtures Add test for loading, copying, and remixing projects 2022-05-26 12:21:45 -04:00
health ci: check server health before starting integration tests 2023-10-25 14:33:54 -07:00
helpers style(test): enable ES6 and Jest eslint rules for tests 2023-10-24 14:03:18 -07:00
integration fix: use Title Caps for DSA Requirements link label 2024-10-17 07:00:31 -07:00
integration-legacy test: fix tests to not use chromedriver npm wrapper 2024-02-26 16:21:02 -08:00
localization Add Jest, Enzyme, and sample tests 2019-07-17 15:27:13 -04:00
localization-legacy style(test): enable ES6 and Jest eslint rules for tests 2023-10-24 14:03:18 -07:00
unit refactor: [UEPR-71] changed user eligibility logic 2024-10-25 11:19:37 +03:00
unit-legacy style(test): enable ES6 and Jest eslint rules for tests 2023-10-24 14:03:18 -07:00
.eslintrc.js style: fix automatically-fixable lint issues 2024-02-26 10:10:19 -08:00
README.md test: fix tests to not use chromedriver npm wrapper 2024-02-26 16:21:02 -08:00

Requirements

  • Selenium
    • See this directory's package.json
  • TAP
    • In the scratch-www repo's package.json
  • A Chrome-compatible browser (Chrome, Chromium, etc.)
  • Chromedriver
    • Note: Chromedriver may come bundled with your browser, so you may not need to install it separately

Running the tests

  • By default, tests run against our Staging instance, but you can pass in a different location if you want to run the tests against e.g. your local build
  • Tests can be run using Saucelabs, an online service that can test browser/os combinations remotely. Currently all tests are written for use for chrome on mac.

Using tap

  • Run all tests in the smoke-testing directory from the command-line: $ SMOKE_USERNAME=username SMOKE_PASSWORD=password ROOT_URL=https://scratch.mit.edu npm run smoke
  • To run a single file from the command-line: $ SMOKE_USERNAME=username SMOKE_PASSWORD=password ROOT_URL=https://scratch.mit.edu node_modules/.bin/tap ./test/integration/smoke-testing/filename.js --timeout=3600
    • The timeout var is for the length of the entire tap test-suite; if you are getting a timeout error, you may need to adjust this value (some of the Selenium tests take a while to run)
  • To run tests using saucelabs run this command $ SMOKE_USERNAME=username SMOKE_PASSWORD=password SAUCE_USERNAME=saucelabsUsername SAUCE_ACCESS_KEY=saucelabsAccessKey ROOT_URL=https://scratch.mit.edu npm run smoke-sauce

Configuration

Variable Default Description
ROOT_URL scratch.ly Location you want to run the tests against
SMOKE_USERNAME None Username for Scratch user you're signing in with to test
SMOKE_PASSWORD None Password for Scratch user you're signing in with to test
SMOKE_REMOTE false Tests with Sauce Labs or not. True if running smoke-sauce
SMOKE_HEADLESS false Run browser in headless mode. Flaky at the moment
SAUCE_USERNAME None Username for your Sauce Labs account
SAUCE_ACCESS_KEY None Access Key for Sauce Labs found under User Settings

Using Saucelabs

  • You will need a Saucelabs account in order to use it for testing. To find the Access Key, click your username and select User Settings from the dropdown menu. Near the bottom of the page is your access key that you can copy and use in the command line.