Overrides the default Ember.Test.find helper in order to make querying ember-test-selectors' data-test-* attributes as straightforward as possible.
Previously, that addon shipped with a testSelector test helper that expanded a given string to make querying these attributes more straightforward, but it was recently deprecated and will be removed in an upcoming version.
Here's what that used to look like:
Given the following Handlebars template:
<div data-test-my-div>My Div</div>Here's how you might have used the testSelector helper in an acceptance test:
import testSelector from 'ember-test-selectors';
...
test('an element is present', function(assert) {
assert.ok(findWithAssert(testSelector('my-div')), 'My div is present');
});With this addon, there's no need for the ceremony. It's as if Ember.js shipped
with support for using data-test-* attributes out of the box:
test('an element is present', function(assert) {
assert.ok(findWithAssert('my-div'), 'My div is present');
});The string my-div will automatically be expanded to the proper selector,
assuming it is a hyphenated string. Otherwise, it will behave as the default
find helper does.
You can install this addon by running
$ ember install ember-test-selectors-helpers
Afterwards, you'll need to import the test selectors before the startApp()
helper is run:
import overrideHelpers from './helper-overrides';
overrideHelpers();
// startApp()ember serve- Visit your app at http://localhost:4200.
npm test(Runsember try:eachto test your addon against multiple Ember versions)ember testember test --server
ember build
For more information on using ember-cli, visit https://ember-cli.com/.