public Unit_Tests_using_IE open(string virtualPath) { if (this.Server.valid()) { if (virtualPath.isUri()) // just in case we actually get a full url here { ie.open(virtualPath); } else { if (virtualPath.starts("/") || virtualPath.starts(@"\")) { virtualPath = virtualPath.removeFirstChar(); } var fullUrl = "{0}{1}".format(this.Server, virtualPath); if (fullUrl.isUri()) { ie.open(fullUrl); } } } else { "[Unit_Tests_with_IE], the local open method was called but the Server variable is not set".error(); } return(this); }
public API_HacmeBank loginPage() { var loginUrl = "{0}/aspx/login.aspx".format(Url_Website); ie.open(loginUrl); return(this); }
public WatiN_IE open(string virtualPath) { var fullUrl = "{0}{1}".format(Test_TM.tmServer, virtualPath); if (fullUrl.isUri()) { ie.open(fullUrl); } return(ie); }
public void Login_As_Admin() { server = apiCassini.url(); ie.open(server.append("login").info()); ie.field("username").value(admin_Name); ie.field("password").value(admin_Pwd); ie.button("login").click(); ie.waitForLink("About", 250, 20).assert_Not_Null(); ie.waitForLink("Logout").assert_Not_Null(); }
[Test] public void Open_Site_O2Platform() { this.ignore_If_Offline(); ie.show(); var o2platform = "http://o2platform.com"; ie.open(o2platform); "URL: {0}".info(ie.url()); Assert.IsTrue(ie.url().contains("o2platform")); 1000.sleep(); ie.hide(); 1000.sleep(); }
public static WatiN_IE open(this WatiN_IE watinIe, Uri uri) { return((watinIe.notNull() && uri.notNull()) ? watinIe.open(uri.str()) : watinIe); }
public static WatiN_IE about_blank(this WatiN_IE watinIe) { return(watinIe.open("about:blank")); }
public static WatiN_IE bbc(this WatiN_IE watinIe) { return(watinIe.open("http://news.bbc.co.uk")); }
public static WatiN_IE owasp(this WatiN_IE watinIe) { return(watinIe.open("http://owasp.org")); }
public static WatiN_IE google(this WatiN_IE watinIe) { return(watinIe.open("http://google.com")); }
public void Workflow_Install_And_Delete_Library() { Action <string, string> waitForElementText = (elementId, text) => { "waiting for '{0}' in element '{1}'".info(text, elementId); for (int i = 0; i < 5; i++) { if (ie.element(elementId).text().contains(text)) { return; } else { elementId.sleep(1000, true); } } "could not find '{0}' in element '{1}'".error(text, elementId); }; Action <string, string> login = (username, password) => { ie.open(server.append("login")); ie.url().assert_Contains("Login"); ie.field("username").value(username); ie.field("password").value(password); ie.button("login").click(); }; Action logout = () => ie.open(server.append("logout")); Action teamMentor = () => { ie.open(server.append("teamMentor")); ie.waitForLink("About"); }; Action admin = () => ie.open(server.append("admin")); Action login_AsAdmin = () => { if (ie.hasLink("Control Panel").isFalse()) { logout(); login(admin_Name, admin_Pwd); ie.waitForLink("About", 250, 20).assert_Not_Null(); ie.waitForLink("Logout").assert_Not_Null(); //teamMentor(); } }; Action installTestLibrary = () => { admin(); ie.waitForComplete(); ie.waitForLink("advanced admin tools").click().assert_Not_Null(); ie.waitForLink("install/upload libraries").click().assert_Not_Null();; ie.waitForLink("OWASP").click().assert_Not_Null(); ie.button("Install").click().assert_Not_Null(); waitForElementText("installMessage", "> Library installed was successful"); ie.link("Admin Tasks").click().assert_Not_Null(); waitForElementText("jsonResult", "...Via Proxy"); ie.link("Reload Server Cache").click().assert_Not_Null(); waitForElementText("jsonResult", "In the Folder"); ie.link("Open Main Page").click().assert_Not_Null();; //ie.waitForLink("Reload Server Cache").click(); }; Action deleteTestLibrary = () => { ie.waitForLink("OWASP").notNull().assert_True(); var librariesBeforeRemove = ie.getJsVariable("window.TM.WebServices.Data.AllLibraries.length").cast <int>(); ie.eval("window.TM.Gui.LibraryTree.remove_Library_from_Database('4738d445-bc9b-456c-8b35-a35057596c16')"); for (var i = 0; i < 5; i++) { if (ie.getJsVariable("window.TM.WebServices.Data.AllLibraries.length").cast <int>() < librariesBeforeRemove) { return; } else { 100.sleep(); } } "Library was not deleted".assert_Fail(); }; teamMentor(); login_AsAdmin(); //ie.script_IE_WaitForClose(); installTestLibrary(); deleteTestLibrary(); ie.hasLink("OWASP").assert_False(); }