in

ArtOfTest, Inc. Community Forums

Discuss and ask questions about ArtOfTest's products.

How would this be coded in WebAii

Last post 09-28-2008 3:32 PM by Mike Gale. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-26-2008 2:22 AM

    How would this be coded in WebAii

    I am evaluating ways to test Ajax web pages.

    I have found a sample of a test routine, in two web page test systems, and would like to know how it might be coded in WebAii.

    The samples are:

    Selenium

    public void MinAndMaxPriceRestoredWhenOpenedAfterUsingBackButton(){

    OpenBrowserTo("welcome/index.rails");

    bot.Click("priceDT");

    WaitForText("Price Range");

    WaitForText("515 N. County Road");

    bot.Select("MaxDropDownList", "$5,000,000");

    WaitForText("Prewar 8 Off Fifth Avenue");

    bot.Select("MinDropDownList", "$2,000,000");

    WaitForText("of 86");

    bot.Click("link=Prewar 8 Off Fifth Avenue");

    WaitForText("Rarely available triple mint restoration");

    bot.GoBack();

    Thread.Sleep(20000);

    bot.Click("priceDT");

    WaitForText("Price Range");

    Assert.AreEqual("$5,000,000", bot.GetSelectedLabel("MaxDropDownList"));

    Assert.AreEqual("$2,000,000", bot.GetSelectedLabel("MinDropDownList"));}3.2)

    WatiN

    public void MinAndMaxPriceRestoredWhenOpenAfterUsingBackButton(){

    OpenBrowserTo("welcome/index.rails");

    ClickLink("Price");

    SelectMaxPrice("$5,000,000");

    SelectMinPrice("$2,000,000");

    ClickLink("Prewar 8 Off Fifth Avenue")

    GoBack();

    ClickLink("Price");

    Assert.AreEqual("$5,000,000", SelectedMaxPrice());

    Assert.AreEqual("$2,000,000", SelectedMinPrice());}

    In addition I'd like to know how the code would look where an action initiated an Ajax call (using jQuery) the callback of which changes page content. I then want to check the changes on the page.

    Thanks.

    Filed under:
  • 09-26-2008 12:00 PM In reply to

    Re: How would this be coded in WebAii

    Are SelectMaxPrice/SelectMinPrice custom functions that wrap Watin code?

    ArtOfTest, Inc.
  • 09-26-2008 12:29 PM In reply to

    Re: How would this be coded in WebAii

    Here is how WebAii code might look like:

     

    ActiveBrowser.NavigateTo("welcome/index.rails");

    Find.ByContent<HtmlAnchor>("Price").Click();

    HtmlSelect maxPrice = Find.ById<HtmlSelect>("MaxDropDownList");

    HtmlSelect minPrice = Find.ById<HtmlSelect>("MinDropDownList");

    maxPrice.SelectByText("$5,000,000");

    minPrice.SelectByText("$2,000,000");

    Find.ByContent<HtmlAnchor>("Prewar 8 Off Fifth Avenue").Click();

     

    ActiveBrowser.GoBack();

     

    Find.ByContent<
    HtmlAnchor>("Price").Click();

    // You can use the Assert.AreEqual but these are addition

    // assert classed on the HtmlControls that make the task

    // much easier.

    maxPrice.AssertSelect().SelectedText("$5,000,000");

    minPrice.AssertSelect().SelectedText("$2,000,000");

     

    Keep in mind that WebAii's HtmlControls offer all kinds of Wait mechanizms like:

    maxPrice.Wait.Forxxx (where xxx : Attributes/Styles/Visibility...etc)

     

    Hope that helps..

     

    ArtOfTest, Inc.
  • 09-28-2008 3:32 PM In reply to

    Re: How would this be coded in WebAii

    Thanks for that.

     I don't have full source for the samples, I hope that I can evaluate without spending time setting up and running the code.

    I'd really like to know how the code looks for an AJAX example.

Page 1 of 1 (4 items)
Copyrights © 2008 ArtOfTest, Inc. All rights reserved.