コード例 #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"));
        }
コード例 #6
0
        public void Exemplo1SemBDD()
        {
            new BaseTest().AcessaUrl(Driver);

            EnjoeatPageObject enjoeatPageObject = new EnjoeatPageObject(Driver);

            Assert.IsTrue(enjoeatPageObject.RetornarSeLogoExiste());
            Assert.AreEqual("Delivery pra qualquer fome: peça e receba em casa", enjoeatPageObject.RetornarTextoDescricao());
            enjoeatPageObject.BotaoRestaurantes.Click();

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

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='col-sm-6 col-xs-12']:nth-child(1)  span[class='place-info-box-icon']")));

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

            listaRestaurantes.Add("Bread & Bakery");
            listaRestaurantes.Add("Burger House");
            listaRestaurantes.Add("Coffee Corner");
            listaRestaurantes.Add("Green Food");
            listaRestaurantes.Add("Ice Cream");
            listaRestaurantes.Add("Tasty Treats");


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

            listaDescricoes.Add("Padaria");
            listaDescricoes.Add("Hamburgers");
            listaDescricoes.Add("Cafeteria");
            listaDescricoes.Add("Saudável");
            listaDescricoes.Add("Sorvetes");
            listaDescricoes.Add("Doces");

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

            listaTempos.Add("25 minutos");
            listaTempos.Add("30 minutos");
            listaTempos.Add("20 minutos");
            listaTempos.Add("40 minutos");
            listaTempos.Add("1 hora");
            listaTempos.Add("20 minutos");

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

            listaClassificacoes.Add("4.9");
            listaClassificacoes.Add("3.5");
            listaClassificacoes.Add("4.8");
            listaClassificacoes.Add("4.1");
            listaClassificacoes.Add("0");
            listaClassificacoes.Add("4.4");


            for (int rest = 0, descricao = 0, tempo = 0, classificacao = 0; rest < listaRestaurantes.Count; rest++, descricao++, tempo++, classificacao++)
            {
                string valorRestaurante   = listaRestaurantes[rest].ToUpper();
                string valorDescricao     = listaDescricoes[descricao];
                string valorTempos        = listaTempos[tempo];
                string valorClassicicacao = listaClassificacoes[classificacao];

                Assert.AreEqual(valorRestaurante, enjoeatPageObject.RetornarRestaurante(valorRestaurante));
                Assert.AreEqual(valorDescricao, enjoeatPageObject.RetornarDescricaoRestaurante(valorRestaurante));
                Assert.AreEqual(valorTempos, enjoeatPageObject.RetornarTempo(valorRestaurante));
                Assert.AreEqual(valorClassicicacao, enjoeatPageObject.RetornarClassificacao(valorRestaurante));
            }
        }