Ejemplo n.º 1
0
        public void Transferee_Intakepage_ShouldCheckandUpdateDestinationLocation()
        {
            help.initialsteps();
            orders = help.getOrders();
            for (int i = 0; i < orders.Count(); i++)
            {
                if (i == 3)
                {
                    break;
                }
                var order_id = orders.ElementAt(help.GetRandomNo(orders)).GetAttribute("data-order-id");
                //var order_id = orders.ElementAt(i).GetAttribute("data-order-id");
                var db_order = _unitOfWork.Orders.GetOrderById(order_id);;
                _driver.Navigate().GoToUrl(this.baseURL + "/Orders/Transferee/" + order_id);
                help.delay(800);
                //Check for Destiantion and Departure Info

                /**
                 * //var city = _driver.FindElement(By.CssSelector("span#spanDestinationCity.intake-span")).Text;
                 * //var state = _driver.FindElement(By.Id("spanDestinationState")).Text;
                 * //var country = _driver.FindElement(By.Id("spanDestinationCountry")).Text;
                 * // Xunit.Assert.Equal(db_order.DestinationCity, _driver.FindElement(By.CssSelector("span#spanDestinationCity.intake-span")).Text);
                 * // Xunit.Assert.Equal(db_order.DestinationState, _driver.FindElement(By.CssSelector("span#spanDestinationState.intake-span")).Text);
                 * // Xunit.Assert.Equal(db_order.DestinationCountry, _driver.FindElement(By.CssSelector("span#spanDestinationCountry.intake-span")).Text);
                 **/
                var click_expand   = help.GetElementClick(_driver, By.XPath("(//img[@class = 'intake-expand-img'])[6]"), 10);
                var click_collapse = help.GetElementClick(_driver, By.XPath("(//img[@class = 'intake-collapse-img'])[6]"), 10);
                ((IJavaScriptExecutor)_driver).ExecuteScript("scroll(0,400)");
                click_expand.Click();
                click_collapse.Click();
                //delay(100);
                click_expand.Click();

                var DC = db_order.DestinationCity; var sDC = help.GetElement(_driver, By.Id("spanDestinationCity"), 10);
                var DS = db_order.DestinationState; var sDS = _driver.FindElement(By.Id("spanDestinationState")).Text;
                var DCoun = db_order.DestinationCountry; var sDcoun = _driver.FindElement(By.Id("spanDestinationCountry")).Text;

                //** Destination Location **//
                Xunit.Assert.Equal(db_order.DestinationCity, help.GetElement(_driver, By.Id("spanDestinationCity"), 10));
                Xunit.Assert.Equal(db_order.DestinationState, _driver.FindElement(By.Id("spanDestinationState")).Text);
                Xunit.Assert.Equal(db_order.DestinationCountry, _driver.FindElement(By.Id("spanDestinationCountry")).Text);

                _driver.FindElement(By.XPath("(//span[@class = 'sectionSave intake-edit'])[3]")).Click();
                _driver.FindElement(By.XPath("(//span[@class = 'sectionSave intake-cancel'])[3]")).Click();
                _driver.FindElement(By.XPath("(//span[@class = 'sectionSave intake-edit'])[3]")).Click();
                var des_city = _driver.FindElement(By.Id("DestinationCity"));
                des_city.Clear();
                des_city.SendKeys("Test City");
                var des_state = _driver.FindElement(By.Id("DestinationState"));
                des_state.Clear();
                des_state.SendKeys("Test State");
                var des_country = _driver.FindElement(By.Id("DestinationCountry"));
                des_country.Clear();
                des_country.SendKeys("Test Country");

                _driver.FindElement(By.XPath("(//span[@class = 'sectionSave intake-edit'])[3]")).Click();

                /****** Check the saved values once the code is Uptodate ******/

                //check for the update with the database

                /****** End ******/

                _driver.Navigate().GoToUrl(this.baseURL + "/Orders");
                //_driver.FindElement(By.Id("backButton")).Click();
                orders = _driver.FindElements(By.Id("rowclickableorderRow"));
            }


            // Xunit.Assert.Equal(orders.Count(), order_db.Count());

            help.Logout();
        }