Problems with a AJAX page and some wait states.

20 views
Skip to first unread message

tko...@pictage.com

unread,
Jul 8, 2011, 3:24:21 PM7/8/11
to Fitnium
Hey all. Thanks for the quick approval process for this group. I'm
really excited about the prospect of using Fitnium. However, the site
I'm trying to test with has some scenarios that seem to keep tripping
up the tests I've written. Let me give you an example.

The page I'm struggling with today has a tax calculation on it.
(there's an AJAX call in the background) There is a business rule we
have where the next page can not be accessed until the tax is
displayed for the customer. Basically what happens is if you click
the "next" button before the tax calculation is complete the button
does nothing. So I'm forced to try to detect some wait state until
the tax is displayed. The page can make multiple calls to do this
calculation. If you enter one zip code, it calculates the tax. Then
if you change the zip code again it re-calculates the tax. It's a
pretty active page and seems very good at making my tests fail.
*shakes fist*

Now, while the tax calculation is running in the background some
"loading" text is displayed. And I'm able to detect this using
something like...

|wait for element | xpath=//*[@id="loading"] | to be visible |

What I think I need is a way to detect once it's invisible again. I
don't see that in the documentation for the API's anywhere. What I
was hoping is that something like this existed...

|wait for element | xpath=//*[@id="loading"] | to not be visible |

If anyone has any suggestions it would be very helpful. Right now I
just have a default wait for 10 seconds in my test. It would really
speed up my test suite if I could detect this item being hidden again.

Thanks,

-Tom

Keith Sterling

unread,
Jul 9, 2011, 12:52:12 AM7/9/11
to Fitnium
Hi Tom, thanks for joining and contributing

You are right, we don't have anything that allows you to wait for
something to be not present or not visible

So I have added 3 new APIs to support this

| wait for element | locator | to be not visible |

| wait for element | locator | to be present |
| wait for element | locator | to be not present |

The last 2 I added, because I realised I did not have API to check for
presence, only visibility

These APIs should be released within the next 24-48 hours once I have
completed the testing.

So in with these new ones you should be able to do something like

|wait for element | xpath=//*[@id="loading"] | to be visible
| - Wait for it to appear
|wait for element | xpath=//*[@id="loading"] | to not be visible
| - Wait for it to disappear


K

tko...@pictage.com

unread,
Jul 12, 2011, 11:43:32 AM7/12/11
to Fitnium
Thanks for the quick response! Will the new API's be available on
sourceforge? I'm assuming I'll just have to download a new Jar file.

-Tom

Keith Sterling

unread,
Jul 12, 2011, 10:36:10 PM7/12/11
to Fitnium
Latest jar has been uploaded, just replace fitnium2.jar in your
Fitnium folder with the one on Source Forge

https://sourceforge.net/projects/fitnium/files/

Now supports the following API

| wait for element | locator | to be not visible |

| wait for element | locator | to be present |
| wait for element | locator | to be not present |

Keith

tko...@pictage.com

unread,
Jul 13, 2011, 11:36:01 AM7/13/11
to Fitnium
Keith,

I tried to download the latest Jar but the new API does not work for
me. I'm still very new to Fitnium so I hope I just have something
setup wrong.

I get the following error when trying to use any of the new API's.

Missing methods: public TypeOfResult
waitForElementToBeNotPresent(Type1 arg1) { } in class
com.magneticreason.fitnium.BaseFitniumFixture

Do I have to have a different fixture declared at the top of my page?
I'm only using com.magneticreason.fitnium.BaseFitniumFixture at the
moment. Top of my test page looks like this with the imports...

!path fitnesse.jar
!path fitlibrary.jar
!path ./lib/*.jar

!|com.magneticreason.fitnium.BaseFitniumFixture|

-Tom

Keith Sterling

unread,
Jul 14, 2011, 1:49:55 AM7/14/11
to Fitnium
Apologies, I uploaded the wrong jar

New jar loaded to source forge for you to download

tko...@pictage.com

unread,
Jul 14, 2011, 11:17:37 AM7/14/11
to Fitnium
Keith,

Thanks a million. Just tried it out a bit this morning and it's
working better than I expected. It definitely helps out with some of
these tricky wait states I need to account for.

-Tom

Keith Sterling

unread,
Jul 15, 2011, 6:21:15 AM7/15/11
to Fitnium
A pleasure to help

I have an action to add 'not' API's to all the wait API's that
currently exist

They'll be added in the next few weeks after I get back from holiday
next week
Reply all
Reply to author
Forward
0 new messages