public void FillReservationFieldsWithInvalidScreeningId(int userId, int InvalidScreeningId) { UserIdField.SendKeys(userId.ToString()); ScreeningIdField.SendKeys(InvalidScreeningId.ToString()); SeatsField.SendKeys("2"); CreateButton.Click(); }
///// <summary> ///// JQuery selector example ///// </summary> //public IWebElement LoginButton => WebDriver.FindElementByJQuery("input[name='btnSubmit']"); public LoginPage BrittleLoginAsAdmin(string baseUrl, string password) { // https://crm422752.crm.dynamics.com/ WebDriver.Navigate().GoToUrl(baseUrl); UserIdField.Clear(); // sending a single quote is not possible with the Chrome Driver, it sends two single quotes! UserIdField.SendKeys("*****@*****.**"); NextButton.Click(); PasswordField.Clear(); PasswordField.SendKeys(password); var wait = new WebDriverWait(WebDriver, TimeSpan.FromSeconds(5)); wait.Until(f => f.FindElements(By.XPath("//div[@class='col-xs-24 no-padding-left-right button-container']/div/input")).FirstOrDefault()); SignInButton = WebDriver.FindElements(By.Id("idSIButton9")).FirstOrDefault(); SignInButton.Click(); var staySignedInDialog = WebDriver.FindElement(By.XPath("//div[@role='heading']")); if (staySignedInDialog?.Text == "Stay signed in?") { wait = new WebDriverWait(WebDriver, TimeSpan.FromSeconds(5)); wait.Until(f => f.FindElements(By.XPath("//div[@class='col-xs-24 no-padding-left-right button-container']/div/input")).FirstOrDefault()); var noButton = WebDriver.FindElements(By.Id("idBtn_Back")).FirstOrDefault(); noButton.Click(); } return(this); }
public void FillReservationFieldsWithInvalidSeatsNumber(int userId, int seats) { //Available screening check int screeningID = screeningRepository.SelectAvailableScreeningId(); UserIdField.SendKeys(userId.ToString()); ScreeningIdField.SendKeys(screeningID.ToString()); SeatsField.SendKeys(seats.ToString()); CreateButton.Click(); }
public void Login(string baseUrl) { _driver.Navigate().GoToUrl(baseUrl); UserIdField.Clear(); // sending a single quote is not possible with the Chrome Driver, it sends two single quotes! UserIdField.SendKeys("admin'--"); PasswordField.Clear(); PasswordField.SendKeys("blah"); LoginButton.Click(); }
//This is a Login method to validate use logins By Nasamani public void LoginAsNobody(string baseUrl) { _driver.Navigate().GoToUrl(baseUrl); SignInLink.Click(); UserIdField.Clear(); UserIdField.SendKeys("nobody"); PasswordField.Clear(); PasswordField.SendKeys("blah"); LoginButton.Click(); }
public void FillReservationFieldsWithInvalidUserId(int InvalidUserId) { //Available screening check int screeningID = screeningRepository.SelectAvailableScreeningId(); //Enough seats number check bool screeningCheck = screeningRepository.EnoughtSeatsNumberCheck(screeningID); if (screeningCheck == false) { screeningRepository.CreateMoreSeatsForThisScreening(screeningID); } UserIdField.SendKeys(InvalidUserId.ToString()); ScreeningIdField.SendKeys(screeningID.ToString()); SeatsField.SendKeys("2"); CreateButton.Click(); }
public void CreateValidReservation(int userId) { //Before creating new reservation: //1. Check if there are already created reservations by this user reservationRepository.ReservationFromThisUserCheck(userId); //2. Find available screening id int screeningID = screeningRepository.SelectAvailableScreeningId(); //3. Check if there are enough number of seats for this screening bool screeningCheck = screeningRepository.EnoughtSeatsNumberCheck(screeningID); if (screeningCheck == false) { screeningRepository.CreateMoreSeatsForThisScreening(screeningID); } //Create new reservation UserIdField.SendKeys(userId.ToString()); ScreeningIdField.SendKeys(screeningID.ToString()); SeatsField.SendKeys("2"); CreateButton.Click(); }