This directory contains mocha-driven end-to-end (e2e) tests as well as various fixtures and supporting libraries.
The e2e tests run in two modes: with a device connected, and without. Since the current CI system does not have access to Particle hardware, tests that depend on accessing a device are disabled.
NOTE: Your device will be flashed, etc. Test failures may leave it in a bad state. Please DO NOT use a mission-critical device!
- Disconnect all Particle devices from your computer's USB
- Connect your test device(s) via USB and wait for it to connect to the cloud (breathe cyan)
- run
npm run test:e2e
- run
npm run test:e2e:no-device
Test filenames are formatted like: <environment>.e2e.js
and located within the ./test/e2e
directory.
test/e2e
├── __fixtures__ <-- test fixtures (projects, data, etc)
│ ├── node-proj
│ │ └── ...
│ ├── web-proj
│ │ └── ...
│ └── ...
│
├── lib <-- supporting libraries
│ ├── constants.js
│ └── ...
│
├── browser.e2e.js <-- e2e tests for browser (Chromium) usage
├── node.e2e.js <-- e2e tests for Node.js usage
├── README.md
└── ...
describe()
titles should be title-case, it()
names should be sentence-case. If applicable, tags
should be included after the title. tags
are a comma-delimited set of tokens prefixed with @
(e.g. @device
)
For example:
describe('Browser Usage', () => {
describe('Listing Devices [@device]', () => {
it('Gets authorized devices', async () => {
//...
});
});
});
Tags provide an easy way to filter tests using use mocha's --grep
feature (docs). We use the @device
tag to identify test suites which require a physical Particle hardware device in order to run.
- Programmatic access to the browser's "Connect" dialog is not yet implemented, follow chromium#831982 for updates