示例#1
0
        static void Main(string[] args)
        {
            IAppDriver driver = new AppChromeDriver();
            //driver.AppUrl= "http://shop.demoqa.com";

            // ShopDemoMainPage sdp = new ShopDemoMainPage(driver);
            //// sdp.Navigate();
            //// sdp.categoryEnum = ShopDemoMainPage.Menu.WOMAN;
            // ItemsPage itemsPage = new ItemsPage(driver);
            MyAccountPage map = new MyAccountPage(driver);

            driver.AppUrl = ("http://shop.demoqa.com/my-account/");
            map.Navigate();
            map.EnterUserNameOrEmailAddressToLogIn("*****@*****.**");
            map.EnterPasswordToLogIn("GreatToStay@5624");
            map.ClickLogIn();
            map.IsSuccessfullyLoggedIn();



            //int itemCount = sdp.GlobalMenu.GetCartCount();
            //sdp.GlobalMenu.ClickMainMenu("WOMAN");
            ////itemsPage.FilterByColor("Black");
            //itemsPage.cartOptions = ItemsPage.AfterAddAction.ContinueShopping;
            //Thread.Sleep(10000);
            //itemsPage.FilterByColor("Brown");

            //List<string> nameList=itemsPage.GetAllItemNames();
            //nameList.Add("ALEXA FAUX LEATHER SADDLE BAG");
            // nameList.Add("COACHELLA EMBROIDERED MAXI DRESS");
            // Random rnd = new Random();
            // int i = rnd.Next(nameList.Count);

            //itemsPage.AddItemsToCart("CLEAN PU CARINA CLUTCH", itemsPage.cartOptions);
            //itemsPage.AddItemsToCart("ALEXA FAUX LEATHER SADDLE BAG", itemsPage.cartOptions);
            //itemsPage.AddItemsToCart("FLORAL CAGE MIDI DRESS", itemsPage.cartOptions);
            //itemsPage.AddItemsToCart("COTSWOLDS COATING OVERSIZED COAT", itemsPage.cartOptions);
            //itemsPage.AddItemsToCart("HETTIE JEWELS MAXI DRESS", itemsPage.cartOptions);
            //i = rnd.Next(nameList.Count);

            //itemsPage.cartOptions = ItemsPage.AfterAddAction.ViewCart;
            //itemsPage.AddItemsToCart((string)nameList[i], itemsPage.cartOptions);
            //int itemCountAfterAdd = sdp.GlobalMenu.GetCartCount();

            driver.Quit();
            // ReadExcelFile("LogInData", "D:\\sarsu\\ShoppingData.xlsx");
        }
示例#2
0
        public void PerformLogIn(LoginData data)
        {
            //driver.Manage().Timeouts().ImplicitWait.Add(TimeSpan.FromSeconds(10));
            mcp.EnterUserNameOrEmailAddressToLogIn(data.UserNameOrEmailAddress);

            mcp.EnterPasswordToLogIn(data.Password);
            mcp.ClickLogIn();
            if (data.ExpectedResult == "Pass")
            {
                Assert.IsTrue(mcp.IsSuccessfullyLoggedIn(), "LogIn is not successful");
            }
            else if (data.ExpectedResult == "Fail")
            {
                Assert.IsTrue(mcp.SummaryHasErrorMessage(data.ExpectedError), "Validation verification is not successful");
            }
            else
            {
                throw new Exception("Unknown expected result, fix data file");
            }
        }
        public void Perform_LogIn()
        {
            Thread.Sleep(5000);
            LoginData ld = new LoginData(TestContext.DataRow);

            map.EnterUserNameOrEmailAddressToLogIn(ld.UserNameOrEmailAddress);
            map.EnterPasswordToLogIn(ld.Password);
            map.ClickLogIn();
            Thread.Sleep(5000);
            if (ld.ExpectedResult == "Pass")
            {
                Assert.IsTrue(map.IsSuccessfullyLoggedIn(), "LogIn is not successful");
            }
            else if (ld.ExpectedResult == "Fail")
            {
                Assert.IsTrue(map.SummaryHasErrorMessage(ld.ExpectedError), "Validation verification is not successful");
            }
            else
            {
                throw new Exception("Unknown expected result, fix data file");
            }
        }