Exemple #1
0
 public static void Initialize()
 {
     Cons.driver = new FirefoxDriver();
     Cons.driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
     Cons.driver.Navigate().GoToUrl(Cons.path);
     page = new LaptopPage();
 }
Exemple #2
0
 void Size(IWebElement checkbox)
 {
     checkbox.Click();
     bool passed = true;
     var newPage = new LaptopPage();
     newPage.getResults();
     var temp = newPage.getKey(checkbox);
     Cons.log(temp);
     var key = newPage.parseSize(temp);
     foreach (var item in newPage.results)
     {
         var value = newPage.parseSize(newPage.getShort(item));
         if ( value[0] < key[0] || value[0] > key[1])
         {
             passed = false;
             Cons.log("Results mismatch");
             Cons.log("Test passed: " + passed.ToString() + "\n");
             throw new Exception();
         }
     }
     Cons.log("Test passed: " + passed.ToString() + "\n");
     newPage.BtnReset.Click();
 }
Exemple #3
0
 void Resolution(IWebElement checkbox, bool exact = true)
 {
     page.ResolutionAll.Click();
     checkbox.Click();
     bool passed = true;
     var newPage = new LaptopPage();
     newPage.getResults();
     var temp = newPage.getKey(checkbox);
     Cons.log(temp);
     int key = newPage.getResolution(temp);
     foreach (var item in newPage.results)
     {
         var value = newPage.getResolution(newPage.getShort(item));
         if (exact ? (value != key) : (value <= key))
             {
                 passed = false;
                 Cons.log("Results mismatch");
                 Cons.log("Test passed: " + passed.ToString() + "\n");
                 throw new Exception();
             }
     }
     Cons.log("Test passed: " + passed.ToString() + "\n");
     newPage.BtnReset.Click();
 }
Exemple #4
0
 void Price(LaptopPage newPage)
 {
     string write;
     bool passed;
     int minprice = newPage.getPrice(newPage.TxtMinPrice, Cons.Types.textInput);
     int maxprice = newPage.getPrice(newPage.TxtMaxPrice, Cons.Types.textInput);
     if (minprice <= maxprice)
     {
         Cons.log("Price behavior OK");
         newPage.getResults();
         foreach (var item in newPage.results)
         {
             int price = newPage.getPrice(item, Cons.Types.result);
             if ((price < minprice) || (price > maxprice))
             {
                 passed = false;
                 Cons.log("Result price out of range");
                 write = "Test passed: " + passed.ToString() + "\n";
                 Cons.log(write); Cons.log("");
                 throw new ArgumentOutOfRangeException();
             }
         }
         passed = true;
         write = "Test passed: " + passed.ToString() + "\n";
         Cons.log(write); Cons.log("");
     }
     else
     {
         passed = false;
         write = "Test passed: " + passed.ToString() + "\n";
         Cons.log(write); Cons.log("");
         throw new ArgumentOutOfRangeException();
     }
 }
Exemple #5
0
 void Manufacturer(IWebElement checkbox)
 {
     Cons.log(DateTime.Now.ToString() + " Performing TestManufacturer");
     checkbox.Click();
     bool passed = true;
     var newPage = new LaptopPage();
     newPage.getResults();
     var key = newPage.getKey(checkbox);
     Cons.log(key);
     foreach (var item in newPage.results)
     {
         var value = newPage.getManufacturer(item);
         if (!value.Contains(key))
         {
             passed = false;
             Cons.log("Results mismatch");
             Cons.log("Test passed: " + passed.ToString() + "\n");
             throw new Exception();
         }
     }
     Cons.log("Test passed: " + passed.ToString() + "\n");
     newPage.BtnReset.Click();
 }
Exemple #6
0
 void CPU(IWebElement checkbox)
 {
     page.CPUAll.Click();
     checkbox.Click();
     bool passed = true;
     var newPage = new LaptopPage();
     newPage.getResults();
     var key = newPage.getKey(checkbox);
     Cons.log(key);
     foreach (var item in newPage.results)
     {
         if (!newPage.CPUCheck(newPage.getShort(item), key))
         {
             passed = false;
             Cons.log("Results mismatch");
             Cons.log("Test passed: " + passed.ToString() + "\n");
             throw new Exception();
         }
     }
     Cons.log("Test passed: " + passed.ToString() + "\n");
     newPage.BtnReset.Click();
 }
Exemple #7
0
 void Color(IWebElement checkbox)
 {
     page.ColorUnfold.Click();
     var key = page.getKey(checkbox);
     checkbox.Click();
     bool passed = true;
     var newPage = new LaptopPage();
     newPage.getResults();
     Cons.log("Color " + key);
     foreach (var item in newPage.results)
         VerifyColor(item, key);
     Cons.log("Test passed: " + passed.ToString() + "\n");
     newPage.BtnReset.Click();
 }
Exemple #8
0
 static void Keyboard(IWebElement checkbox)
 {
     page.KeyboardUnfold.Click();
     var key = page.getKey(checkbox);
     checkbox.Click();
     bool passed = true;
     var newPage = new LaptopPage();
     newPage.getResults();
     Cons.log("Украинская раскладка "+key);
     foreach (var item in newPage.results)
         VerifyKeyboard(item, key);
     Cons.log("Test passed: " + passed.ToString() + "\n");
     newPage.BtnReset.Click();
 }