Пример #1
0
        public void ThenIShouldLandToHomePage()
        {
            var retry = true;

            while (retry)
            {
                Driver.GetDriver().FindElement(By.CssSelector("body")).SendKeys(Keys.Control + "t");
                Driver.GetDriver().SwitchTo().Window(Driver.GetDriver().WindowHandles.Last());
                Driver.GetDriver().Url = GetJsonConfigurationValue("DefaultUrl");
                //Driver.GetDriver().Navigate().GoToUrl("Default");

                var userName = GetJsonConfigurationValue("UserName");
                var password = GetJsonConfigurationValue("Password");
                Pages.LoginPage().UsernameInput.SendKeys(userName);
                Pages.LoginPage().NextButton.Click();
                Pages.LoginPage().PasswordInput.SendKeys(password);
                Pages.LoginPage().SigninButton.Click();

                //Wait for title to update
                Wait.Until(x => x.Title != Pages.LoginPage().Title);

                if (Driver.GetDriver().Title == "Toyota Enterprise Security Service - System Error")
                {
                    retry = true;
                }
                else
                {
                    retry = false;
                }
            }
            Assert.AreEqual("Dealer Daily", Driver.GetDriver().Title, "page title is different than " + "Dealer Daily");
            Wait.Until(x => (x.Title != Pages.BasePage().Title));
        }
Пример #2
0
        public void ThenIShouldLandToHomePage()
        {
            var retry    = true;
            var userName = "";

            userName = GetJsonConfigurationValue("UserName");
            var password = "";

            password = GetJsonConfigurationValue("Password");

            while (retry)
            {
                //Wait for title to update

                Wait.Until(x => (x.Title != Pages.LoginPage().Title));

                if (Driver.GetDriver().Title == "Toyota Enterprise Security Service - System Error")
                {
                    Console.WriteLine("----------System Error occured----------");
                    Driver.GetDriver().FindElement(By.CssSelector("body")).SendKeys(Keys.Control + "t");
                    Driver.GetDriver().SwitchTo().Window(Driver.GetDriver().WindowHandles.Last());
                    //Driver.GetDriver().Close();
                    Driver.GetDriver().Url = GetJsonConfigurationValue("DefaultUrl");

                    Driver.GetDriver().Manage().Timeouts().PageLoad     = TimeSpan.FromSeconds(100);
                    Driver.GetDriver().Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60);

                    //Driver.GetDriver().Navigate().GoToUrl("Default");
                    Wait.Until(x => (x.Title != Pages.LoginPage().Title));

                    if (Driver.GetDriver().Title == "Gulf States Toyota DEV - Sign In")
                    {
                        Pages.LoginPage().LogInToDD365(userName, password);
                    }

                    if (Driver.GetDriver().Title == "Toyota Enterprise Security Service - System Error")
                    {
                        retry = true;
                    }
                }
                else
                {
                    retry = false;
                }
            }
            Console.WriteLine("Current Page Title ====" + Driver.GetDriver().Title);
            Assert.AreEqual("Dealer Daily", Driver.GetDriver().Title, "page title is different than " + "Dealer Daily");
            Wait.Until(x => (x.Title != Pages.BasePage().Title));
        }