Skip to content

Latest commit

 

History

History
75 lines (48 loc) · 4.06 KB

testing.md

File metadata and controls

75 lines (48 loc) · 4.06 KB

Testing

Run the entire test suite using npm test.

Linting

To check code against the project's style guides, use npm run lint. Use npm run lint:scss or npm run lint:js to check SCSS or JS files separately.

Unit Tests

Unit tests are run using the Jest testing framework. Unit tests ran as part of the main testing suite, i.e. npm test. Use npm test:unit to run unit tests individually. Note: Make sure to run npm run getcapabilities and npm run build:config first to build the configuration.

To test against a different time zone, run npm run test:unit:tz. Note: This currently doesn't work in Windows.

To view the unit test code coverage, run npm run test:coverage. Use npm run test:unit:coverage or npm run test:unit:tz:coverage to run coverage tests individually.

End-to-end Tests

End to end tests are integrated into our CI and are required to pass before a submission is accepted. New features should be accompanied by End to End tests to cover any new functionality you add.

Run end-to-end tests using npm run e2e

To run the end-to-end tests using Firefox in a docker container, create an image using npm run docker:image. Run the tests with npm run docker:e2e. See the Docker page for more information.

Browserstack

Run npm run browserstack to test the app in Chrome(OS X and Windows), Firefox(Windows), and Safari(OS X) on BrowserStack. The tests run the nightwatch.js features found in ./e2e/features using Selenium.

To run tests in BrowserStack from your local machine:

  1. Log into BrowserStack and get your username and access key from the upper left.
  2. Add the following to your shell configuration (.bashrc or .profile);
export BROWSERSTACK_ACCESS_KEY=yourkeyhere
export BROWSERSTACK_USER=yourusernamehere

Selenium Drivers

(Note) Driver reliability varies between Operating systems. Using local selenium drivers to run tests is more useful as a development tool for creating new tests than it is for verifying if all tests are passing.

To run tests on your machine using a Chrome driver: Run npm run e2e:chrome.

To run tests on your machine using a Firefox driver:

  1. Create a new Firefox profile called 'nightwatch'.
  2. Run npm run e2e:firefox.

To run tests for both browsers in sequence: npm run e2e.

Developing new End to End Tests

  • When creating new tests you will likely want to work locally with a Chrome or Firefox driver to expedite the development process.
  • If there is a specific test that you would like to run, you can change the files variable found in ./e2e/browserstack.conf.js to point directly to your test.
  • If there is a specific browser that you would like to test, you can specify which in ./e2e/environments.json

Debug Parameters

Parameter Type Value Description
mockEvents String 20170530 Use the static JSON file with event feeds found at mock/events_data.json-X
mockFutureLayer String VIIRS_NOAA20_CorrectedReflectance_TrueColor,5D Pass layer id and futureTime to be parsed and added to that layer on page load
mockSources String 20170530 Use the static JSON file with sources feeds found at mock/sources_data.json-X
mockAlerts string alert, message, outage, no_types, or all_types Use a static JSON file by passing the notification type. Local sources can be found at mock/notify_{string}.json
now date YYYY-MM-DDThh:mm:ssZ Overrides the current date and time. This can be accessed on config.initialDate or state.date.appNow.
showError boolean true or false If any value is specified, an error dialog will be shown on startup.
notificationURL string https://testing.url.com Overrides the notification URL found in the features.json configuration file.
imageDownload string https://wvs.earthdata.nasa.gov/api/v1/snapshot Overrides the image download URL