Skip to content
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

this.element missing in acceptance tests #80

Open
simonihmig opened this issue Aug 28, 2018 · 1 comment
Open

this.element missing in acceptance tests #80

simonihmig opened this issue Aug 28, 2018 · 1 comment

Comments

@simonihmig
Copy link
Member

All the properties that setupApplicationTest() sets up on your test's this context exist properly, except for element (the tests's root element). This is due to two unfortunate coincidences:

This means the lazily added element does not get added to the actual yadda context that the step function will see, so this.element is undefined there.

Don't know yet how to best fix this. For now you can workaround this by not using this.element but find()/findAll() (exposed by @ember/test-helpers) instead!

@lolmaus
Copy link
Contributor

lolmaus commented Sep 24, 2018

The code from ember-test-helpers has no dependencies:

      if (EmberENV._APPLICATION_TEMPLATE_WRAPPER !== false) {
        context.element = document.querySelector('#ember-testing > .ember-view');
      } else {
        context.element = document.querySelector('#ember-testing');
      }

It looks pretty safe to be copied over to ember-cli-yadda.

Alternatively, we could work with ember-test-helpers to expose it as an utility function, so that it can be reused in other addons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants