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

Workaround to allow e2e tests #5

Merged
merged 2 commits into from
Jul 16, 2013
Merged

Workaround to allow e2e tests #5

merged 2 commits into from
Jul 16, 2013

Conversation

ychartois
Copy link
Contributor

Workaround to allow e2e tests for projets that want to use your directive, because if we use $timout the e2e test will hang.

More infos:
http://zachsnow.com/#!/blog/2013/angularjs-headache-hanging-end-end-scenarios/

the workaround:
http://stackoverflow.com/questions/16086681/why-is-angular-timeout-blocking-end-to-end-tests

Workaround to allow e2e tests ,we can't use $timout which make the e2e to hang.
@siddii
Copy link
Owner

siddii commented Jul 13, 2013

@ychartois - Thanks for submitting the pull request! I truly appreciate that :)

Looks like this change is not complete. Can you open index.html in the browser & click on 'Start' & 'Stop' buttons in the examples. They are not functioning the way it did before.

And also, if you can add some unit tests or e2e tests to this project, it would be awesome!

@ychartois
Copy link
Contributor Author

I did that really quickly (edit directly in gitbug) because it works in my project. I'm going to take the time tomorrow to checkout and test ;)

…Start writing e2e tests but sadly they are not functionnals yet.
@ychartois
Copy link
Contributor Author

I tested all the demo pages and it seems OK. I tried to add some e2e tests, but it doesn't work at all and I really don't understand why yet... I added them to the pull request in case that you have some ideas !

Be carefull, I modify the Karma conf file, and you must maybe modify the proxy in your configuration.

@siddii
Copy link
Owner

siddii commented Jul 16, 2013

@ychartois - I am going to merge this change to the master for now. I am little bit reluctant to not using $timeout. Do you know if there is any issue created in AngularJS repo regarding this issue? I couldn't find from my brief quest.

If not, could you please send me a plunkr or jsfiddle replicating this issue. I would like to see if there is a better/Angular way of fixing it.

siddii added a commit that referenced this pull request Jul 16, 2013
Workaround to allow e2e tests
@siddii siddii merged commit 914b42c into siddii:master Jul 16, 2013
@ychartois
Copy link
Contributor Author

@siddii
Hi Siddique,

Here where I first find information (at the end of the article):
https://coderwall.com/p/udpmtq

The issue open at angularJS team, with a Plunker:
angular/angular.js#2402

I don't like the proposed workaround...

And here a discussion where the setTimout is validated, even if the author would have preferred that we use $ timout, he notes that there is no solution for the moment.: https://groups.google.com/forum/#!topic/angular/e2CfWnHjvfU

I will find the time to work on the test/e2e/scenarios.js to add more e2e test and fix the existing ones.

Yannick

@siddii
Copy link
Owner

siddii commented Jul 16, 2013

@ychartois - Cool.. Thx for the info!

@stonehz
Copy link

stonehz commented Jan 30, 2014

what about $interval in the newer version of Angular?
can we completely replace $timeout ?

@siddii
Copy link
Owner

siddii commented Jan 30, 2014

Yes, looks like the original bug in Angular is fixed now. So, it might be fine using either $timeout or $interval.

For some reason, I am little hesitant to use $interval because setTimeout/$timeout would give more control over the former like starting/stopping & managing the timers itself. I need to explore & see how it will affect the overall functionality.

If you want to venture down that path, feel free to send the PR :)

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

Successfully merging this pull request may close these issues.

3 participants