public static ascx_Simple_Script_Editor script_IE(this IE_TeamMentor ieTeamMentor)
 {
     ieTeamMentor.ie.parentForm().show();                                        //in case it was started in hidden mode
     return(ieTeamMentor.ie.script_IE()
            .add_InvocationParameter("ieTeamMentor", ieTeamMentor)
            .code_Insert("return ieTeamMentor;")
            .code_Append("//using TeamMentor.UnitTests.Cassini")
            .code_Append("//O2Ref:TeamMentor.UnitTests.Cassini.dll"));
 }
        //ie helpers
        public static IE_TeamMentor click(this IE_TeamMentor ieTeamMentor, string linkOrButtonRef)
        {
            var result = Extra_Watin__Extension_Methods.click(ieTeamMentor.ie(), linkOrButtonRef);

            //var result =  ieTeamMentor.ie().click(linkOrButtonRef).notNull();
            return(result.notNull()
                        ? ieTeamMentor
                        : null);
        }
示例#3
0
        [SetUp] public void setUp()
        {
            webRoot.assert_Folder_Exists();
            path_XmlLibraries.assert_Folder_Exists();
            siteUri.assert_Not_Null();

            ieTeamMentor = new IE_TeamMentor(webRoot, path_XmlLibraries, siteUri, startHidden: true);
            ie           = ieTeamMentor.ie;
        }
        public static IE_TeamMentor open(this IE_TeamMentor ieTeamMentor, string virtualPath = "")
        {
            var fullUri = ieTeamMentor.siteUri.append(virtualPath);

            if (fullUri.notNull())
            {
                ieTeamMentor.ie.open(fullUri.str());
            }
            return(ieTeamMentor);
        }
        public static IE_TeamMentor open_TBot_Login_if_Needed(this IE_TeamMentor ieTeamMentor, string tbotPage = "Commands")
        {
            var tbotLink    = "/rest/tbot/run/".append(tbotPage);
            var expectedUrl = ieTeamMentor.siteUri.mapPath(tbotLink);

            ieTeamMentor.open(tbotLink);
            return(ieTeamMentor.ie.uri() == expectedUrl                             // check if the page opened is the expected one
                        ? ieTeamMentor                                              // if it is continue
                        : ieTeamMentor.login_Default_Admin_Account(tbotLink));      // if not login with default admin account
        }
        public static IE_TeamMentor login(this IE_TeamMentor ieTeamMentor, string username, string password, string loginReferer = "/whoami")
        {
            var ie = ieTeamMentor.ie;

            var expectedUri = ieTeamMentor.siteUri.append(loginReferer);                                    // map the expected login OK redirection target

            ieTeamMentor.open("login?LoginReferer={0}".format(loginReferer));

            ie.field("username").value(username);                                                           // populate login fields
            ie.field("password").value(password);
            ie.button("login").click();

            ie.wait_For_Uri(expectedUri);                                                                   // wait for redirection to expected page
            return(ieTeamMentor);
        }
 public static IE_TeamMentor article_Html(this IE_TeamMentor ieTeamMentor, TeamMentor_Article tmArticle)
 {
     return((ieTeamMentor.notNull() && tmArticle.notNull())
         ? ieTeamMentor.article_Html(tmArticle.Metadata.Id)
         : ieTeamMentor);
 }
 public static IE_TeamMentor open_Page_Login_if_Needed(this IE_TeamMentor ieTeamMentor, string page)
 {
     ieTeamMentor.open(page);
     return(ieTeamMentor.login_Default_Admin_Account(page));
 }
 public static IE_TeamMentor login_Using_AuthToken(this IE_TeamMentor ieTeamMentor, Guid authToken)
 {
     return(ieTeamMentor.open("whoami?auth={0}".format(authToken)));
 }
 public static IE_TeamMentor article_Edit(this IE_TeamMentor ieTeamMentor, Guid id)
 {
     return(ieTeamMentor.open("editor/{0}".format(id)));
 }
 public static IE_TeamMentor article(this IE_TeamMentor ieTeamMentor, TeamMentor_Article tmArticle)
 {
     return(ieTeamMentor.article(tmArticle.Metadata.Id));
 }
 public static bool am_I_Default_Admin(this IE_TeamMentor ieTeamMentor)
 {
     return(ieTeamMentor.whoAmI().UserName == "admin");
 }
示例#13
0
 public static IE_TeamMentor close(this IE_TeamMentor ieTeamMentor)
 {
     ieTeamMentor.ie.close();
     ieTeamMentor.ie.parentForm().close();
     return(ieTeamMentor);
 }
 public static IE_TeamMentor login_Default_Admin_Account(this IE_TeamMentor ieTeamMentor, string loginReferer = "/whoami")
 {
     return(ieTeamMentor.login("admin", "!!tmadmin", loginReferer));
 }
 public static IE_TeamMentor script_IE_WaitForComplete(this IE_TeamMentor ieTeamMentor)
 {
     ieTeamMentor.script_IE().parentForm()
     .waitForClose();
     return(ieTeamMentor);
 }
 public static WatiN_IE ie(this IE_TeamMentor ieTeamMentor)
 {
     return(ieTeamMentor.notNull() ? ieTeamMentor.ie : null);
 }
 public static string html(this IE_TeamMentor ieTeamMentor)
 {
     return(ieTeamMentor.ie.html());
 }
 public static IE_TeamMentor refresh(this IE_TeamMentor ieTeamMentor)
 {
     ieTeamMentor.ie.refresh();
     return(ieTeamMentor);
 }
 public static WhoAmI whoAmI(this IE_TeamMentor ieTeamMentor)
 {
     return(ieTeamMentor.open("/whoami")
            .ie.body().innerHtml()
            .json_Deserialize <WhoAmI>());
 }
 public static IE_TeamMentor article_Html(this IE_TeamMentor ieTeamMentor, Guid id)
 {
     return(ieTeamMentor.open("html/{0}".format(id)));
 }
 public static IE_TeamMentor article_Raw(this IE_TeamMentor ieTeamMentor, Guid id)
 {
     return(ieTeamMentor.open("raw/{0}".format(id)));
 }
示例#22
0
 public static IE_TeamMentor waitForClose(this IE_TeamMentor ieTeamMentor)
 {
     ieTeamMentor.ie.parentForm().waitForClose();
     return(ieTeamMentor);
 }