Esempio n. 1
0
 /// <summary>
 /// Click on a button/ radio-button/ check-box present in the page
 /// </summary>
 /// <param name="locator">The locator.</param>
 /// <param name="type">Type of locator</param>
 public void Click(string locator, FindType type = FindType.ById)
 {
     _selenium.ChooseOkOnNextConfirmation();
     _selenium.Click(locator);
     if (_selenium.IsConfirmationPresent())
     {
         _selenium.GetConfirmation();
     }
 }
Esempio n. 2
0
 public void Test_CreateEditDeleteRole()
 {
     selenium.SetTimeout("100000");
     selenium.Open("Admin/tests/testreset.aspx");
     selenium.WaitForPageToLoad("30000");
     selenium.Open("Admin/QuickSetup.aspx");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Roles");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("//input[@value='Create Role']");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1");
     selenium.Click("ctl00_Body_ctl00_SaveButton");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Test Role #1"), "Text 'Test Role #1' not found when it should be.");
     selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1");
     selenium.Click("//input[@value='Update']");
     selenium.WaitForPageToLoad("30000");
     selenium.ChooseOkOnNextConfirmation();
     selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this role?") > -1, "Confirm box didn't appear when expected.");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsTextPresent("deleted successfully"), "Text 'deleted successfully' not found when it should be.");
     Assert.IsFalse(selenium.IsTextPresent("Test Role"), "Text 'Test Role' found when it shouldn't be.");
 }
        public TT Navigate <TT>(Action action, bool chooseOkOnConfirmation) where TT : PageBase, new()
        {
            var target = new TT();

            InitPage(target);

            if (chooseOkOnConfirmation)
            {
                _selenium.ChooseOkOnNextConfirmation();
            }

            action();

            if (chooseOkOnConfirmation)
            {
                if (_selenium.IsConfirmationPresent())
                {
                    _selenium.GetConfirmation();
                }
            }

            WaitLoad(target);
            AssertErrorPage(target);
            AssertCorrectPageLoaded(target);

            return(target);
        }
 public void Test_CreateEditDeleteUser()
 {
     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");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("ctl00_Body_ctl00_CreateButton");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("ctl00_Body_ctl00_FirstName", "Test1");
     selenium.Type("ctl00_Body_ctl00_LastName", "Test1");
     selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**");
     selenium.Type("ctl00_Body_ctl00_Username", "test1");
     selenium.Type("ctl00_Body_ctl00_Password", "pass");
     selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass");
     selenium.AddSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator");
     selenium.Click("ctl00_Body_ctl00_SaveButton");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be.");
     Assert.IsTrue(selenium.IsTextPresent("Test1"), "Text 'Test1' not found when it should be.");
     selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("ctl00_Body_ctl00_FirstName", "Test2");
     selenium.Type("ctl00_Body_ctl00_LastName", "Test2");
     selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**");
     selenium.Type("ctl00_Body_ctl00_Username", "test2");
     selenium.RemoveSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator");
     selenium.Click("ctl00_Body_ctl00_UpdateButton");
     selenium.WaitForPageToLoad("30000");
     selenium.ChooseOkOnNextConfirmation();
     selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton");
     Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this user?") > -1, "Confirm box didn't appear when expected.");
     Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be.");
     Assert.IsFalse(selenium.IsTextPresent("Test1"), "Text 'Test1' found when it shouldn't be.");
 }
Esempio n. 5
0
        /// <summary>
        /// Updates a perticular segment value
        /// </summary>
        ///  Author: Kiran
        /// <param name="browser">browser Instance</param>
        /// <param name="userName">User Name</param>
        /// <param name="segmentType">HVC</param>
        /// <param name="segmentVal">Yes</param>
        public bool UpdateSegments(ISelenium adminBrowser, string userName, string segmentType, string segmentVal)
        {
            try
            {
                // Enter Customer Name and Search
                SearchCustomer(userName, adminBrowser);
                SelectMainFrame(adminBrowser);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegment);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                string xPath = "//tr/td[contains(text(), '" + segmentType + "')]/following-sibling::td/select";
                Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath);
                adminBrowser.Select(xPath, segmentVal);
                Thread.Sleep(1000);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegmentandURL);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td[contains(text(), '" + segmentVal + "')]";
                if (segmentVal.ToLower().Contains("unset") || segmentVal.ToLower().Contains("no"))
                {
                    if (adminBrowser.IsAlertPresent())
                    {
                        adminBrowser.ChooseOkOnNextConfirmation();
                    }
                    xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td/i[contains(text(), '" + segmentVal + "')]";
                }
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.backBtn);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath);
                return true;
            }
            catch (Exception ex)
            {
                CaptureScreenshot(adminBrowser, "");
                Fail(ex.Message);
                return false;
            }
        }
Esempio n. 6
0
        /// <Summary>
        /// Do Manual Adjustment
        /// Author: Kiran 
        /// </Summary>
        public bool PerformManualAdjustment(ISelenium adminBrowser, string customerName, string typeGroup, string amount, string withdrawal, string type, string description, string dateFrom, string dateTo, string dateRange)
        {
            try
            {
                bool bStatus = false;
                SearchCustomer(customerName, adminBrowser);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                //Selecting TopFrame
                SelectMainFrame(adminBrowser);
                adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.typeGrouplstBox, typeGroup);
                adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.amountFld, amount);
                adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.withdrawableLst, withdrawal);
                adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.typeLstBox, type);
                adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.descriptionFld, description);
                if (!string.IsNullOrEmpty(dateFrom))
                {
                    adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.dateFromFld, Convert.ToDateTime(dateFrom).ToString("yyyy-MM-dd hh:mm:ss"));
                }
                if (!string.IsNullOrEmpty(dateTo))
                {
                    adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.dateToFld, Convert.ToDateTime(dateTo).ToString("yyyy-MM-dd hh:mm:ss"));
                }
                adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.dateRangeLst, dateRange);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ManAdjBtn);

                adminBrowser.ChooseOkOnNextConfirmation();
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Assert.IsTrue(adminBrowser.IsTextPresent("Manual Adjustment Successful"), "Failed to do Manual Adjustment");
                bStatus = true;
                return bStatus;
            }
            catch (Exception ex)
            {
                CaptureScreenshot(adminBrowser, "");
                Fail(ex.Message);
                return false;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Uploads the specified csv files to create Events/Markets/Selections
        /// </summary>
        /// <param name="filepath">Exact file name along with full path</param>
        /// <param name="browser">Browser instance</param>
        public void UploadCsvFilesToAdmin(string filepath, ref ISelenium browser)
        {
            try
            {

                browser.SelectFrame("relative=top");
                browser.SelectFrame("TopBar");
                //browser.Click("//li[a[text()='Events']]/following-sibling::li[a[text()='Event Upload']]");
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
                driver.FindElement(By.LinkText("Event Upload")).Click();
                browser.WaitForPageToLoad("60000");
                browser.SelectFrame("relative=top");
                browser.SelectFrame("MainArea");
                browser.WaitForPageToLoad("10000");
                string[] filename = filepath.Split('\\');
                Console.WriteLine(filename[filename.Length - 1] + " : Is the file name");

                switch (filename[filename.Length - 1])
                {
                    case "EVENTS.CSV":

                        //events,markets,selections,results,fbscores
                        browser.Select("name=filetype", "Events");
                        browser.Type("name=filename", filepath);

                        browser.Focus("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.Click("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.WaitForPageToLoad("10000");
                        Assert.IsTrue(browser.IsElementPresent("//td/a[(text()='EVENTS.CSV')]"), "");
                        browser.Click("//td/a[contains(text(),'EVENTS.CSV')]");
                        browser.WaitForPageToLoad("10000");
                        browser.Click("name=SetResult");
                        browser.WaitForPageToLoad("10000");

                        // to handle javascript pop up
                        if (browser.IsAlertPresent())
                            browser.ChooseOkOnNextConfirmation();
                        Thread.Sleep(2000);
                        //string fileUploadmsg = browser.GetText("//tr[@class=infoyes/tb/b");
                        //Console.WriteLine(fileUploadmsg + "is the message displayed after File upload, Expected message is 'File uploaded OK'");
                        browser.Click("//input[@value='Delete File']");
                        browser.WaitForPageToLoad("10000");
                        break;

                    case "market.CSV":

                        browser.Select("name=filetype", "Markets");//events,markets,selections,results,fbscores
                        browser.Type("name=filename", filepath);

                        browser.Focus("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.Click("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");//upload file
                        browser.WaitForPageToLoad("10000");
                        Assert.IsTrue(browser.IsElementPresent("//td/a[(text()='market.CSV')]"), "");
                        browser.Click("//td/a[contains(text(),'market.CSV')]");
                        browser.WaitForPageToLoad("10000");
                        browser.Click("name=SetResult");
                        browser.WaitForPageToLoad("10000");

                        /// to handle javascript pop up
                        if (browser.IsAlertPresent())
                            browser.ChooseOkOnNextConfirmation();

                        Thread.Sleep(2000);
                        //string fileUplodmsg = browser.GetText("//tr[@class=infoyes/tb/b");
                        //Console.WriteLine(fileUplodmsg + "is the message displayed after File upload, Expected message is 'File uploaded OK'");
                        browser.Click("//input[@value='Delete File']");
                        browser.WaitForPageToLoad("10000");
                        break;

                    case "SELECTIONS.CSV":

                        browser.Select("name=filetype", "Selections");//events,markets,selections,results,fbscores
                        browser.Type("name=filename", filepath);

                        browser.Focus("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.Click("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");//upload file
                        browser.WaitForPageToLoad("10000");
                        Assert.IsTrue(browser.IsElementPresent("//td/a[(text()='SELECTIONS.CSV')]"), "");
                        browser.Click("//td/a[contains(text(),'SELECTIONS.CSV')]");
                        browser.WaitForPageToLoad("10000");
                        browser.Click("name=SetResult");
                        browser.WaitForPageToLoad("10000");

                        Thread.Sleep(2000);
                        /// to handle javascript pop up
                        if (browser.IsAlertPresent())
                            browser.ChooseOkOnNextConfirmation();

                        Thread.Sleep(2000);
                        //string fileUplodmessage = browser.GetText("//tr[@class=infoyes/tb/b");
                        //Console.WriteLine(fileUplodmessage + "is the message displayed after File upload, Expected message is 'File uploaded OK'");
                        browser.Click("//input[@value='Delete File']");
                        browser.WaitForPageToLoad("10000");
                        break;

                    default:
                        break;

                }
            }
            catch (Exception Ex)
            {
                Framework.BaseTest.CaptureScreenshot(browser, "");
                Console.WriteLine(Ex.StackTrace);
                Framework.BaseTest.Fail(Ex.Message);
            }
        }