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

Data Test Attribute Not Always Appearing When Specified #103

Closed
zamoore opened this issue Apr 27, 2017 · 13 comments
Closed

Data Test Attribute Not Always Appearing When Specified #103

zamoore opened this issue Apr 27, 2017 · 13 comments

Comments

@zamoore
Copy link

zamoore commented Apr 27, 2017

When I try to add a data-test attribute to an element, it doesn't appear on the element in the test build unless assigning it a value of "true".

For example:

This does not work

<h2 class="summary-name" data-test-campaign-summary-name>{{campaign.name}}</h2>

This does work

<h2 class="summary-name" data-test-campaign-summary-name="true">{{campaign.name}}</h2>

Using the following versions:

Ember: 2.12.1
Ember Data: 2.12.2
jQuery: 3.2.1
Ember Simple Auth: 1.2.2
Model Fragments: 2.11.2

@marcoow
Copy link
Member

marcoow commented Apr 27, 2017

Hm, this is working fine for us with Ember 2.11. Might be a regression with 2.12…

@marcoow marcoow added the triage label Apr 27, 2017
@Turbo87
Copy link
Collaborator

Turbo87 commented Apr 28, 2017

@zamoore we had been using Ember 2.12 here until this morning too, so I don't think that the Ember version is the problem. Unfortunately without some way to reproduce your issue this is hard to fix. Do you have a project somewhere that you can share that shows this issue?

@tomlagier
Copy link

We are encountering a similar issue on Ember 2.13

@marcoow
Copy link
Member

marcoow commented May 4, 2017

@zamoore, @tomlagier: as @Turbo87 said above, would be awesome if you could link to a project that shows the error (or create an example project that does).

@fusion2004
Copy link

I work with @zamoore, and we do not have a reproduction app currently. I am worried that it may be hard to make one because what we've found is that when it does occur, restarting the computer seems to fix it. rm -rfing node_modules, bower_components, tmp, & dist directories doesn't seem to help.

What could we do once we have a computer start running into the issue to try and help identify what is going on?

@astronomersiva
Copy link

restarting the computer seems to fix it

npm cache clean is also fixing it. We have also encountered situations where test selectors are stripped while running tests if the tag is inside an if...else block. For example,

{{#if  condition}}
      <div data-test-title="does-not-appear">...</div>
{{else}}
      <div data-test-title="does-not-appear">...</div>
{{/if}}

However, if the if...else block is enclosed in another tag containing a data-test attribute, they are not stripped.

@graemechapman
Copy link

I have just encountered this on Ember 2.13, I tried restarting, npm cache clean, yarn cache clean, and deleting temp files, local and global node modules, none of these fixed the issue.

What fixed it for me was reverting to an old commit from before we started using ember-test-selectors, running tests, and then updating back to master.

@fusion2004
Copy link

fusion2004 commented Jun 3, 2017

I'd also like to note that we don't see this issue in CI, which would seem to indicate that it only happens when trying to run tests multiple times, possibly related to making changes to the ember app you are running tests on, as well.

At this point, I'm grasping because of my lack of knowledge involving the intricacies of running tests & building ember apps. Is there something about running tests or building an ember app that may involve temp files outside of the project directory? Something that might get deleted during a system restart?

Edit: We've also updated our app to ember/ember-data/ember-cli 2.13, and continue to see this problem on our dev computers.

@fusion2004
Copy link

Ah-ha! I may have a clue!

Curious enough to attempt to answer my own question, I used DTrace to see what files were being opened during building & running tests and I saw it working with files in a folder named "if-you-need-to-delete-this-open-an-issue-async-disk-cache". In the same directory, I also found several folders starting with "testem-" in their name. I deleted all of them, and then, my test build worked!

When it happens again, I'll be more selective and delete folders one-at-a-time until the tests pass & report back.

@Turbo87
Copy link
Collaborator

Turbo87 commented Jun 3, 2017

@rwjblue @stefanpenner ☝️ any ideas?

@fusion2004
Copy link

I have confirmed with my coworker @bjbatten that when this issue starts occurring, deleting the "if-you-need-to-delete-this-open-an-issue-async-disk-cache" directory seems to resolve it.

@bgentry
Copy link
Contributor

bgentry commented Jun 22, 2017

I was also having this issue, and clearing out my $TMPDIR/if-you-need-to-delete-this-open-an-issue-async-disk-cache got the attrs to start appearing again.

Ember v2.13.0, latest version of this addon.

@Turbo87
Copy link
Collaborator

Turbo87 commented Jul 14, 2017

Since clearing the async cache appears to fix the issue I'm expecting #128 to have resolved it too. Please let use know if you still have any issues with the current release.

@Turbo87 Turbo87 closed this as completed Jul 14, 2017
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

8 participants