Exemple #1
0
        public void SetupClass()
        {
            base.StartServer();
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["baseUrl"]);
            selenium.Start();
            verificationErrors = new StringBuilder();

            selenium.DeleteAllVisibleCookies();

            selenium.Open("/dna/mbfood/");
            // To Do
            // too general, could crash test if a topic happened to have the wrong name 
            Assert.IsFalse(selenium.IsTextPresent("error"));
            Assert.IsFalse(selenium.IsTextPresent("There has been a problem"));

            selenium.Click("link=Sign in");
            selenium.Click("bbcid_username");
            selenium.Type("bbcid_username", "mpgsuper");
            selenium.Type("bbcid_password", "ratbags");
            selenium.Click("signin");
            selenium.WaitForPageToLoad("30000");

            // going this way so as to be certain to get the right site options without thinking about it
            selenium.Click("link=Site Options");
            selenium.WaitForPageToLoad("30000");

            // check a) where we are b) BBC site requirements for page titles https://confluence.dev.bbc.co.uk/display/DNA/Meta+Data - note that this title breaks those guidelines
            Assert.AreEqual("BBC - Food - DNA Administration - Site Options - Food", selenium.GetTitle());
            Assert.IsTrue(selenium.IsElementPresent("//input[@name='sov_49_General_CustomBarlesquePath']");

            stateOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='radio' and @checked='']/@value");
            valueOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='text']");
        }
Exemple #2
0
        public string SuspCustomer(ISelenium myBrowser, string strUser)
        {
            //string strUser;
            _isUpdateCustomersResourceFile = false;
            //string suspCust = "SuspCust";
            //string guidSuspCust = Guid.NewGuid().ToString().Substring(0, 2);
            //DateTime dateFormat = DateTime.Now;
            //string dateTime = (dateFormat.ToString("yyyyMMddHHmmss"));
            //suspCust = suspCust + dateTime;


            //strUser = _common.CreateCustomer(myBrowser, suspCust, StrPasswrd);


            if (strUser != "Fail")
            {
                _common.SearchCustomer(strUser, myBrowser);
                _common.SelectMainFrame(myBrowser);

                if (myBrowser.GetValue(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx) == "A")
                {
                    myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx, "Suspended");
                    myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.ReasonForSuspendingUserLstBx, "Other");
                    myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.StatusReasonLstBx, "CTS");
                    myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.ReasonForSuspendingUserTxtBx, "used for eCommerce Automation");
                    myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton);
                    _frameworkCommon.WaitUntilAllElementsLoad(myBrowser);
                    System.Threading.Thread.Sleep(6000);

                    if (myBrowser.GetValue(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx) != "S")
                    {
                        Framework.BaseTest.Fail("Suspension of Customer: Unsuccessfull");
                    }
                    else
                    {
                        _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("SuspendedCustomer", strUser, StrPasswrd);
                    }
                    if (_isUpdateCustomersResourceFile == false)
                    {
                        Framework.BaseTest.Fail("Customers Resource File updation failed.");
                    }
                }
            }
            else
            {
                Framework.BaseTest.Fail("User creation Failed");
            }

            return(strUser);
        }
Exemple #3
0
        public string GetValue(string locator)
        {
            bool actRes = false; string errStr = "", resStr = "";

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

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

            return(resStr);
        }
Exemple #4
0
 public void GoogleSearch()
 {
     selenium.Open("http://www.google.com/webhp");
     Assert.AreEqual("Google", selenium.GetTitle());
     selenium.Type("q", "Selenium OpenQA");
     Assert.AreEqual("Selenium OpenQA", selenium.GetValue("q"));
     selenium.Click("btnG");
     selenium.WaitForPageToLoad("5000");
     Assert.IsTrue(selenium.IsTextPresent("www.openqa.org"));
     Assert.AreEqual("Selenium OpenQA - Google Search", selenium.GetTitle());
 }
Exemple #5
0
 public void TestMethod3()
 {
     string URL = "http://www.abb.com";
     selenium = new DefaultSelenium("localhost", 4444, "*firefox", URL);
     selenium.Start();
     selenium.Open("/");
     Assert.AreEqual("The ABB Group - Automation and Power Technologies", selenium.GetTitle());
     selenium.Type("searchInput", "Robot");
     selenium.Click("search");
     selenium.WaitForPageToLoad("10000");
     Assert.AreEqual("The ABB Group", selenium.GetTitle());
     Assert.AreEqual("Robot", selenium.GetValue("searchInput"));
 }
        public void IISIntegrationTest()
        {
            String inputId  = "ac4";
            String updateId = "ac4update";

            selenium.Open("http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html");
            selenium.KeyPress(inputId, "\\74");
            Thread.Sleep(500);
            selenium.KeyPress(inputId, "\\97");
            selenium.KeyPress(inputId, "\\110");
            Thread.Sleep(500);
            Assert.AreEqual("Jane Agnews", selenium.GetText(updateId));
            selenium.KeyPress(inputId, "\\9");
            Thread.Sleep(500);
            Assert.AreEqual("Jane Agnews", selenium.GetValue(inputId));
        }
Exemple #7
0
        public void GoogleSearch()
        {
            //Opens up Google
            selenium.Open("http://www.google.com/webhp");

            //Verifies that the title matches
            Assert.AreEqual("Google", selenium.GetTitle());
            selenium.Type("q", "Selenium OpenQA");

            //Verifies that it can find the Selenium website
            Assert.AreEqual("Selenium OpenQA", selenium.GetValue("q"));
            selenium.Click("btnG");
            selenium.WaitForPageToLoad("5000");
            Assert.IsTrue(selenium.IsTextPresent("www.openqa.org"));
            Assert.AreEqual("Selenium OpenQA - Google Search", selenium.GetTitle());
        }
        /// <summary>
        /// Verifying selection data
        /// </summary>
        /// <param name="browser">Browser instance</param>
        /// <param name="testData">TestData</param>
        public void VerifySelectionData(ISelenium browser, TestData testData)
        {
            string selectionStatus = string.Empty;
            string selectionDisplay = string.Empty;
            string selectionPrice = string.Empty;
            bool updateSelectionFlg = false;

            if (_frameworkCommon.WaitUntilElementPresent(browser, "name=OcDesc", "60") == true)
            {
                selectionStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx);

                selectionDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx);

                selectionPrice = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx);

                if ("a" != selectionStatus.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx, "label=Active");
                    Console.WriteLine("Updated selection status to Active");
                    updateSelectionFlg = true;
                }

                if ("y" != selectionDisplay.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=Yes");
                    Console.WriteLine("Updated selection display to Yes");
                    updateSelectionFlg = true;
                }

                if (testData.Odds != selectionPrice)
                {
                    browser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, testData.Odds);
                    Console.WriteLine("Updated selection price from test data");
                    updateSelectionFlg = true;
                }

                if (updateSelectionFlg)
                {
                    if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn))
                    {
                        browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn);
                        browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
                    }
                    else
                    {
                        Console.WriteLine("Unable to update the event in Openbet");
                    }

                    Thread.Sleep(3000);
                }
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            }
        }
        /// <summary>
        /// Verifying market data in openbet
        /// </summary>
        /// <param name="browser">Browser instance</param>
        /// <param name="testData">Test data</param>
        public void VerifyMarketData(ISelenium browser, TestData testData)
        {
            string marketStatus = string.Empty;
            string marketDisplay = string.Empty;
            bool updateMarketFlg = false;

            if (_frameworkCommon.WaitUntilElementPresent(browser, "name=MktName", "60") == true)
            {

                marketStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox);

                marketDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox);

                if ("a" != marketStatus.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active");
                    Console.WriteLine("Updated Market status to Active");
                    updateMarketFlg = true;
                }

                if ("y" != marketDisplay.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=Yes");
                    Console.WriteLine("Updated market display to Yes");
                    updateMarketFlg = true;
                }

                if (updateMarketFlg)
                {
                    if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton))
                    {
                        browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton);
                        browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                        Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull");
                    }
                    else
                    {
                        Console.WriteLine("Unable to update the event in Openbet");
                    }
                }
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            }
        }
Exemple #10
0
        /// <summary>
        /// Verifying event details data in openbet
        /// </summary>
        /// <param name="browser">Browser instance</param>
        /// <param name="testData">Test data</param>
        public void VerifyEventData(ISelenium browser, TestData testData)
        {
            //IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

            string eventStatus = string.Empty;
            string eventDisplay = string.Empty;
            bool updateEventFlg = false;
            //Wait Untill the EventDetails Page loads
            if (_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
            {

                eventStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox);

                eventDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx);

                if ("a" != eventStatus.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active");
                    Console.WriteLine("Updated Event status to Active");
                    updateEventFlg = true;
                }

                if ("y" != eventDisplay.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=Yes");
                    Console.WriteLine("Updated Event display to Yes");
                    updateEventFlg = true;
                }

                if (updateEventFlg)
                {
                    if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn))
                    {
                        browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn);
                        browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                        Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull");
                    }
                    else
                    {
                        Console.WriteLine("Unable to update the event in Openbet");
                    }
                }
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            }
        }
Exemple #11
0
 public string GetEventStartDateTime(ISelenium browser)
 {
     string startTimeXpath = "//input[@name='EvStartTime']";
     string startTime = string.Empty;
     if (browser.IsElementPresent(startTimeXpath))
     {
         //startTime = browser.GetText(startTimeXpath);
         startTime = browser.GetValue(startTimeXpath);
     }
     return startTime;
 }
Exemple #12
0
 /// <summary>
 /// Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
 /// For checkbox/radio elements, the value will be "on" or "off" depending on
 /// whether the element is checked or not.
 /// </summary>
 /// <param name="locator">The locator.</param>
 /// <param name="type">Type of locator</param>
 /// <returns></returns>
 public string GetValue(string locator, FindType type = FindType.ById)
 {
     return(_selenium.GetValue(locator));
 }