コード例 #1
0
        public void LimparCarrinho()
        {
            new BaseTest().AcessaUrl(Driver, "https://test-sandbox.azurewebsites.net/restaurants/");

            EnjoeatPageObject     enjoeatPageObject     = new EnjoeatPageObject(Driver);
            RestaurantPageObjects restaurantPageObjects = new RestaurantPageObjects(Driver);

            enjoeatPageObject.IrparaRestaurante("Tasty Treats").Click();

            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img.box-img-detail")));

            Assert.AreEqual("Tasty Treats", enjoeatPageObject.NomeRestaurant.Text);

            restaurantPageObjects.adicionarItemAoCarrinho("Bolo de Morango").Click();

            for (int i = 0; i < 3; i++)
            {
                restaurantPageObjects.adicionarItemAoCarrinho("Cup Cake de Choc. Branco").Click();
            }

            Assert.AreEqual("R$ 57,00", restaurantPageObjects.TotalCarrinho.Text);

            wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='box-footer']:last-child")));

            restaurantPageObjects.BotaoLimpar.Click();

            Assert.AreEqual("Seu carrinho está vazio!", restaurantPageObjects.FraseDoCarrinho.Text);
        }
コード例 #2
0
        public void RemoverItemDoCarrinho()
        {
            new BaseTest().AcessaUrl(Driver, "https://test-sandbox.azurewebsites.net/restaurants/");

            EnjoeatPageObject     enjoeatPageObject     = new EnjoeatPageObject(Driver);
            RestaurantPageObjects restaurantPageObjects = new RestaurantPageObjects(Driver);

            enjoeatPageObject.IrparaRestaurante("Green Food").Click();

            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img.box-img-detail")));

            Assert.AreEqual("Green Food", enjoeatPageObject.NomeRestaurant.Text);

            restaurantPageObjects.adicionarItemAoCarrinho("Suco Detox").Click();

            for (int i = 0; i < 2; i++)
            {
                restaurantPageObjects.adicionarItemAoCarrinho("Salada Ceasar").Click();
            }

            Assert.AreEqual("R$ 19,90", restaurantPageObjects.TotalCarrinho.Text);

            restaurantPageObjects.PrimeiroItemDoCarrinho().Click();

            Assert.AreEqual("R$ 21,90", restaurantPageObjects.TotalCarrinho.Text);
        }
コード例 #3
0
        public void VerificarItensDoMenu()
        {
            new BaseTest().AcessaUrl(Driver, "https://test-sandbox.azurewebsites.net/restaurants/");

            EnjoeatPageObject     enjoeatPageObject     = new EnjoeatPageObject(Driver);
            RestaurantPageObjects restaurantPageObjects = new RestaurantPageObjects(Driver);

            enjoeatPageObject.IrparaRestaurante("Coffee Corner").Click();

            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img.box-img-detail")));

            Assert.AreEqual("Coffee Corner", enjoeatPageObject.NomeRestaurant.Text);

            List <string> listaItens = new List <string>();

            listaItens.Add("CAPPUCCINO COM CHANTILLY");
            listaItens.Add("SUPER EXPRESSO");
            listaItens.Add("STARBUCKS COPYCAT");

            List <string> listaDescricoes = new List <string>();

            listaDescricoes.Add("Tradicional cappuccino com chantilly");
            listaDescricoes.Add("Café expresso duplo.");
            listaDescricoes.Add("O mais pedido da casa. O verdadeiro café americano pura água.");

            List <string> listaPreco = new List <string>();

            listaPreco.Add("R$ 9,90");
            listaPreco.Add("R$ 12,50");
            listaPreco.Add("R$ 15,60");

            for (int i = 0; i < listaItens.Count; i++)
            {
                string valorNomeItem  = listaItens[i].ToUpper();
                string valorDescricao = listaDescricoes[i];
                string valorPreco     = listaPreco[i];

                Assert.AreEqual(valorNomeItem, restaurantPageObjects.RetornarItem(valorNomeItem));
                Assert.AreEqual(valorDescricao, restaurantPageObjects.RetornarDescricaoDoItem(valorNomeItem));
                Assert.AreEqual(valorPreco, restaurantPageObjects.RetornarPreco(valorNomeItem));
            }
        }
        public void AdicionarItemAoCarrinho()
        {
            new BaseTest().AcessaUrl(Driver, "https://test-sandbox.azurewebsites.net/restaurants/");

            EnjoeatPageObject     enjoeatPageObject     = new EnjoeatPageObject(Driver);
            RestaurantPageObjects restaurantPageObjects = new RestaurantPageObjects(Driver);

            enjoeatPageObject.IrparaRestaurante("Bread & Bakery").Click();

            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img.box-img-detail")));

            Assert.AreEqual("Bread & Bakery", enjoeatPageObject.NomeRestaurant.Text);

            restaurantPageObjects.adicionarItemAoCarrinho("Pão artesanal italiano").Click();

            Assert.AreEqual("R$ 12,90", restaurantPageObjects.TotalCarrinho.Text);
        }
コード例 #5
0
        public void FecharPedido()
        {
            EnjoeatPageObject     enjoeatPageObject     = new EnjoeatPageObject(Driver);
            RestaurantPageObjects restaurantPageObjects = new RestaurantPageObjects(Driver);
            OrderPageObjects      orderPageObjects      = new OrderPageObjects(Driver);
            SumaryPageObjects     sumaryPageObjects     = new SumaryPageObjects(Driver);

            new BaseTest().AcessaUrl(Driver, "https://test-sandbox.azurewebsites.net/restaurants/");

            enjoeatPageObject.IrparaRestaurante("Burger House").Click();

            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img.box-img-detail")));

            Assert.AreEqual("Burger House", enjoeatPageObject.NomeRestaurant.Text);

            for (int i = 0; i < 2; i++)
            {
                restaurantPageObjects.adicionarItemAoCarrinho("Classic Burger").Click();
            }

            for (int i = 0; i < 2; i++)
            {
                restaurantPageObjects.adicionarItemAoCarrinho("Batatas fritas").Click();
            }

            for (int i = 0; i < 3; i++)
            {
                restaurantPageObjects.adicionarItemAoCarrinho("Refrigerante").Click();
            }

            Assert.AreEqual("R$ 61,50", restaurantPageObjects.TotalCarrinho.Text);

            wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='box-footer']:last-child")));
            restaurantPageObjects.BotaoConfirmar.Click();

            orderPageObjects.CampoNome.SendKeys("Comprador teste");
            orderPageObjects.CampoEmail.SendKeys("*****@*****.**");
            orderPageObjects.CampoConfirmarEmail.SendKeys("*****@*****.**");

            orderPageObjects.CampoEndereco.SendKeys("Rua Tal");
            orderPageObjects.CampoNumero.SendKeys("123");
            orderPageObjects.CampoComplemento.SendKeys("apto. 45");

            IWebElement pagamentoItem = orderPageObjects.RetornarFormaDePagamento("Cartão de Débito");

            pagamentoItem.FindElement(By.CssSelector("div")).Click();
            Assert.AreEqual("Cartão de Débito", pagamentoItem.FindElement(By.CssSelector("label")).Text);

            Assert.AreEqual("R$ 61,50", orderPageObjects.RetornarPreco("Itens"));
            Assert.AreEqual("8,00", orderPageObjects.RetornarPreco("Frete").Replace("R$ ", ""));
            Assert.AreEqual("69,50", orderPageObjects.RetornarPreco("Valor Total").Replace("R$ ", ""));

            orderPageObjects.RemoverClassicBurguer.Click();

            Assert.AreEqual("R$ 43,00", orderPageObjects.RetornarPreco("Itens"));
            Assert.AreEqual("8,00", orderPageObjects.RetornarPreco("Frete").Replace("R$ ", ""));
            Assert.AreEqual("51,00", orderPageObjects.RetornarPreco("Valor Total").Replace("R$ ", ""));

            orderPageObjects.FinalizarPedido.Click();

            wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("i.fa-star-o")));

            Assert.AreEqual("Pedido foi Concluído", sumaryPageObjects.InformacaoConcluido.Text);

            Assert.AreEqual("Seu pedido foi recebido pelo restaurante. Prepare a mesa que a comida está chegando!", sumaryPageObjects.Mensagem.Text);

            sumaryPageObjects.AvaliarPedido(4).Click();

            var verificaEstrela = sumaryPageObjects.VerificarAvaliacao(4);

            Assert.AreEqual(sumaryPageObjects.BuscarCor("Cinza"), verificaEstrela.GetCssValue("color"));
        }