Run the entire test suite using npm test.
To check code against the project's style guides, use npm run lint.
Use npm run lint:css or npm run lint:js to check CSS or JS files separately.
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 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.
Run npm run browserstack to test the app in Chrome(OS X and Windows), Firefox(Windows), Internet Exporer(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:
- Log into BrowserStack and get your username and access key from the upper left.
- Add the following to your shell configuration (
.bashrcor.profile);
export BROWSERSTACK_ACCESS_KEY=yourkeyhere
export BROWSERSTACK_USER=yourusernamehere(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:
- Create a new Firefox profile called 'nightwatch'.
- Run
npm run e2e:firefox.
To run tests for both browsers in sequence: npm run e2e.
-
When creating new tests you will likely want to work locally with a
chromeorFirefoxdriver to expedite the development process. -
If there is a specific test that you would like to run, you can change the
filesvariable found in./e2e/browserstack.conf.jsto 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
| Parameter | Type | Value | Description |
|---|---|---|---|
mockCMR |
string | example:modis_grid (X mock CMR to use) |
Do not query CMR and fetch the static JSON file found at mock/cmr.cgi-X |
timeoutCMR |
ms | N |
Override the CMR timeout value in milliseconds |
mockEvents |
String | 20170530 |
Use the static JSON file with event feeds found at mock/events_data.json-X |
mockEvents |
String | 20170530 |
Use the static JSON file with categories feeds found at mock/categories_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 |
modalView |
string | categories, measurements, or layers |
Forces the 'Add Layers' modal to display categories, measurements, or layers. By default Artic/Antarctic shows measurements and Geographic shows categories. |
now |
date | YYYY-MM-DDThh:mm:ssZ |
Overrides the current date and time. This only works when using the now() function from js/util/util.js. |
showError |
boolean | true or false |
If any value is specified, an error dialog will be shown on startup. |
showSubdaily |
boolean | true or false |
If any value is specified, the hour input, minute input and "minutes" timeline zoom option will be shown. |
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 |