waitsFor support?

36 views
Skip to first unread message

Ivo

unread,
Mar 16, 2011, 7:27:58 PM3/16/11
to jasmine-webos
Does jasmine-webos support async testing using waits/waitsFor? My
guess is not since tests that uses these are reported as green even
though it should be failing.

Davis W. Frank

unread,
Mar 16, 2011, 8:42:33 PM3/16/11
to jasmin...@googlegroups.com
What are you trying to do?

waitsFor should work.

--dwf

Doug Reeder

unread,
Mar 16, 2011, 8:49:05 PM3/16/11
to jasmin...@googlegroups.com
waitsFor works just fine under webOS. Can you post the code that isn't behaving as you expect?

Doug Reeder
reed...@gmail.com
http://reeder29.livejournal.com/
https://twitter.com/reeder29

https://twitter.com/hominidsoftware
http://outlinetracker.com


Ivo

unread,
Mar 17, 2011, 12:55:06 PM3/17/11
to jasmine-webos
Thanks for the reply guys, what I am doing is straight out of the
docs, copied below:

<snip>
var encryptedPath = '/media/internal/test.xml';
var decryptedPath = '/media/internal/test.dec.xml';
var decryptionServiceProxy = new DecryptionServiceProxy(new
ServiceRequestFactory(logger), logger);
decryptionServiceProxy.decrypt(encryptedPath,
function(content) {
logger.info("Decrypted content: " + content);
decrypted = content;
}, decryptedPath);

waitsFor(function() {
return decryptionServiceProxy.isInQueue(encryptedPath);
}, "Decryption never completed", 10000);

runs(function () {
expect(decrypted).toEqual(expectedDecrypted);
});
</snip>

The test fails and in the logs I see:

<snip>
2011-03-17T16:49:29.464339Z [542] qemux86 user.notice LunaSysMgr:
{LunaSysMgrJS}: com.hello.app: Info: ====> Jasmine webOS: prepping to
run specs, palmInitFramework367:2569
...
2011-03-17T16:49:29.769814Z [542] qemux86 user.notice LunaSysMgr:
{LunaSysMgrJS}: com.hello.app: Info: Jamine.log: >> Jasmine waiting
for Decryption never completed, palmInitFramework367:2569
</snip>

The test fails without waiting for the 10 seconds...then a bit later:

<snip>
2011-03-17T16:49:30.821319Z [543] qemux86 user.notice LunaSysMgr:
{LunaSysMgrJS}: com.hello.app: Info: Decrypted content: <enc>ThisWas
the expected encrypted content</enc> , palmInitFramework367:2569
</snip>

On Mar 16, 5:49 pm, Doug Reeder <reeder...@gmail.com> wrote:
> waitsFor works just fine under webOS.   Can you post the code that isn't behaving as you expect?
>
> On Mar 16, 2011, at 7:27 PM, Ivo wrote:
>
> > Does jasmine-webos support async testing using waits/waitsFor? My
> > guess is not since tests that uses these are reported as green even
> > though it should be failing.
>
> Doug Reeder
> reeder...@gmail.comhttp://reeder29.livejournal.com/https://twitter.com/reeder29
>
> https://twitter.com/hominidsoftwarehttp://outlinetracker.com

Doug Reeder

unread,
Mar 17, 2011, 1:02:42 PM3/17/11
to jasmin...@googlegroups.com

On Mar 17, 2011, at 12:55 PM, Ivo wrote:

>
> waitsFor(function() {
> return decryptionServiceProxy.isInQueue(encryptedPath);
> }, "Decryption never completed", 10000);
>
>

> The test fails without waiting for the 10 seconds...then a bit later:
>
> <snip>
> 2011-03-17T16:49:30.821319Z [543] qemux86 user.notice LunaSysMgr:
> {LunaSysMgrJS}: com.hello.app: Info: Decrypted content: <enc>ThisWas
> the expected encrypted content</enc> , palmInitFramework367:2569
> </snip>
>


waitsFor waits for the the function to return true; from the function name, I'd expect decryptionServiceProxy.isInQueue() to return true as soon as something is put in the queue.

Ivo

unread,
Mar 17, 2011, 1:52:49 PM3/17/11
to jasmine-webos
Thanks Doug!

You are right, I incorrectly evaluating the waitsFor.

I see a different issue now, the test fails with a timeout and I no
longer see the log entry with the decrypted content that used to take
less than a second to complete.

I see dozens of entries with:

2011-03-17T17:46:23.116928Z [3960] qemux86 user.notice LunaSysMgr:
{LunaSysMgrJS}: com.hello.app: Info: Jamine.log: >> Jasmine waiting
for Decryption never completed, palmInitFramework367:2569

and never

qemux86 user.notice LunaSysMgr:
{LunaSysMgrJS}: com.hello.app: Info: Decrypted content: <enc>ThisWas
the expected encrypted content</enc> , palmInitFramework367:2569



On Mar 17, 10:02 am, Doug Reeder <reeder...@gmail.com> wrote:
> On Mar 17, 2011, at 12:55 PM, Ivo wrote:
>
>
>
> >        waitsFor(function() {
> >            return decryptionServiceProxy.isInQueue(encryptedPath);
> >        }, "Decryption never completed", 10000);
>
> > The test fails without waiting for the 10 seconds...then a bit later:
>
> > <snip>
> > 2011-03-17T16:49:30.821319Z [543] qemux86 user.notice LunaSysMgr:
> > {LunaSysMgrJS}: com.hello.app: Info: Decrypted content: <enc>ThisWas
> > the expected encrypted content</enc> , palmInitFramework367:2569
> > </snip>
>
> waitsFor waits for the the function to return true;  from the function name, I'd expect decryptionServiceProxy.isInQueue() to return true as soon as something is put in the queue.
>
> Doug Reeder

Ivo

unread,
Mar 17, 2011, 2:27:19 PM3/17/11
to jasmine-webos
I take that back, I added more logging and it looks like the waitsFor
message is printed on every check. Also my expectation does appear to
get run but was failing.

Thanks for the help.
Reply all
Reply to author
Forward
0 new messages