コード例 #1
0
 public void Test_Roles()
 {
     selenium.SetTimeout("100000");
     selenium.Open("Admin/tests/testreset.aspx");
     selenium.WaitForPageToLoad("30000");
     selenium.Open("Admin/QuickSetup.aspx");
     selenium.WaitForPageToLoad("30000");
     selenium.Open("MockCreate-User.aspx");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Roles");
     selenium.WaitForPageToLoad("30000");
     Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be.");
     Assert.IsTrue(selenium.IsTextPresent("Manage Roles"), "Text 'Manage Roles' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Edit"), "Text 'Edit' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Delete"), "Text 'Delete' not found when it should be.");
     selenium.Click("//input[@value='Create Role']");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("ctl00_Body_ctl00_Name", "A Test Role");
     selenium.AddSelection("ctl00_Body_ctl00_Users", "label=FirstName1 LastName1");
     selenium.Click("//input[@value='Save']");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsTextPresent("saved successfully"), "Text 'saved successfully' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Manage Roles"), "Text 'Manage Roles' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Test Role"), "Text 'Test Role' not found when it should be.");
     selenium.Click("link=Edit");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("System Administrator", selenium.GetSelectedLabel("ctl00_Body_ctl00_Users"));
     selenium.AddSelection("ctl00_Body_ctl00_Users", "FirstName1 LastName1");
     selenium.Click("//input[@value='Update']");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be.");
     selenium.Click("link=Edit");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("FirstName1 LastName1,System Administrator", String.Join(",", selenium.GetSelectedLabels("ctl00_Body_ctl00_Users")));
 }
コード例 #2
0
ファイル: AdvSeleniumAPIv2.cs プロジェクト: windygu/WISE
        public string GetSelectedLabel(string selectLocator)
        {
            bool actRes = false; string resStr = "", errStr = "";

            try
            {
                resStr = selenium.GetSelectedLabel(selectLocator);
                actRes = true;
            }
            catch (System.Exception ex)
            {
                errStr = ex.ToString();
            }

            res = new ResultClass()
            {
                Decp = "GetSelectedLabel, " + selectLocator,
                Res  = actRes ? "pass" : "fail",
                Tdev = " ms",
                Err  = errStr,
            };
            BaseListOfResItems.Add(res);

            return(resStr);
        }
コード例 #3
0
ファイル: CategoryTest.cs プロジェクト: kilonet/elfam
        public void TheUntitled()
        {
            var categoryName      = Guid.NewGuid().ToString();
            var childCategoryName = Guid.NewGuid().ToString();


            selenium.Open("/");
            selenium.Type("email", "*****@*****.**");
            selenium.Type("password", "1");
            selenium.Click("//input[@value='Войти']");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("link=добавить");
            selenium.WaitForPageToLoad("30000");
            selenium.Type("Name", categoryName);
            selenium.Click("//input[@value='Создать']");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("link=список");
            selenium.WaitForPageToLoad("30000");
            try
            {
                Assert.IsTrue(selenium.IsTextPresent(categoryName));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
            selenium.Click("link=добавить");
            selenium.WaitForPageToLoad("30000");
            selenium.Select("ParentId", "label=" + categoryName);
            selenium.Type("Name", childCategoryName);
            selenium.Click("//input[@value='Создать']");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("//div[@id='content']/div/li/ul/li/a");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("link=список");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("//div[@id='content']/div/li/ul/li/a");
            selenium.WaitForPageToLoad("30000");
            try
            {
                Assert.AreEqual(categoryName, selenium.GetSelectedLabel("ParentId"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
        }
コード例 #4
0
 public void Test_Users()
 {
     selenium.SetTimeout("100000");
     selenium.Open("Admin/tests/testreset.aspx");
     selenium.WaitForPageToLoad("30000");
     selenium.Open("Admin/QuickSetup.aspx");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Users");
     selenium.WaitForPageToLoad("30000");
     Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be.");
     Assert.IsTrue(selenium.IsTextPresent("Manage Users"), "Text 'Manage Users' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Edit"), "Text 'Edit' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Delete"), "Text 'Delete' not found when it should be.");
     selenium.Click("//input[@value='Create User']");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("ctl00_Body_ctl00_FirstName", "FirstName");
     selenium.Type("ctl00_Body_ctl00_LastName", "LastName");
     selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**");
     selenium.Type("ctl00_Body_ctl00_Username", "TestUser");
     selenium.Type("ctl00_Body_ctl00_Password", "pass");
     selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass");
     selenium.Click("ctl00_Body_ctl00_IsApproved");
     selenium.AddSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator");
     selenium.Click("//input[@value='Save']");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsTextPresent("saved successfully"), "Text 'saved successfully' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Manage Users"), "Text 'Manage Users' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("TestUser"), "Text 'TestUser' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("FirstName"), "Text 'FirstName' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("LastName"), "Text 'LastName' not found when it should be.");
     selenium.Click("link=Edit");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Administrator", selenium.GetSelectedLabel("ctl00_Body_ctl00_UserRoles"));
     selenium.Type("ctl00_Body_ctl00_FirstName", "System2");
     selenium.Type("ctl00_Body_ctl00_LastName", "Administrator2");
     selenium.Type("ctl00_Body_ctl00_Email", "[email protected]");
     selenium.Click("//input[@value='Update']");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("System2"), "Text 'System2' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Administrator2"), "Text 'Administrator2' not found when it should be.");
 }
コード例 #5
0
ファイル: Common.cs プロジェクト: hemap/PhoenixAutomationRepo
        /// <summary>
        /// Author : Roopa
        /// Date : 22-1-2013
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="selectionId"></param>
        /// <returns></returns>
        public string GetHandicapValue(ISelenium browser, string selectionId)
        {
            string handicapValue = null;
            try
            {
                //Clicking on Event Link in LHN
                LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
                Thread.Sleep(2000);
                //Selecting TopFrame
                browser.WaitForPageToLoad("60000");
                browser.SelectFrame("relative=top");
                browser.SelectFrame("MainArea");
                browser.WaitForPageToLoad("10000");

                // SelectMainFrame(browser);
                browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId);
                browser.Type("//input[@name='openbet_id']", selectionId);
                browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName);
                browser.Focus(AdminSuite.CommonControls.AdminHomePage.EventFindBtn);
                browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn);
                _frameworkCommon.WaitUntilAllElementsLoad(browser);
                browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
                browser.Focus(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button present in the selection page
                browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button present in the selection page
                browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
                Thread.Sleep(3000);
                //get the handicap value in the market page
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.currentHandicapValue))
                {
                    // handicapValue = browser.GetSelectedLabel(AdminSuite.CommonControls.EventDetailsPage.currentHandicapValue);
                    handicapValue = browser.GetSelectedLabel(AdminSuite.CommonControls.EventDetailsPage.HandicapValueListBox);
                    //browser.Gets
                }
                else
                {
                    return null;
                }
                return handicapValue;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);
                return null;
            }
        }