public void TestDateIsSmallerThenToday() //try to vuy ticket on yesterday train { DateTime date1 = DateTime.Now; date1 = date1.AddDays(-5); string someday = date1.ToShortDateString(); bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Гомель"); pageRoutes.DepartureDateField.Clear(); pageRoutes.DepartureDateField.SendKeys(someday); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
public void TestRouteHaveNotTime() { DateTime date1 = DateTime.Now; string today = date1.ToShortDateString(); bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Жлобин"); pageRoutes.DepartureDateField.Clear(); pageRoutes.DepartureDateField.SendKeys(today); pageRoutes.TimeBoxesResetTimeButton.Click(); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
public void SetupClass() { pLogin = new PageLogin(driver); pHome = new PageHome(driver); pGoogleAuthentication = new PageGoogleAuthentication(driver); sNavbar = new SharedNavbar(driver); }
public void TestDateIsMoreThen45DaysFromToday() { DateTime date1 = DateTime.Now; date1 = date1.AddDays(61); // railway station son't seal tickets on date more then 60 days from today string someday = date1.ToShortDateString(); bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Гомель"); pageRoutes.DepartureDateField.Clear(); pageRoutes.DepartureDateField.SendKeys(someday); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
public void Test2() { ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.BinaryLocation = "/Applications/Google Chrome 2.app/Contents/MacOS/Google Chrome"; IWebDriver driver = new ChromeDriver("/Users/Iro4ka/Projects/T1/T1/", chromeOptions); PageHome pageHome = new PageHome(driver); BBC_Homepage bBC_Homepage = new BBC_Homepage(driver); PageFactory.InitElements(driver, pageHome); string[] lipsums = pageHome.generateLipsums(); driver.Navigate().GoToUrl("https://www.bbc.com/"); bBC_Homepage.goToNews.Click(); bBC_Homepage.goToMore.Click(); bBC_Homepage.goToHaveYourSay.Click(); bBC_Homepage.goToDoYouHaveAQuestion.Click(); bBC_Homepage.fillQuestionTextarea.Click(); bBC_Homepage.fillQuestionTextarea.SendKeys(lipsums[0]); bBC_Homepage.fillNameInput.Click(); bBC_Homepage.fillEmailInput.Click(); bBC_Homepage.fillEmailInput.SendKeys("*****@*****.**"); bBC_Homepage.fillAgeInput.Click(); bBC_Homepage.fillAgeInput.SendKeys("20"); bBC_Homepage.fillPostcodeInput.Click(); bBC_Homepage.fillPostcodeInput.SendKeys("02000"); }
public static PageHome getPageHome() { if (pageHome == null) { pageHome = new PageHome(); } return(pageHome); }
private void ButtonOrderNow_Click(object sender, RoutedEventArgs e) { FragmentMarket fragmentMarket = new FragmentMarket(); PageHome.SetButtonActive(PageHome.GlobalButtonMarket); NavigationService.Navigate(fragmentMarket); }
private void ButtonCreateNow_Click(object sender, RoutedEventArgs e) { FragmentCreateRecipe fragmentCreateRecipe = new FragmentCreateRecipe(); PageHome.SetButtonActive(PageHome.GlobalButtonCreate); NavigationService.Navigate(fragmentCreateRecipe); }
public void TestRoutePageOpen() { bool result = false; bool expected = true; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); result = pageRoutes.ContinueButton.Displayed; Assert.AreEqual(expected, result); }
public void TestLoginPageOpen() { bool result = false; bool expected = true; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.LoginPageButton.Click(); PageLogin pageLogin = new PageLogin(); PageFactory.InitElements(driver, pageLogin); result = pageLogin.EnterSystemButton.Displayed; Assert.AreEqual(expected, result); }
public void TestLoginPositive() { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.LoginPageButton.Click(); PageLogin pageLogin = new PageLogin(); PageFactory.InitElements(driver, pageLogin); pageLogin.LoginField.SendKeys("FakeDev10"); pageLogin.PasswordField.SendKeys("4GmMTJm27WrjYJ2"); pageLogin.EnterSystemButton.Click(); PageFactory.InitElements(driver, pageHome); pageHome.LogoutButton.Click(); }
public void TestRouteDateSetClickable() { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.TimeBoxesResetTimeButton.Click(); pageRoutes.TimeBox(1).Click(); pageRoutes.TimeBox(7).Click(); }
public void TestLoginEmptyUsername() { bool result = false; bool expected = true; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.LoginPageButton.Click(); PageLogin pageLogin = new PageLogin(); PageFactory.InitElements(driver, pageLogin); pageLogin.PasswordField.SendKeys("4GmMTJm27WrjYJ"); pageLogin.EnterSystemButton.Click(); result = pageLogin.EnterSystemButton.Displayed; Assert.AreEqual(expected, result); }
public void TestMethod1() { chrome = new ChromeDriver(); chrome.Navigate().GoToUrl("https://mail.ru/"); chrome.Manage().Window.Maximize(); PageHome pageHome = new PageHome(); PageFactory.InitElements(chrome, pageHome); pageHome.Login.SendKeys(user); pageHome.ButtunSubmit.Click(); pageHome.Password.SendKeys(password); pageHome.ButtunSubmit.Click(); SendMail sendMail = new SendMail(); PageFactory.InitElements(chrome, sendMail); // Ждем появления элемента, создать письмо WebDriverWait wait = new WebDriverWait(chrome, TimeSpan.FromSeconds(10)); wait.Until(ExpectedConditions.ElementExists(By.ClassName("compose-button"))); sendMail.WriteMail.Click(); // Находим и нажимаем. // Ждем появления элемента Адрес получателя WebDriverWait wait1 = new WebDriverWait(chrome, TimeSpan.FromSeconds(10)); wait1.Until(ExpectedConditions.ElementExists(By.XPath("//div/div/input"))); sendMail.Input.SendKeys("Неизвестный получатель"); // Находим в водим в поле значение. // Ждем появлени элемента Тема письма WebDriverWait wait2 = new WebDriverWait(chrome, TimeSpan.FromSeconds(10)); wait2.Until(ExpectedConditions.ElementExists(By.Name("Subject"))); sendMail.Subject.SendKeys("Тема Письма"); // Находим в водим в поле значение. // Ждем появления элемента Тело письма WebDriverWait wait3 = new WebDriverWait(chrome, TimeSpan.FromSeconds(10)); wait3.Until(ExpectedConditions.ElementExists(By.XPath("//div[3]/div[5]/div/div/div[2]/div"))); sendMail.Body.SendKeys("Много текста"); //Отправляем письмо sendMail.Send.Click(); }
public void TestRouteAllFieldisEmpty() { bool expected = false; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Selected; Assert.AreEqual(result, expected); }
public void Test_005_CmBoxVSPopularGods() { try { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); Assert.That(pageHome.Compare(), Is.True); Console.WriteLine("Позиция продукции находится в секции Популярные товары."); } catch (AssertionException aex) { Console.WriteLine("Позиция продукции не находится в секции Популярные товары."); Console.WriteLine(aex.Message); sw.WriteLine($"{DateTime.Now.ToString()} - Цена в секции Популярные товары не соответствует валюте установленной в шапке сайта."); sw.WriteLine($"{DateTime.Now.ToString()} - aex.Message"); } }
public void Test_003_HasCurrencyHead() { try { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); goToPrestashop(); Assert.That(pageHome.HasCurrencyHead(), Is.True); Console.WriteLine("Найдено значение валюты в шапке сайта."); } catch (AssertionException aex) { System.Console.WriteLine("Значение валюты в шапке сайта отсутсвует."); System.Console.WriteLine(aex.Message); sw.WriteLine($"{DateTime.Now.ToString()} - Цена в секции Популярные товары не соответствует валюте установленной в шапке сайта."); sw.WriteLine($"{DateTime.Now.ToString()} - aex.Message"); } }
public void Test_004_HasCurrencyItem() { try { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); goToPrestashop(); Assert.That(pageHome.HasCurrencyItem(), Is.True); Console.WriteLine("Найдено значение валюты в позиции продукции."); } catch (AssertionException aex) { Console.WriteLine("Позиция продукции не содержить цены."); Console.WriteLine(aex.Message); sw.WriteLine($"{DateTime.Now.ToString()} - Цена в секции Популярные товары не соответствует валюте установленной в шапке сайта."); sw.WriteLine($"{DateTime.Now.ToString()} - aex.Message"); } }
public void Test_002_HasPopularGods() { try { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); goToPrestashop(); Assert.That(pageHome.TxtPopularGoods.Text.ToLower(), Is.EqualTo("популярные товары")); Console.WriteLine("Найдена секция Популярные товары."); } catch (AssertionException aex) { System.Console.WriteLine("Секция Популярные товары на сайте отсутствует."); Console.WriteLine(aex.Message); sw.WriteLine($"{DateTime.Now.ToString()} - Цена в секции Популярные товары не соответствует валюте установленной в шапке сайта."); sw.WriteLine($"{DateTime.Now.ToString()} - aex.Message"); } }
public void Test_006_CmBoxIntersectPrice() { try { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); goToPrestashop(); Assert.That(pageHome.EndCmBox(), Does.EndWith(pageHome.EndPrice())); Console.WriteLine("Цена в секции Популярные товары соответствует валюте установленной в шапке сайта."); sw.WriteLine($"{DateTime.Now.ToString()} - Выполнена тест: Цена в секции Популярные товары соответствует валюте установленной в шапке сайта."); } catch (AssertionException aex) { Console.WriteLine("Цена в секции Популярные товары не соответствует валюте установленной в шапке сайта."); Console.WriteLine(aex.Message); sw.WriteLine($"{DateTime.Now.ToString()} - Цена в секции Популярные товары не соответствует валюте установленной в шапке сайта."); sw.WriteLine($"{DateTime.Now.ToString()} - aex.Message"); } }
public void TesteWidgetTodayPositive() { DateTime date1 = DateTime.Now; string expected = date1.ToShortDateString(); //todays date PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DatePickerTrigger.Click(); pageRoutes.TodayDateDepature.Click(); string result = pageRoutes.DepartureDateField.GetAttribute("value"); Assert.AreEqual(result, expected); }
public void TestRouteCheckHintRegionalCentres() //hyperlink, which rw can help us { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); IWebElement depLink = pageRoutes.DepatureLinks(1); IWebElement arrLink = pageRoutes.ArrivalLinks(2); depLink.Click(); arrLink.Click(); Assert.AreEqual(depLink.Text, pageRoutes.DepartureStationField.GetAttribute("value")); Assert.AreEqual(arrLink.Text, pageRoutes.ArrivalStationField.GetAttribute("value")); }
public void Test_007_CmBoxSelect() { try { PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); goToPrestashop(); PageResultSearch pageResultSearch = pageHome.SelectValDropDown(driver); sw.WriteLine($"{DateTime.Now.ToString()} - Значение валюты установлено в USD $"); Assert.That(pageHome.Selected, Is.EqualTo("USD $")); Console.WriteLine("Валюта USD в шапке сайта установлена."); sw.WriteLine($"{DateTime.Now.ToString()} - Выполнена тест: Валюта USD в шапке сайта установлена."); } catch (AssertionException aex) { Console.WriteLine("Валюта USD в шапке сайта не установлена."); Console.WriteLine(aex.Message); sw.WriteLine($"{DateTime.Now.ToString()} - Валюта USD $ в шапке сайта не установлена."); sw.WriteLine($"{DateTime.Now.ToString()} - aex.Message"); } }
public void TestRouteResetStation() { string expected = ""; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Жлобин"); pageRoutes.ResetButton.Click(); string resultArr = pageRoutes.ArrivalStationField.GetAttribute("value"); string resultDep = pageRoutes.DepartureStationField.GetAttribute("value"); Assert.AreEqual(expected, resultArr); Assert.AreEqual(expected, resultArr); }
public void Test_001_OpenSite() { try { // Второй вариант - запуск начальной страницы Google //driver.Navigate().GoToUrl("https://www.google.ru"); // PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); //pageHome.TxtSearchForm.Click(); // кликаем в поле ввода поисковой фразы //pageHome.TxtSearchForm.SendKeys($"http://prestashop-automation.qatestlab.com.ua/ru/"); // вводим поисковую фразу //pageHome.BtnSearchSubmit.Click(); //pageHome.LinkToSite.Click(); //var tabs = driver.WindowHandles; //if (tabs.Count > 1) //{ // driver.SwitchTo().Window(tabs[0]); // driver.Close(); // driver.SwitchTo().Window(tabs[1]); //} goToPrestashop(); if (driver.Title == "prestashop-automation") { Console.WriteLine("Сайт http://prestashop-automation.qatestlab.com.ua/ru/ успешно открыт."); } Assert.AreEqual("prestashop-automation", driver.Title); sw.WriteLine($"{DateTime.Now.ToString()} - Выполнена тест: Сайт http://prestashop-automation.qatestlab.com.ua/ru/ успешно открыт."); } catch (AssertionException aex) { Console.WriteLine("Не удалось открыть сайт."); Console.WriteLine(aex.Message); sw.WriteLine($"{DateTime.Now.ToString()} - Не удалось открыть сайт."); sw.WriteLine($"{DateTime.Now.ToString()} - aex.Message"); } }
public void TestRoutesAutoCompleteMenu() //start typing service testing { string beginning = "М"; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys(beginning); pageRoutes.DepartureStationField.Click(); Thread.Sleep(1000); IWebElement autoDep = pageRoutes.DepartAuto(5); string expected = autoDep.Text; int usefulind = expected.IndexOf(','); expected = expected.Substring(0, usefulind); autoDep.Click(); Assert.AreEqual(expected, pageRoutes.DepartureStationField.GetAttribute("value")); }
public void TestRouteChangeStations() { string depKey = "ОТПРАВЛЕНИЕ"; string arrKey = "ПРИБЫТИЕ"; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys(depKey); pageRoutes.ArrivalStationField.SendKeys(arrKey); pageRoutes.ChangeStationsTrigger.Click(); string resultArr = pageRoutes.ArrivalStationField.GetAttribute("value"); Assert.AreEqual(depKey, resultArr); string resultDep = pageRoutes.DepartureStationField.GetAttribute("value"); Assert.AreEqual(arrKey, resultDep); }
public void TestRoutesPositive() { DateTime date1 = DateTime.Now; string today = date1.ToShortDateString(); //todays date bool expected = true; PageHome pageHome = new PageHome(); PageFactory.InitElements(driver, pageHome); pageHome.RoutesPageButton.Click(); PageRoutes pageRoutes = new PageRoutes(); PageFactory.InitElements(driver, pageRoutes); pageRoutes.DepartureStationField.Clear(); pageRoutes.DepartureDateField.Clear(); pageRoutes.ArrivalStationField.Clear(); pageRoutes.DepartureStationField.SendKeys("Минск"); pageRoutes.ArrivalStationField.SendKeys("Борисов"); pageRoutes.DepartureDateField.Clear(); pageRoutes.DepartureDateField.SendKeys(today); pageRoutes.ContinueButton.Click(); bool result = pageRoutes.TrainTab.Displayed; Assert.AreEqual(result, expected); }
private void ButtonCreate_Click(object sender, RoutedEventArgs e) { string name = TextBoxName.Text; string type = ComboBoxType.Text; string priceString = TextBoxPrice.Text; int price; string description = TextBoxDescription.Text; string[] fields = new string[] { name, type, priceString, description }; string message = ""; if (fields.Contains("")) { message += "- All fields are required." + Environment.NewLine; } if (!Int32.TryParse(priceString, out price)) { message += "- Price must be a number." + Environment.NewLine; } if (price < 10 || price > 40) { message += "- Price must be between 10 and 40 cooks." + Environment.NewLine; } if (ProductsRequiredInRecipe.Count() == 0) { message += "- You must select at least one product." + Environment.NewLine; } if (message != "") { MessageBox.Show(message); return; } Recipe recipe = new Recipe(); recipe.Name = name; recipe.Type = type; recipe.Price = price; recipe.Description = description; recipe.Remuneration = 2; recipe.RecipeCreator = new RecipeCreator(); if (AuthUser.RecipeCreator != null) { recipe.RecipeCreator = AuthUser.RecipeCreator; } else { ServiceRecipeCreator = new ServiceRecipeCreator(); recipe.RecipeCreator = ServiceRecipeCreator.Save(AuthUser.Client); } recipe.Products = ProductsRequiredInRecipe.ToList(); ServiceRecipe = new ServiceRecipe(); if (ServiceRecipe.Save(recipe)) { if (AuthUser.Role != "Admin") { AuthUser.Role = "RecipeCreator"; } AuthUser.RecipeCreator = recipe.RecipeCreator; MessageBox.Show("Your recipe has been created successfully!"); FragmentCreateRecipe fragmentCreateRecipe = new FragmentCreateRecipe(); PageHome.SetButtonActive(PageHome.GlobalButtonCreate, true); NavigationService.Navigate(fragmentCreateRecipe); } else { ServiceRecipeCreator.Remove(recipe.RecipeCreator); MessageBox.Show("Something went wrong, your recipe has not been created!"); } }