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

Integration component test issues after v0.5.31 #176

Closed
calderas opened this issue Aug 31, 2016 · 11 comments
Closed

Integration component test issues after v0.5.31 #176

calderas opened this issue Aug 31, 2016 · 11 comments

Comments

@calderas
Copy link

After the v0.5.31 release, I started getting an error when running tests. The first (alphabetically) integration component test will always fail to render. Event if it's a very simple test that just renders a div it will fail, so it's consistent (in my app).

When using ember exam with multiple partitions I get the same error for different partitions.
But always just the first integration component test (or first ones when using partitions).

Tracked it down to this line:
v0.5.30...v0.5.31#diff-6131c3a14dd0889855bcf084535928fbR250

This is what renders to the dom instead of the component's content

{ type: 'log', text: '\'<!---->\'\n' }

It works fine again when I replace this line:

 context._element = element = document.querySelector('#ember-testing > .ember-view');

with:

context._element = element = Ember.$('#ember-testing > .ember-view');

PhantomJS: 2.1.1
Ember: 2.4.5
ember-cli: 2.7.0
ember-cli-qunit: 2.1.0

@jasonmit
Copy link
Member

I'm also seeing this, reverting back to 0.5.31 resolved this.

@rwjblue
Copy link
Member

rwjblue commented Sep 15, 2016

From my eyes the only difference between those two selectors is that the jQuery one will select all elements that match and the document.querySelector one will only match the first...

Can someone create a demo repo showing the issue?

@jasonmit
Copy link
Member

I'll throw one together tonight

@rwjblue
Copy link
Member

rwjblue commented Sep 15, 2016

Thank you!

@jasonmit
Copy link
Member

@rwjblue I'm now unable to reproduce it, I'll keep an eye out and will report back if I can reproduce+isolate it..

@rwjblue
Copy link
Member

rwjblue commented Sep 15, 2016

Kk. I was wondering perhaps if it was relate to Ember version and/or whether or not the component under test was tagless.

@jasonmit
Copy link
Member

@rwjblue this happened while upgrading from ~2.6 to 2.8. We are also on ember-mocha so unsure if that had anything to do with it.

The tests that were failing with this were not tagless components, though we had test failures because of that new assertion but I consider that unrelated to this issue.

@calderas
Copy link
Author

After looking at this again, I found the issue on my app.
There was a DOM element leaking from Acceptance Tests that wasn't removed properly.

Since the new selector only returns the first ".ember-view" it didn't match the one it expected, hence the error on the new version.

Also, the reason this was only breaking the first test is that the HTML gets cleaned up after the component test is done.
https://github.com/switchfly/ember-test-helpers/blob/master/lib/ember-test-helpers/abstract-test-module.js#L138

teardownTestElements() {
  document.getElementById('ember-testing').innerHTML = '';
  ...
}

I fixed the issue by making sure the element leaking was removed properly on ATs.

Thanks for the input

@jasonmit
Copy link
Member

@calderas that might explain why I wasn't able to reproduce it an example app. Thanks for reporting back, I'll be sure to look for any components that are leaking elements.

@Turbo87
Copy link
Member

Turbo87 commented Dec 21, 2016

@jasonmit @calderas can we close this? or is this still an issue?

@calderas
Copy link
Author

No longer an issue, thanks!

@Turbo87 Turbo87 closed this as completed Dec 21, 2016
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

4 participants