Exemplo n.º 1
0
        /// <summary>
        /// To Update Markt  Status
        /// </summary>
        /// <param name="browser">Selenium browser instance</param>
        /// <param name="catName">Category Name</param>
        /// <param name="eventClsName">Event ClassName</param>
        /// <param name="eventTypeName">Event TypeName</param>
        /// <param name="eventSubType">Event SubType</param>
        /// <param name="eventName">Event Name</param>
        /// <param name="eventStatus">Event Display Status</param>
        public void UpdateMarketStatus(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, string mktName, string marketStatus)
        {
            string errorMessage = "";
            bool eventUpdationStatus = false;
            bool finalEventStatus = true;
            Framework.Common.Common frameworkcommon = new Framework.Common.Common();
            AdminSuite.Common com = new AdminSuite.Common();
            Framework.Common.Common Fcommon = new Framework.Common.Common();

            TimeSpan ts = new TimeSpan(0, 1, 0);
            IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

            //Clicking on Event Link in LHN
            LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
            //Selecting TopFrame
            SelectMainFrame(browser);
            System.Threading.Thread.Sleep(10000);

            frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60");
            catName = catName.Replace("|", "").Trim();
            if (catName != "")
            {
                Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList");
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName);
            }
            eventClsName = eventClsName.Replace("|", "").Trim();

            if (eventClsName != "")
            {
                Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present");
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName);
            }
            if (eventTypeName != "")
            {
                Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present");
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName);
            }
            Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing");

            // Selecting Daterange
            browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--");

            //Clicking on Seach button
            browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn);
            _frameworkCommon.WaitUntilAllElementsLoad(browser);
            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

            // Wait for Element to present
            if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true)
            {
                browser.Click("link=" + eventName);
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Thread.Sleep(10000);
                //Wait Untill the EventDetails Page loads
                if (frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
                {

                    if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + "|" + mktName + "|" + "", "60") == true)
                    {
                        //browser.Click("link=" + mktName);
                        browser.Click("link=" + "|" + mktName + "|");
                        browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                        if (marketStatus == "Suspend")
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Suspended");
                            eventUpdationStatus = false;
                            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                        }
                        else
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active");
                        }

                        //Updating the Event
                        if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton))
                        {
                            if (eventUpdationStatus == false)
                            {
                                browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton);
                                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                                Assert.IsTrue(frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "markrt display status Updation is not Successfull");
                                browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn);
                                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                            }
                        }
                    }
                }
            }
            else
            {
                finalEventStatus = false;
                errorMessage = errorMessage + eventName;
                errorMessage = errorMessage + Environment.NewLine;
            }

            //Finally checking whether all the Events are Suspended or not
            if (finalEventStatus == false)
            {
                Framework.BaseTest.Fail("market display status updation Process is Failed");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// To suspend/ Activate the Events
        /// </summary>
        /// <param name="browser">Selenium browser instance</param>
        /// <param name="catName">Category Name</param>
        /// <param name="eventClsName">Event ClassName</param>
        /// <param name="eventTypeName">Event TypeName</param>
        /// <param name="eventSubType">Event SubType</param>
        /// <param name="eventName">Event Name</param>
        /// <param name="eventStatus">Event Status</param>
        public void UpdateEvents(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, string eventStatus)
        {
            string errorMessage = "";
            bool eventUpdationStatus = false;
            bool finalEventStatus = true;
            Framework.Common.Common frameworkcommon = new Framework.Common.Common();
            AdminSuite.Common com = new AdminSuite.Common();
            Framework.Common.Common Fcommon = new Framework.Common.Common();

            TimeSpan ts = new TimeSpan(0, 1, 0);
            IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

            //Clicking on Event Link in LHN
            LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
            //Selecting TopFrame
            System.Threading.Thread.Sleep(10000);
            SelectMainFrame(browser);

            frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60");
            catName = catName.Replace("|", "").Trim();
            if (catName != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName);
                }
            }
            eventClsName = eventClsName.Replace("|", "").Trim();

            if (eventClsName != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName);
                }
            }
            if (eventTypeName != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName);
                }
            }
            if (eventSubType != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, eventSubType), "EventSubType Name does not present");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, "label=" + eventSubType);
                }
            }
            Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing");

            // Selecting Daterange
            if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx))
            {
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--");
            }
            //Clicking on Seach button
            browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn);
            _frameworkCommon.WaitUntilAllElementsLoad(browser);
            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            //Thread.Sleep(2000);
            // Wait for Element to present

            if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true)
            {
                browser.Click("link=" + eventName);
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                if (eventStatus == "Taginfo" || eventStatus == "Taginfoundo")
                {
                    browser.Click("//a[contains(string(),'Race Winner')]");
                    Thread.Sleep(10000);
                    browser.Click("//tr[@class='active']//a[contains(string(),'Horse1')]");
                    Thread.Sleep(10000);
                    if (eventStatus == "Taginfoundo")
                        browser.Select("name=OcFlag", "label=Named runner");
                    else
                        browser.Select("name=OcFlag", "label=Unnamed favourite");

                    browser.Click("//input[@value='Modify Selection']");
                }
                else
                {
                    //Wait Untill the EventDetails Page loads
                    if (frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
                    {
                        if (eventStatus == "Suspend")
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Suspended");
                            eventUpdationStatus = false;
                            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                        }
                        else
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active");
                        }

                        //Updating the Event
                        if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn))
                        {
                            if (eventUpdationStatus == false)
                            {
                                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
            {
                finalEventStatus = false;
                errorMessage = errorMessage + eventName;
                errorMessage = errorMessage + Environment.NewLine;
            }

            //Finally checking whether all the Events are Suspended or not
            if (finalEventStatus == false)
            {
                Console.WriteLine("Following Events are not Suspended, Please verify Manually" + Environment.NewLine + errorMessage);
                Framework.BaseTest.Fail("Event suspending Process is Failed");
            }
        }