Exemple #1
0
        public void Task7()
        {
            driver = new ChromeDriver();
            TaskFunctions.login(driver);

            int size = driver.FindElements(By.XPath("//ul[@id='box-apps-menu']/li/a")).Count;

            for (int i = 0; i < size; i++)
            {
                IList <IWebElement> menu2 = driver.FindElements(By.XPath("//ul[@id='box-apps-menu']/li/a"));
                menu2[i].Click();

                if ((driver.FindElements(By.XPath("//ul[@class='docs']/li/a")).Count) > 0)
                {
                    for (int k = 0; k < (driver.FindElements(By.XPath("//ul[@class='docs']/li/a")).Count); k++)
                    {
                        IList <IWebElement> a = driver.FindElements(By.XPath("//ul[@class='docs']/li/a"));
                        if (k <= (a.Count - 1))
                        {
                            a[k].Click();
                            Assert.IsTrue(driver.FindElements(By.TagName("h1")).Count > 0, driver.Title + " doesnt have h1");
                        }
                    }
                }
            }
            driver.Close();
        }
Exemple #2
0
        public void Task6()
        {
            //Firefox nightly
            FirefoxOptions options = new FirefoxOptions();

            options.AcceptInsecureCertificates = true;
            options.BrowserExecutableLocation  = @"C:\Program Files\Nightly\firefox.exe"; // geckdriver 0.20, Nightly 56
            f_driver = new FirefoxDriver(options);
            f_driver.Navigate().GoToUrl("https://localhost/litecart/admin");
            TaskFunctions.login(f_driver);
            f_driver.Quit();
        }
Exemple #3
0
        public void Task4()
        {
            // Chrome
            driver = new ChromeDriver();
            TaskFunctions.login(driver);
            driver.Close();

            // Old Firefox
            FirefoxOptions old_options = new FirefoxOptions();

            old_options.BrowserExecutableLocation = @"C:\Program Files\Mozilla Firefox\firefox.exe"; // geckdriver 0.20, FireFox 45.5
            old_options.UseLegacyImplementation   = true;
            f_driver = new FirefoxDriver(old_options);
            f_driver.Navigate().GoToUrl("https://localhost/litecart/admin");
            TaskFunctions.login(f_driver);
            f_driver.Quit();

            // IE
            ie_driver = new InternetExplorerDriver();
            TaskFunctions.login(ie_driver);
            ie_driver.Quit();
        }
Exemple #4
0
 public void Task3()
 {
     driver = new ChromeDriver();
     TaskFunctions.login(driver);
     driver.Close();
 }
Exemple #5
0
        public void Task9()
        {
            driver = new ChromeDriver();
            TaskFunctions.login(driver);

            // Step 1-1a
            driver.Navigate().GoToUrl("http://localhost/litecart/admin/?app=countries&doc=countries");
            IList <IWebElement> rows           = driver.FindElements(By.XPath("//table[@class='dataTable']//tr[@class='row']"));
            List <string>       x              = new List <string>();
            List <string>       multi_tz_links = new List <string>();

            foreach (IWebElement el in rows)
            {
                IWebElement td = el.FindElement(By.XPath("./td[5]//a"));
                x.Add(td.Text);
                string s = el.FindElement(By.XPath("./td[6]")).Text;
                if (s != "0")
                {
                    multi_tz_links.Add(td.GetAttribute("href"));
                }
            }
            List <string> y = new List <string>(x);

            x.Sort();
            Assert.IsFalse(!(y.SequenceEqual(x)), "Wrong order!");

            // Step 1b
            foreach (string href in multi_tz_links)
            {
                driver.Navigate().GoToUrl(href);
                List <string>       u       = new List <string>();
                IList <IWebElement> in_rows = driver.FindElements(By.XPath("//table[@class='dataTable']//tr//td[3]//input"));
                foreach (IWebElement ch in in_rows)
                {
                    u.Add(ch.Text);
                }

                List <string> z = new List <string>(u);
                u.Sort();
                Assert.IsFalse(!(z.SequenceEqual(u)), "Wrong order!");
            }

            // Step 2
            driver.Navigate().GoToUrl("http://localhost/litecart/admin/?app=geo_zones&doc=geo_zones");
            IList <IWebElement> countries = driver.FindElements(By.XPath("//table[@class='dataTable']//tr//td[3]/a"));
            List <string>       link      = new List <string>();

            foreach (IWebElement con in countries)
            {
                link.Add(con.GetAttribute("href"));
            }

            foreach (string href in link)
            {
                driver.Navigate().GoToUrl(href);
                List <string>       u       = new List <string>();
                IList <IWebElement> in_rows = driver.FindElements(By.XPath("//table[@id='table-zones']//tr//td[3]//select//option[@selected='selected']"));
                foreach (IWebElement ch in in_rows)
                {
                    u.Add(ch.Text);
                    System.Console.WriteLine(ch.Text);
                }

                List <string> z = new List <string>(u);
                u.Sort();
                Assert.IsFalse(!(z.SequenceEqual(u)), "Wrong order!");
            }
            driver.Close();
        }