Example #1
0
        ///// <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);
        }
Example #2
0
 public void FillReservationFieldsWithInvalidScreeningId(int userId, int InvalidScreeningId)
 {
     UserIdField.SendKeys(userId.ToString());
     ScreeningIdField.SendKeys(InvalidScreeningId.ToString());
     SeatsField.SendKeys("2");
     CreateButton.Click();
 }
Example #3
0
        private void EnterButton_Click(object sender, EventArgs e)
        {
            if (UserIdField.Text == "")
            {
                MessageBox.Show("ユーザー名を入力してください");
                UserIdField.Focus();
                return;
            }
            else if (PasswordField.Text == "")
            {
                MessageBox.Show("パスワードを入力してください");
                PasswordField.Focus();
                return;
            }

            AuthEventArgs e2 = new AuthEventArgs();

            e2.UserId   = UserIdField.Text;
            e2.Password = PasswordField.Text;
            Auth(e2);
            if (!e2.Success)
            {
                MessageBox.Show("ユーザー名またはパスワードに誤りがあります");
                UserIdField.Focus();
                return;
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Example #4
0
        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();
        }
Example #5
0
        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();
        }
Example #6
0
        //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();
        }
Example #7
0
        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();
        }
Example #8
0
        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();
        }