mainmatter/ember-test-selectors

Cannot find module 'ember-test-selectors' in ember > 3.0

cristiangrama opened this issue · 5 comments

I've installed the module using the ember cli and imported it in a test using import { testSelector } from 'ember-test-selectors'. Even tried on brand new app but I always get the error that the module is not found. Not sure what else I should try.

Any ideas?

Considering I am working with a brand new app I assume that I won't need to import anything. That said for anyone having the same issue, just use the selectors described in the documentation https://github.com/simplabs/ember-test-selectors#usage

// in Acceptance Tests:

find('[data-test-post-title]')
find('[data-test-resource-id="2"]')

// in Component Integration Tests:

this.$('[data-test-post-title]').click()
this.$('[data-test-resource-id="2"]').click()

This part of the documentation I've missed about the testSelector deprecation https://github.com/simplabs/ember-test-selectors#deprecations.

find('[data-test-resource-id="2"]')

I think this would be helpful to show in the README examples.

@jeffdaley that snippet is somewhat outdated. Ember apps these days use https://github.com/simplabs/qunit-dom by default (instead of find(...)), and the README does contain a snippet using qunit-dom assertions already.

@Turbo87 I was referring specifically to targeting a data-test- element with a dynamic value (e.g., id="2").

The syntax is obvious in retrospect, but I had to find this example in an old issue to be sure.