Exemple #1
0
        public void ShopingTest()
        {
            Excel.Worksheet Sheet   = this.CSV.OpenCSV(@"C:\Users\Milijana\Desktop\ddt5.csv");
            int             rows    = Sheet.UsedRange.Rows.Count;
            int             columns = Sheet.UsedRange.Columns.Count;
            string          name;
            string          username;
            string          password;

            for (int i = 2; i <= rows; i++)
            {
                name     = Sheet.Cells[i, 1].Value;
                username = Sheet.Cells[i, 2].Value;
                password = Sheet.Cells[i, 3].Value;
                ShopHomePage home = new ShopHomePage(driver);
                home.GoToPage();
                ShopLoginPage SLP;
                SLP  = home.ClickOnLoginLink();
                home = SLP.Login(username, password);
                string Actualy = "Prosao";
                if (home.Welcome != null)
                {
                    home.ClickLogout();
                }
                else
                {
                    Actualy = "Nije prosao";
                }
                TestContext.WriteLine("Ime testa: {0}, Ussername je: {1},Password je: {2},Stanje  {3}", name, username, password, Actualy);
                FileManagment.Scrivere("Ime: " + name + "Username: "******"Password:"******"Stanje" + Actualy);
            }
            this.CSV.Close();
        }
        public void ShopingTest()
        {
            string       username = "******";
            string       password = "******";
            UInt64       X        = 0;
            UInt64       Y        = 0;
            ShopHomePage home     = new ShopHomePage(driver);

            home.GoToPage();
            ShopLoginPage SLP;

            SLP  = home.ClickOnLoginLink();
            home = SLP.Login(username, password);
            if (home.Welcome != null)
            {
                Porudzbina P;
                home.UnesiKolicinu("3");
                P    = home.ClickOrder();
                home = P.ClickContinueShopping();
                home.UnesiKolicinuEnterprice("3");
                P    = home.ClickOrderEnterprise();
                home = P.ClickContinueShopping();
                CartPage C;
                C = home.ClickOnViewCart();
                X = C.TotalColumn;
                ConfirmationPage CP;
                CP   = C.ClickCheckout();
                home = CP.ClickGoBack();
                HistoryPage HP;
                HP = home.ClickHistory();
                Y  = HP.HystoryTotalColumn;

                if (X == Y)
                {
                    TestContext.WriteLine("Successful Test!!!{0}={1}", X, Y);
                    Assert.Pass("Successful Test!!!");
                }



                else
                {
                    Assert.Fail("The test is failed");
                    TestContext.WriteLine("The test is failed");
                }
            }
            else
            {
                Assert.Fail("User not registered");
            }
        }