Re: [jasmine-js] How does nested waits(For) and runs work?

208 views
Skip to first unread message

Davis W. Frank

unread,
Apr 23, 2013, 12:22:37 PM4/23/13
to jasmi...@googlegroups.com
You can't nest runs/waits. They should be all at the same level.

But yes, we've deprecated them for 2.0.



On Tue, Apr 23, 2013 at 3:21 AM, Simen Bekkhus <sbekk...@gmail.com> wrote:
Hi!

I'm currently trying to set up testing for our web-app, and I'm wondering how to use waits(For) to get the flow I expect.

Pretty simple question, will this work as I want it to:

it("shall work", function () {
    var something = somethingElse;

    waitsFor(function () {
        //something to happen
    }, "timeout", 50);

    runs(function () {
        //do something

        // give the GUI time to update etc
        waits(25);

        runs(function () {
            // Do some more stuff after waiting (twice)

            waitsFor(function () {
                // give something time to happen yet again
            }, "gogogo", 100);

            runs(function () {
                // this should happen after that again (waiting 3 times)
            });
        });
    });
});

So, my expectation is that basically everything will wait for what happens in the waits before it's own runs-block. Is that correct?

Also, would I get the same behavior by NOT nesting it?

As a note, I know waits(For) is removed for 2.0, and I also know we're not unit-testing (if that's apparent from this "code"), more integration-testing.
Can't wait for 2.0 to be done (governmental project), and too late to not use Jasmine as we are.

Hopefully this question made sense! :)

-Simen

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at http://groups.google.com/group/jasmine-js?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
thx,
--dwf

Simen Bekkhus

unread,
Apr 23, 2013, 4:58:14 PM4/23/13
to jasmi...@googlegroups.com
Thanks for your answer!

So that means if they're all on the same level, they'll wait for the preceding blocks to complete before they finish?

-Simen

Simen Bekkhus

unread,
Apr 23, 2013, 5:01:14 PM4/23/13
to jasmi...@googlegroups.com
Before they run*, of course
Reply all
Reply to author
Forward
0 new messages