-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test helpers #12
Add test helpers #12
Conversation
name: 'strip-test-selectors', | ||
plugin: StripTestSelectorsTransform | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also removed the StripTestSelectorsTransform from ember-cli-build so the tests would have the selectors.
Currently the tests assume that the [data-test-*]
attributes are stripped. Removing the plugin here won't strip them anymore in the tests and that's why they are failing...
Thank you so much for tackling this @pdud! I think removing the Since |
The test helpers can be imported from the helpers/ember-test-selectors module in the application's namespace: | ||
|
||
```javascript | ||
import { testSelector } from '<app-name>/tests/helpers/ember-test-selectors'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also promote the default
export here...
Thank you very much for the suggestions. I've made those changes :) |
|
||
```javascript | ||
this.$(testSelector('post-title').click() // => this.$('[data-test-post-title]').click() | ||
this.$(testSelector('selector', 'post-title').click() // => this.$('[data-test-selector="post-title"]').click() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are closing )
's is missing here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😳 fixed now
- Adds test helpers for use in acceptance tests and integration tests - Fixes #8
🎉 |
Hey – thanks for the great addon!
I took a look at #8. The solution is very similar but not exactly as suggested in the last comment
[data-test-selector]
not*[data-test-selector]
testSelector('post-title')
nottestSelector('data-test-post-title')
as in the last comment (but I think that was your original intention anyhow)I also removed the
StripTestSelectorsTransform
from ember-cli-build so the tests would have the selectors.I based the readme additions off ember-simple-auth test helper section.
I'd be happy to make any changes :)