예제 #1
0
 public void Settings_100_12_4()
 {
     HomePage.SelectLeftMenuItem(driver, LocatorType.XPath, "//div[@id='zone-top']/div/div/div", LocatorType.Id, "settings");
     driver.FindElement(By.CssSelector("span.option.off"));
     if (driver.FindElement(By.CssSelector("span.option.off")).GetAttribute("class").Contains("selected"))
     {
         driver.FindElement(By.CssSelector("span.option.on")).Click();
         driver.FindElement(By.CssSelector("div.confirm-button.button > div.content")).Click();
         driver.FindElement(By.CssSelector("div.confirm-button.button > div.content")).Click();
         ControlAccessMethods.LogOut(driver);
         Thread.Sleep(3000);
         ControlAccessMethods.LogIn(driver, "470000001", "12345678");
         HomePage.SelectLeftMenuItem(driver, LocatorType.XPath, "//div[@id='zone-top']/div/div/div", LocatorType.Id, "settings");
         Assert.AreEqual(true, driver.FindElement(By.CssSelector("span.option.on")).GetAttribute("class").Contains("selected"));
     }
     else
     {
         driver.FindElement(By.CssSelector("span.option.off")).Click();
         ControlAccessMethods.LogOut(driver);
         Thread.Sleep(3000);
         ControlAccessMethods.LogIn(driver, "470000001", "12345678");
         HomePage.SelectLeftMenuItem(driver, LocatorType.XPath, "//div[@id='zone-top']/div/div/div", LocatorType.Id, "settings");
         Assert.AreEqual(true, driver.FindElement(By.CssSelector("span.option.off")).GetAttribute("class").Contains("selected"));
     }
 }
      public void AnnoymousAccess_100_1_4()
      {
          HomePage.SelectLeftMenuItem(driver, LocatorType.XPath, "//div[@id='zone-top']/div/div/div", LocatorType.Id, "guide");
          Thread.Sleep(3000);


          string title = string.Empty;

          for (int i = 0; i < driver.FindElements(By.ClassName("live")).Count; i = i + 10)
          {
              title = (driver.FindElements(By.ClassName("live")))[i].Text.Split('\n')[1];
              driver.FindElements(By.ClassName("live"))[i].Click();
              Thread.Sleep(10000);
              Assert.AreEqual(true, driver.FindElement(By.ClassName("parental-rating")).Text.Length > 10);

              Assert.AreEqual(true, title.Contains(driver.FindElement(By.CssSelector("div.left-column > div.title")).Text));
              Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.ClassName, "watch-button"));

              driver.FindElement(By.ClassName("watch-button")).Click();

              Assert.AreEqual("LOG IN", driver.FindElement(By.CssSelector("div.header > div.title")).Text);
              Assert.AreEqual("LOG IN", driver.FindElement(By.CssSelector("button.button.login-button")).Text);

              driver.FindElement(By.ClassName("close-button")).Click();

              driver.Navigate().Back();
              Thread.Sleep(2000);
          }
      }
예제 #3
0
 //LogIn
 public static void LogIn(IWebDriver driver, string username, string password)
 {
     HomePage.SelectLeftMenuItem(driver, LocatorType.XPath, "//div[@id='zone-top']/div/div/div", LocatorType.Id, "login");
     Thread.Sleep(2000);
     ControlAccessMethods.EnterText(driver, LocatorType.Id, "username", username);
     ControlAccessMethods.EnterText(driver, LocatorType.Id, "password", password);
     ControlAccessMethods.Click(driver, LocatorType.CssSelector, "button.button.login-button");
 }
      public void AnnoymousAccess_100_1_7()
      {
          HomePage.SelectLeftMenuItem(driver, LocatorType.XPath, "//div[@id='zone-top']/div/div/div", LocatorType.Id, "svod");

          Thread.Sleep(3000);

          string title = string.Empty;

          for (int i = 0; i < driver.FindElements(By.ClassName("gallery-content")).Count; i = i + 5)
          {
              title = driver.FindElements(By.ClassName("gallery-content"))[i].Text.Split('\r')[0];
              driver.FindElements(By.ClassName("gallery-content"))[i].Click();
              Thread.Sleep(1000);
              Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.ClassName, "login-button"));
              Assert.AreEqual(title, driver.FindElement(By.CssSelector("div.title")).Text);
              driver.Navigate().Back();
              Thread.Sleep(2000);
          }
      }
        public void SetupTest()
        {
            string pathToCurrentUserProfiles = Environment.ExpandEnvironmentVariables("%APPDATA%") + @"\Mozilla\Firefox\Profiles"; // Path to profile

            string[] pathsToProfiles = Directory.GetDirectories(pathToCurrentUserProfiles, "*.default", SearchOption.TopDirectoryOnly);
            if (pathsToProfiles.Length != 0)
            {
                FirefoxProfile profile = new FirefoxProfile(pathsToProfiles[0]);
                profile.SetPreference("browser.tabs.loadInBackground", false); // set preferences you need
                driver = new FirefoxDriver(new FirefoxBinary(), profile, TimeSpan.FromSeconds(3000));
            }
            else
            {
                driver = new FirefoxDriver();
            }

            driver.Url = "http://norigin-test.noriginmedia.com/norigin/";

            Thread.Sleep(3000);
            ControlAccessMethods.LogIn(driver, "nortest1", "nortest1");
            Thread.Sleep(3000);
        }
 public void AnnoymousAccess_100_1_3()
 {
     driver.FindElement(By.XPath("//div[@id='zone-top']/div/div/div")).Click();
     Thread.Sleep(2000);
     Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.Id, "guide"));
     driver.FindElement(By.Id("guide")).Click();
     Thread.Sleep(3000);
     Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.Id, "guide-now"));
     Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.CssSelector, "#horizontal-scroll-view > div.left-button"));
     Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.CssSelector, "#horizontal-scroll-view > div.right-button"));
     driver.FindElement(By.CssSelector("#horizontal-scroll-view > div.left-button")).Click();
     Thread.Sleep(2000);
     driver.FindElement(By.CssSelector("#horizontal-scroll-view > div.left-button")).Click();
     Thread.Sleep(2000);
     driver.FindElement(By.CssSelector("#horizontal-scroll-view > div.left-button")).Click();
     Thread.Sleep(2000);
     driver.FindElement(By.CssSelector("#horizontal-scroll-view > div.right-button")).Click();
     Thread.Sleep(2000);
     driver.FindElement(By.CssSelector("#horizontal-scroll-view > div.right-button")).Click();
     Thread.Sleep(2000);
     driver.FindElement(By.CssSelector("#horizontal-scroll-view > div.right-button")).Click();
     Thread.Sleep(6000);
 }
예제 #7
0
        public void ParentalControl_100_13_5()
        {
            driver.FindElement(By.XPath("//div[@id='zone-top']/div/div/div")).Click();
            Thread.Sleep(3000);
            driver.FindElement(By.Id("settings")).Click();
            Thread.Sleep(3000);
            IWebElement dropdown = driver.FindElement(By.CssSelector("select.switcher"));
            ReadOnlyCollection <IWebElement> options = dropdown.FindElements(By.TagName("Option"));
            string originalrating = dropdown.GetAttribute("value").Split('@')[0];
            int    changedrating  = int.Parse(dropdown.GetAttribute("value").Split('@')[0]) + 1;


            SelectElement setrating = new SelectElement(dropdown);

            setrating.SelectByText(changedrating.ToString());
            driver.FindElement(By.CssSelector("div.form-row > input.textbox")).SendKeys("xxxx");



            driver.FindElement(By.CssSelector("div.button.confirm-button > div.content")).Click();

            Thread.Sleep(2000);
            Assert.AreEqual(true, driver.FindElement(By.CssSelector("div.loading-error-message > div.error-message")).Text.Contains("Invalid pin"));
            driver.FindElement(By.ClassName("close-button"));

            Thread.Sleep(6000);
            ControlAccessMethods.LogOut(driver);
            ControlAccessMethods.LogIn(driver, "nortest1", "nortest1");
            Thread.Sleep(6000);
            driver.FindElement(By.XPath("//div[@id='zone-top']/div/div/div")).Click();
            Thread.Sleep(3000);
            driver.FindElement(By.Id("settings")).Click();
            Thread.Sleep(3000);
            dropdown = driver.FindElement(By.CssSelector("select.switcher"));
            Assert.AreEqual(originalrating, dropdown.GetAttribute("value").Split('@')[0]);
        }
예제 #8
0
        public void ParentalControl_100_13_4()
        {
            driver.FindElement(By.XPath("//div[@id='zone-top']/div/div/div")).Click();

            Thread.Sleep(3000);
            driver.FindElement(By.Id("tvod")).Click();

            Thread.Sleep(3000);
            ReadOnlyCollection <IWebElement> elements = driver.FindElements(By.ClassName("gallery-content"));

            //loop thorugh the items to find a purchasable item

            Thread.Sleep(3000);


            int agerating       = 0;
            int ratedmovieindex = 0;

            for (int i = 0; i < driver.FindElements(By.ClassName("gallery-content")).Count; i++)
            {
                driver.FindElements(By.ClassName("gallery-content"))[i].Click();

                try
                {
                    if (int.Parse(driver.FindElement(By.CssSelector("div.parental-rating > div.value")).Text) < 14)
                    {
                        ratedmovieindex = i;
                        agerating       = int.Parse(driver.FindElement(By.CssSelector("div.parental-rating > div.value")).Text);
                        driver.Navigate().Back();
                        break;
                    }
                }
                catch (Exception e) { }


                driver.Navigate().Back();
            }
            driver.FindElement(By.XPath("//div[@id='zone-top']/div/div/div")).Click();
            Thread.Sleep(3000);
            driver.FindElement(By.Id("settings")).Click();
            Thread.Sleep(3000);


            ControlAccessMethods.SelectDropDown(driver, LocatorType.CssSelector, "select.switcher", agerating.ToString());
            // SelectElement setrating = new SelectElement(dropdown);
            //setrating.SelectByText(changedrating.ToString());
            driver.FindElement(By.CssSelector("div.form-row > input.textbox")).SendKeys("1234");

            Thread.Sleep(2000);
            driver.FindElement(By.CssSelector("div.button.confirm-button > div.content")).Click();

            Thread.Sleep(9000);
            ControlAccessMethods.LogOut(driver);
            ControlAccessMethods.LogIn(driver, "470000005", "12345678");
            Thread.Sleep(6000);
            driver.FindElement(By.XPath("//div[@id='zone-top']/div/div/div")).Click();

            Thread.Sleep(3000);
            driver.FindElement(By.Id("tvod")).Click();

            Thread.Sleep(3000);
            string moviename = driver.FindElements(By.ClassName("gallery-content"))[ratedmovieindex].Text.Split('\r')[0];

            driver.FindElements(By.ClassName("gallery-content"))[ratedmovieindex].Click();



            Thread.Sleep(6000);
            Assert.AreEqual(true, driver.FindElement(By.CssSelector("div.title")).Text.Contains(moviename));
        }
 public void AnnoymousAccess_100_1_2()
 {
     driver.FindElement(By.XPath("//div[@id='zone-top']/div/div/div")).Click();
     Thread.Sleep(2000);
     Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.Id, "login"));
 }
 public void AnnoymousAccess_100_1_5()
 {
     Assert.AreEqual(true, ControlAccessMethods.ExistsElement(driver, LocatorType.Id, "catchup"));
 }
예제 #11
0
 //Enter Text in search textbox
 public static void Search(IWebDriver driver, string searchterm, LocatorType locatortype, string searchtextboxlocator)
 {
     ControlAccessMethods.EnterText(driver, locatortype, searchtextboxlocator, searchterm);
 }
예제 #12
0
 //Select Top Menu Item
 public static void SelectLeftMenuItem(IWebDriver driver, LocatorType menuLocatorType, string menulocator, LocatorType menuitemLocatorType, string menuitemLocator)
 {
     ControlAccessMethods.Click(driver, menuLocatorType, menulocator);
     ControlAccessMethods.Click(driver, menuitemLocatorType, menuitemLocator);
 }