示例#1
0
        public void TVAdmin_001_BuyChannelFunctionality()
        {
            try
            {
                IETTVAdminPortal.Chrome.Chrome_IndividualChannelPricing icpAdmin = new IETTVAdminPortal.Chrome.Chrome_IndividualChannelPricing(driver, log, executor, iWait);

                log.Info("TVAdmin_001_BuyChannelFunctionality test Started" + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                string categoryName = cf.readingXMLFile("WebPortal", "BuyChannel", "CategoryName", "Config.xml");

                // moving to Channel Management Page
                RedirectToChannelManagement();

                string channelName = CreatePaidChannel(categoryName);

                UpdateProductCode(channelName);

                RedirectToPricing(channelName, icpAdmin);

                objAdminVideoManagement.redirectToVideoManagement();

                objAdminVideoManagement.basicInfoTab();

                String adminSelectedChannel = channelListTab(channelName);

                objAdminVideoManagement.pricingListTab("Subscription");

                objAdminVideoManagement.addcopyright();

                objAdminVideoManagement.uploadBrowseVideo();

                objAdminVideoManagement.finalPublishVideo("normal");

                //waiting for 2.5 minutes as video will be publish after 2minutes from current system time
                Thread.Sleep(150000);

                uf.OpenNewTab(driver);

                log.Info("count ::: " + driver.WindowHandles.Count);

                String browsertype = uf.getRunningBrowser(driver, driver.FindElement(By.TagName("html")));

                uf.SwitchToWebTab(driver, browsertype);

                uf.NavigateWebPortal(cf, driver);

                buyVidVerification.VerifyBuyChannel(objAdminVideoManagement.videoName);

                log.Info("TVAdmin_001_BuyChannelFunctionality test completed" + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());
            }

            catch (Exception e)
            {
                log.Error(e.Message + "\n" + e.StackTrace + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());
                Console.WriteLine(e.Message + "\n" + e.StackTrace + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                Assert.AreEqual(true, false);
            }
        }
        public void TVAdmin_001_ReportAbuseTest()
        {
            try
            {
                log.Info("TVAdmin_001_ReportAbuseTest Started" + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                objAdminVideoManagement.redirectToVideoManagement();

                objAdminVideoManagement.basicInfoTab();

                String adminSelectedChannel = objAdminVideoManagement.channelListTab();

                objAdminVideoManagement.pricingListTab("Free");

                objAdminVideoManagement.addcopyright();

                objAdminVideoManagement.uploadBrowseVideo();

                objAdminVideoManagement.finalPublishVideo("normal");

                //waiting for 2.5 minutes as video will be publish after 2minutes from current system time
                Thread.Sleep(150000);

                uf.OpenNewTab(driver);

                log.Info("Window count ::: " + driver.WindowHandles.Count);

                String browsertype = uf.getRunningBrowser(driver, driver.FindElement(By.TagName("html")));

                uf.SwitchToWebTab(driver, browsertype);

                uf.NavigateWebPortal(cf, driver);

                reportAbuseVerification.ReportAbuseTest(objAdminVideoManagement.videoName, guid_Admin);

                log.Info("TVAdmin_001_ReportAbuseTest completed" + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());
            }

            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n" + e.StackTrace + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                log.Error(e.Message + "\n" + e.StackTrace + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                Assert.AreEqual(true, false);
            }
        }
        public void saveExternalVideo()
        {
            log.Info("inside saveExternalVideo" + "at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

            iWait.Until(ExpectedConditions.ElementExists((OR.GetElement("VideoManagement", "VidNumberTXT", "TVAdminPortalOR.xml"))));

            pricingListTab("Free");

            objAdminVideoManagement.addcopyright();

            Thread.Sleep(3000);

            //click save button
            driver.FindElement(OR.GetElement("ExternalAccessManagement", "SaveVideobtn", "TVAdminPortalOR.xml")).Click();

            objAdminVideoManagement.verifySuccessBannerMessage("Record Saved Successfully.");
        }
        string CreateVideFunctionality(string vidName)
        {
            IList <IWebElement> videoRowList = (IList <IWebElement>)driver.FindElement((OR.GetElement("VideoRequestByUser", "VideoBoookingList", "TVAdminPortalOR.xml"))).FindElements(By.TagName("tr"));

            int i = 0;

            foreach (IWebElement currentRow in videoRowList)
            {
                //Check Row that have class="GridRowStyle" or class="AltGridStyle"

                if (currentRow.GetAttribute("class").Equals("GridRowStyle") || currentRow.GetAttribute("class").Equals("AltGridStyle"))
                {
                    String columData = currentRow.FindElements(By.TagName("td"))[3].FindElement(By.TagName("span")).Text.Trim();

                    log.Info("Video Title from manage page::" + columData);

                    if (columData.Equals(vidName))
                    {
                        objAdminVideoManagement = new IETTVAdminPortal.Chrome.Chrome_VideoManagement(driver, log, executor, iWait);

                        //Click on Create button
                        IWebElement createButton = driver.FindElement(OR.GetElement("VideoRequestByUser", "CreateButton", "TVAdminPortalOR.xml", i));

                        createButton.Click();

                        iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoRequestByUser", "WarningYesButton", "TVAdminPortalOR.xml"))));

                        driver.FindElement((OR.GetElement("VideoRequestByUser", "WarningYesButton", "TVAdminPortalOR.xml"))).Click();

                        iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoRequestByUser", "BasicInfoTab", "TVAdminPortalOR.xml"))));

                        Thread.Sleep(4000);

                        //OverlayWait();

                        // Thread.Sleep(2000);

                        Assert.AreEqual(viewVideoName, driver.FindElement((OR.GetElement("VideoRequestByUser", "VideoTitle", "TVAdminPortalOR.xml"))).GetAttribute("value"));

                        guid_Admin = driver.FindElement((OR.GetElement("VideoRequestByUser", "GuAdminId", "TVAdminPortalOR.xml"))).GetAttribute("value");

                        iWait.Until(ExpectedConditions.ElementExists((OR.GetElement("VideoRequestByUser", "VideoTypeDRD", "TVAdminPortalOR.xml"))));

                        IWebElement videoType = driver.FindElement((OR.GetElement("VideoRequestByUser", "VideoTypeDRD", "TVAdminPortalOR.xml")));
                        ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", videoType);

                        //Thread.Sleep(3000);
                        SelectElement VideoTypeSelector = new SelectElement(videoType);

                        VideoTypeSelector.SelectByIndex(3);
                        //VideoTypeSelector.SelectByText("Keynote");

                        String selectedVideoType = VideoTypeSelector.SelectedOption.Text.Trim();

                        //uf.scrollUp(driver);

                        objAdminVideoManagement.addcopyright();

                        uf.scrollUp(driver);

                        Thread.Sleep(4000);

                        objAdminVideoManagement.uploadBrowseVideo();

                        objAdminVideoManagement.finalPublishVideo("normal");

                        //waiting for 2.5 minutes as video will be publish after 2minutes from current system time
                        Thread.Sleep(150000);

                        break;
                    }

                    i++;
                }
            }
            return(guid_Admin);
        }
        public String SearchRequiredVideoFromTable(String videoName, String action)
        {
            log.Info("Search for the required video");

            String abstractContent = "Abstract field content";

            uf.isJqueryActive(driver);

            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))));

            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))).SendKeys(videoName);

            //search the required video
            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchButton", "TVAdminPortalOR.xml"))).Click();

            OverlayWait();

            Thread.Sleep(3000);

            iWait.Until(ExpectedConditions.ElementExists((OR.GetElement("UserGeneratedContent", "VideoStatus", "TVAdminPortalOR.xml"))));

            IWebElement tblVideoListing = driver.FindElement((OR.GetElement("UserGeneratedContent", "VideoStatus", "TVAdminPortalOR.xml")));

            iWait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.TagName("tr")));

            IList <IWebElement> userContentRowList = (IList <IWebElement>)tblVideoListing.FindElements(By.TagName("tr"));

            Boolean flag = false;

            int i = 0;

            foreach (IWebElement currentRow in userContentRowList)
            {
                //Check Row that have class="GridRowStyle" or class="AltGridStyle"
                if (currentRow.GetAttribute("class").Equals("GridRowStyle") || currentRow.GetAttribute("class").Equals("AltGridStyle"))
                {
                    String columData = currentRow.FindElements(By.TagName("td"))[3].FindElement(By.TagName("span")).Text.Trim();

                    log.Info("Video Title from manage page::" + columData);

                    if (columData.Equals(videoName))
                    {
                        flag = true;

                        if (action.Equals("reject"))
                        {
                            log.Info("Performing reject operation");

                            //click on Reject
                            driver.FindElement(OR.GetElement("UserGeneratedContent", "RejectButton", "TVAdminPortalOR.xml", i)).Click();

                            //driver.SwitchTo().Alert();
                            //VerifySuccessBannerMessage("Record deleted successfully");

                            //////////// new added /////////////
                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoRequestByUser", "WarningYesButton", "TVAdminPortalOR.xml"))));

                            driver.FindElement((OR.GetElement("VideoRequestByUser", "WarningYesButton", "TVAdminPortalOR.xml"))).Click();

                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("SeriesManagement", "SuccessOkButton", "TVAdminPortalOR.xml"))));

                            driver.FindElement((OR.GetElement("SeriesManagement", "SuccessOkButton", "TVAdminPortalOR.xml"))).Click();
                            //////////// new added /////////////

                            //VerifySuccessBannerMessage("Record deleted successfully");

                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))));

                            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))).Clear();
                            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))).SendKeys(videoName);
                            Thread.Sleep(2000);
                            uf.scrollUp(driver);
                            //search the required video
                            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchButton", "TVAdminPortalOR.xml"))).Click();

                            OverlayWait();

                            #region verify status at admin table

                            log.Info("verify status at admin table");

                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("UserGeneratedContent", "VideoStatus", "TVAdminPortalOR.xml"))));

                            tblVideoListing = driver.FindElement((OR.GetElement("UserGeneratedContent", "VideoStatus", "TVAdminPortalOR.xml")));

                            iWait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.TagName("tr")));

                            userContentRowList = (IList <IWebElement>)tblVideoListing.FindElements(By.TagName("tr"));

                            flag = false;

                            i = 0;

                            foreach (IWebElement currentRow1 in userContentRowList)
                            {
                                //Check Row that have class="GridRowStyle" or class="AltGridStyle"
                                if (currentRow1.GetAttribute("class").Equals("GridRowStyle") || currentRow1.GetAttribute("class").Equals("AltGridStyle"))
                                {
                                    columData = currentRow1.FindElements(By.TagName("td"))[3].FindElement(By.TagName("span")).Text.Trim();

                                    log.Info("Video Title from manage page::" + columData);

                                    if (columData.Equals(videoName))
                                    {
                                        flag = true;

                                        Assert.AreEqual("Rejected", currentRow1.FindElements(By.TagName("td"))[7].FindElement(By.TagName("span")).Text.Trim());
                                    }

                                    break;
                                }

                                i++;
                            }
                            #endregion
                        }
                        else
                        {
                            //click on Create
                            driver.FindElement(OR.GetElement("UserGeneratedContent", "CreateButton", "TVAdminPortalOR.xml", i)).Click();

                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoManagement", "VidNumberTXT", "TVAdminPortalOR.xml"))));

                            //getting GUID of the current video
                            guid_Admin = driver.FindElement((OR.GetElement("VideoRequestByUser", "GuAdminId", "TVAdminPortalOR.xml"))).GetAttribute("value");

                            log.Info("Guid_Admin:: " + guid_Admin);

                            #region Enter abstract data
                            //Enter data into abstract field
                            iWait.Until(ExpectedConditions.ElementExists((OR.GetElement("VideoManagement", "Abstract", "TVAdminPortalOR.xml"))));

                            IWebElement abstract_frame = driver.FindElement((OR.GetElement("VideoManagement", "Abstract", "TVAdminPortalOR.xml")));

                            driver.SwitchTo().Frame(abstract_frame);

                            IWebElement editor_body = driver.FindElement(By.TagName("body"));

                            Thread.Sleep(3000);

                            OpenQA.Selenium.Interactions.Actions act = new OpenQA.Selenium.Interactions.Actions(driver);
                            act.SendKeys(editor_body, abstractContent).Build().Perform();
                            driver.SwitchTo().DefaultContent();

                            #endregion

                            objAdminVideoMngmnt.channelListTab();

                            objAdminVideoMngmnt.addcopyright();

                            log.Info("inside uploadBrowseVideo " + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoManagement", "UploadVidTab", "TVAdminPortalOR.xml"))));
                            //Click on uplaod video tab
                            driver.FindElement((OR.GetElement("VideoManagement", "UploadVidTab", "TVAdminPortalOR.xml"))).FindElement(By.TagName("a")).Click();

                            int    count  = 0;
                            String status = null;;

                            //checking the status of video for 5mins untill it gets Ready
                            while (count < 60)
                            {
                                iWait.Until(ExpectedConditions.InvisibilityOfElementLocated((OR.GetElement("SeriesManagement", "SuccessOkButton", "TVAdminPortalOR.xml"))));

                                status = driver.FindElement((OR.GetElement("VideoManagement", "StatusCSS", "TVAdminPortalOR.xml"))).Text;

                                log.Info("status of the Video:::" + status);

                                if (status.Equals("Status: READY"))
                                {
                                    break;
                                }
                                Thread.Sleep(5000);

                                count = count + 1;

                                IWebElement videoPreviewButton = driver.FindElement((OR.GetElement("VideoManagement", "VidPreviewBTN", "TVAdminPortalOR.xml")));

                                //Click on the preview button
                                executor.ExecuteScript("arguments[0].click();", videoPreviewButton);
                            }

                            Assert.AreEqual("Status: READY", status);

                            Thread.Sleep(2000);

                            objAdminVideoMngmnt.finalPublishVideo("normal");

                            OverlayWait();

                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))));

                            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))).Clear();
                            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchVideoTB", "TVAdminPortalOR.xml"))).SendKeys(videoName);

                            //search the required video
                            driver.FindElement((OR.GetElement("VideoRequestByUser", "SearchButton", "TVAdminPortalOR.xml"))).Click();

                            OverlayWait();

                            #region verify status at admin table

                            log.Info("verify status at admin table");

                            iWait.Until(ExpectedConditions.ElementIsVisible((OR.GetElement("UserGeneratedContent", "VideoStatus", "TVAdminPortalOR.xml"))));

                            tblVideoListing = driver.FindElement((OR.GetElement("UserGeneratedContent", "VideoStatus", "TVAdminPortalOR.xml")));

                            iWait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.TagName("tr")));

                            userContentRowList = (IList <IWebElement>)tblVideoListing.FindElements(By.TagName("tr"));

                            flag = false;

                            i = 0;

                            foreach (IWebElement currentRow1 in userContentRowList)
                            {
                                //Check Row that have class="GridRowStyle" or class="AltGridStyle"
                                if (currentRow1.GetAttribute("class").Equals("GridRowStyle") || currentRow1.GetAttribute("class").Equals("AltGridStyle"))
                                {
                                    columData = currentRow1.FindElements(By.TagName("td"))[3].FindElement(By.TagName("a")).Text.Trim();

                                    log.Info("Video Title from manage page::" + columData);

                                    if (columData.Equals(videoName))
                                    {
                                        flag = true;

                                        Assert.AreEqual("Published", currentRow1.FindElements(By.TagName("td"))[7].FindElement(By.TagName("span")).Text.Trim());
                                    }

                                    break;
                                }

                                i++;
                            }
                            #endregion

                            return(guid_Admin);
                        }
                    }
                }
            }
            return(null);
        }