Skip to content

setTimeout doesn't seem to work #59

Open
ramseydsilva opened this Issue Oct 6, 2013 · 3 comments

4 participants

@ramseydsilva

I try to delay emitting events in my tests, something like this:

        client.eval(function() {
            Meteor.logout();
            Router.go("profile");
            setTimeout(function() {
                emit('checkUrl', {
                    current_path: Router.current().path,
                    expected_path: Router.path("home")
                });
            }, 5000);
        });

        client.on('checkUrl', function(dict) {
            assert.equal(dict.current_path, dict.expected_path);
            done();
        });

However it doesn't wait 5 minutes to emit. The test output shows it took about 1200ms and I get the undesired result for that test (as a result of not delaying the event).

I also tried using Meteor.setTimeout but the same issue.

@krstffr
krstffr commented Nov 8, 2013

+1

It only works on the server as far as I'm concerned.

@arunoda
Owner
arunoda commented Feb 6, 2014

This is an issue with evaluating setTimeout inside PhantomJS. Seems like there is a hack to fix it. Give it a try: ariya/phantomjs#10832 (comment)

@apendua
Collaborator
apendua commented May 19, 2014

@arunoda Do you think we could implement this patch into laika?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.