views:

25

answers:

2

I have an application in which you select an area of a map and our product price list changes (dependant of map area, size etc.)

So in my test, I use runScript() to call the JS method underlying the map, the prices update and I do a simple check on the price that is set ala Assert.AreEqual(priceValue, selenium.GetText(priceElement));

I use RC and C# to run tests.

The problem is that when I dont run the test with my debugging switched on the price check fails.

I'm pretty sure the problem is the check is run before the price is updated however if I put in a selenium.WaitForPageToLoad() at whatever value it times out.

Given that the script I call selects the area on the map and updates the price plus I can see it on the screen why cant my test?

A: 

Quite a simple answer really.

WaitForPageToLoad times out as the script doesnt trigger a page load.

So using thread.Sleep(5000) gives the element a chance to refresh then doing the Assert has got it working.

DazManCat
+1  A: 

Thread.sleep (5000) - This is not a best practice because your tests will run slowly. You should to try waitForElementPresent better

alexey.chumagin
Yeah I didnt like the thread.sleep option so using selenium.WaitForCondition("selenium.getText('price2048') != '--.--'", "60000"); instead.
DazManCat