Skip to content

Instantly share code, notes, and snippets.

@stirno
Created August 28, 2011 19:23
Show Gist options
  • Save stirno/1177089 to your computer and use it in GitHub Desktop.
Save stirno/1177089 to your computer and use it in GitHub Desktop.
FluentAutomation API Sample - KnockoutJS CartEditor Demo Test
[TestMethod]
public void CartEditor_AddDelete()
{
I.Use(BrowserType.InternetExplorer);
I.Open("http://knockoutjs.com/examples/cartEditor.html");
I.Select(2).From("#cartEditor tr select:eq(0)");
I.Select(2).From("#cartEditor tr select:eq(1)");
I.Enter(6).In("#cartEditor td.quantity input:eq(0)");
I.Expect.This("$197.70").In("#cartEditor tr span:eq(1)");
// add second product
I.Click("#cartEditor button:eq(0)");
I.Select(1).From("#cartEditor tr select:eq(2)");
I.Select(4).From("#cartEditor tr select:eq(3)");
I.Enter(8).In("#cartEditor td.quantity input:eq(1)");
I.Expect.This("$788.64").In("#cartEditor tr span:eq(3)");
// validate totals
I.Expect.This("$986.34").In("p.grandTotal span");
// remove first product
I.Click("#cartEditor a:eq(0)");
// validate new total
I.Expect.This("$788.64").In("p.grandTotal span");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment