Ejemplo n.º 1
0
        public void AmountValidationTest()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "101");

            Assert.True(task1.IsAlertVisible(), "Alert Message is not visible");
            task1.DismissAlert();
        }
Ejemplo n.º 2
0
        public void CheckIfAddButtonIsDisabled()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "1");

            var elementName = task1.GetProductName();
            task1.RemoveProduct();

            Assert.False(task1.IsButtonEnabled(), "add buton is not disabled");
        }
Ejemplo n.º 3
0
        public void CheckBasketAfterPageRefresh()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "1");

            var elementName = task1.GetProductName();
            task1.RefreshTaskPage();

            Assert.True(task1.GetBasketText().Contains(elementName), "lack of product in basket");
        }
Ejemplo n.º 4
0
        public void AlertTextValidationTest()
        {
            const string expectedMessage = "Łączna ilość produktów w koszyku nie może przekroczyć 100.";
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "101");

            Assert.True(task1.IsAlertVisible(), "Alert Message is not visible");
            Assert.True(task1.GetValidationText().Equals(expectedMessage), "Improper alert message, expected {0}, actual {1}", expectedMessage, task1.GetValidationText());
            task1.DismissAlert();
        }
Ejemplo n.º 5
0
        public void CheckIfProperPrice()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "1");

            var elementName = task1.GetProductName();
            var productPrice = task1.GetProductPrice();

            var price = task1.GetBasketText().Split('(');
            price = price[1].Split(')');
            Assert.AreEqual(productPrice, price[0], "price in basket is improper, should be {0}", productPrice);
        }
Ejemplo n.º 6
0
        public void CheckIfProperProductIsAdded()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "1");

            var elementName = task1.GetProductName();
            var productPrice = task1.GetProductPrice();

            Assert.True(task1.GetBasketText().Contains(elementName), "improper product in basket " + elementName + " " + task1.GetBasketText());
        }
Ejemplo n.º 7
0
        public void RemoveProduct2()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "1");

            var elementName = task1.GetProductName();
            task1.RemoveProduct();
            task1.AddAmount("product1", "1");

            Assert.True(task1.GetBasketText().Contains(elementName), "product was not removed");
            var productPrice = task1.GetProductPrice();

            Assert.AreEqual(productPrice, task1.GetSummaryPrice().Split(' ')[0], "summary price in basket is improper, should be {0}", productPrice);
        }
Ejemplo n.º 8
0
        public void RemoveProduct()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "1");

            var elementName = task1.GetProductName();
            task1.RemoveProduct();

            Assert.False(task1.GetBasketText().Contains(elementName), "product was not removed");
        }
Ejemplo n.º 9
0
        public void CheckIfSummaryPriceIsProperlyCalculated()
        {
            var task1 = new Task1(this.Driver);
            task1.NavigateToPage(GetHost() + "task_1");
            task1.AddAmount("product1", "100");

            var elementName = task1.GetProductName();
            var productPrice = task1.GetProductPrice();
            var psummaryQuantity = task1.GetQuantity();
            double abc = double.Parse(productPrice)*100;

            Assert.AreEqual(abc.ToString("F"), task1.GetSummaryPrice().Split(' ')[0], "summary price in basket is improper, should be {0}", productPrice);
            Assert.AreEqual("100", psummaryQuantity);
        }