diff --git a/csharptests/Program.cs b/csharptests/Program.cs index af4ba3bb..ce75e402 100644 --- a/csharptests/Program.cs +++ b/csharptests/Program.cs @@ -37,9 +37,49 @@ static void Main(string[] args) _.test("#firstName should have John (using == infix operator)", () => { _.url(testpage); - _.equals("#firstName", "John"); + _.eq("#firstName", "John"); }); + + _.test("#lastName should have Doe via read IWebElements", () => + { + _.url(testpage); + var e = _.element("#lastname"); + var value = _.read(e); + _.equality(value, "Doe"); + }); + + _.test("clearing #firstName sets text to new empty string", () => + { + _.url(testpage); + _.clear("#firstName"); + _.eq("#firstName", ""); + }); + + _.test("clearing #firstName sets text to new empty string via IWebElement", () => + { + _.url(testpage); + _.clear(_.element("#firstName")); + _.eq("#firstName", ""); + }); + + _.test("writing to #lastName sets text to Smith", () => + { + _.url(testpage); + _.clear("#lastName"); + _.write("#lastName", "Smith"); + _.eq("#lastName", "Smith"); + }); + + _.test("writing to #lastName (as element) sets text to John", () => + { + _.url(testpage); + var lastname = _.element("#lastname"); + _.clear(lastname); + _.write(lastname, "John"); + _.eq("#lastname", "John"); + }); + _.run(); System.Console.ReadKey(); diff --git a/csharptests/csharptests.csproj b/csharptests/csharptests.csproj index efadd808..8225f972 100644 --- a/csharptests/csharptests.csproj +++ b/csharptests/csharptests.csproj @@ -41,6 +41,7 @@ + diff --git a/src/canopy/csharp.fs b/src/canopy/csharp.fs index e1f8e645..d6a70d7e 100644 --- a/src/canopy/csharp.fs +++ b/src/canopy/csharp.fs @@ -36,7 +36,18 @@ type canopy () = static member quit () = canopy.core.quit () + //element stuff + static member element selector = canopy.core.element selector + + static member read selector = canopy.core.read selector + + static member clear selector = canopy.core.clear selector + + static member write selector value = selector << value + //assertions - static member equals selector value = selector == value + static member eq selector value = selector == value + + static member equality value1 value2 = value1 === value2 static member count selector value = count selector value \ No newline at end of file