ember-cli-addon-tests
ember-cli-addon-tests copied to clipboard
Document use cases
This issue is for collecting possible use cases for this addon, as suggested by @stefanpenner, as this can be used in various ways that might not be obvious at the first look. The outcome of this could maybe find its way into the documentation at some point. So please feel free to supplement this with your own cases!
General use cases:
- test for FastBoot compatibility
- test for build artefacts (for addons that plug into the build chain)
Reasons to use this addon as opposed to setting up your tests manually:
-
run addon e2e tests on a temporarily created app. Instead of running tests directly on the addon's dummy app, this can be useful/required:
- when the addon's dummy app is "reserved" for creating a demo page (not uncommon), as addons often don't need acceptance tests that would require the dummy app (just a few examples: https://github.com/cibernox/ember-power-select, https://github.com/kaliber5/ember-bootstrap, https://github.com/ember-animation/liquid-fire)
- when testing with different dependencies, for example different ember versions, even different FastBoot versions, or both (the latter is happening in https://github.com/ronco/ember-cli-head/pull/21/files)
- when testing with different app fixtures, to simulate different ways a user could use the addon (example: https://github.com/simplabs/ember-simple-auth/tree/master/fastboot-tests)
-
the simpler
appmodel (https://github.com/tomdale/ember-cli-addon-tests/blob/master/lib/models/app.js) can be used to run e2e tests on your existing app (rather than a temporary app created by theaddon-test-appmodel), while still abstracting away things like running ember commands, starting a server (and waiting for it to be ready) etc. This is used e.g. in https://github.com/kaliber5/ember-fastboot-app-tests
Another usecase here https://github.com/tomdale/ember-cli-addon-tests/pull/106#issuecomment-315264011
Testing of development server middleware registered by an addon (serverMiddleware hook) is another use case. E.g. ember-cli-content-security-policy verifies that correct HTTP headers are applied: https://github.com/rwjblue/ember-cli-content-security-policy/blob/9a44defc15af31e30a3e05e68f95ca092a07e70f/node-tests/e2e/deliver-test.js#L89-L97
Similar to testing with different dependencies it could be used to test against different options passed to ember commands. E.g. ember-cli-content-security-policy uses it to test that it respects a --live-reload-host option used on ember serve: https://github.com/rwjblue/ember-cli-content-security-policy/blob/9a44defc15af31e30a3e05e68f95ca092a07e70f/node-tests/e2e/deliver-test.js#L158-L181