code_junkie

Alternatives to using delays when automatically testing an AJAX web UI

Nov 11th, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. public void MinAndMaxPriceRestoredWhenOpenedAfterUsingBackButton(){
  2. OpenBrowserTo("welcome/index.rails");
  3. bot.Click("priceDT");
  4. WaitForText("Price Range");
  5. WaitForText("515 N. County Road");
  6. bot.Select("MaxDropDownList", "$5,000,000");
  7. WaitForText("Prewar 8 Off Fifth Avenue");
  8. bot.Select("MinDropDownList", "$2,000,000");
  9. WaitForText("of 86");
  10. bot.Click("link=Prewar 8 Off Fifth Avenue");
  11. WaitForText("Rarely available triple mint restoration");
  12. bot.GoBack();
  13. Thread.Sleep(20000);
  14. bot.Click("priceDT");
  15. WaitForText("Price Range");
  16. Assert.AreEqual("$5,000,000", bot.GetSelectedLabel("MaxDropDownList"));
  17. Assert.AreEqual("$2,000,000", bot.GetSelectedLabel("MinDropDownList"));}
  18.  
  19. public void MinAndMaxPriceRestoredWhenOpenAfterUsingBackButton(){
  20. OpenBrowserTo("welcome/index.rails");
  21. ClickLink("Price");
  22. SelectMaxPrice("$5,000,000");
  23. SelectMinPrice("$2,000,000");
  24. ClickLink("Prewar 8 Off Fifth Avenue");
  25. GoBack();
  26. ClickLink("Price");
  27. Assert.AreEqual("$5,000,000", SelectedMaxPrice());
  28. Assert.AreEqual("$2,000,000", SelectedMinPrice());}
  29.  
  30. // Wait until the value of the watintoken attribute is changed
  31. ie.SelectList("countries").WaitUntil(!Find.By("watintoken",watintoken));
  32.  
  33. public void MinAndMaxPriceRestoredWhenOpenAfterUsingBackButton(){
  34. ActiveBrowser.NavigateTo("welcome/index.rails");
  35. Find.ByContent<HtmlAnchor>("Price").Click();
  36. HtmlSelect maxPrice = Find.ById<HtmlSelect>("MaxDropDownList");
  37. HtmlSelect minPrice = Find.ById<HtmlSelect>("MinDropDownList");
  38. maxPrice.SelectByText("$5,000,000");
  39. minPrice.SelectByText("$2,000,000");
  40. Find.ByContent<HtmlAnchor>("Prewar 8 Off Fifth Avenue").Click();
  41. ActiveBrowser.GoBack();
  42. Find.ByContent<HtmlAnchor>("Price").Click();
  43. maxPrice.AssertSelect().SelectedText("$5,000,000");
  44. minPrice.AssertSelect().SelectedText("$2,000,000");}
Add Comment
Please, Sign In to add comment