Beispiel #1
0
        public void validaTelaSessoes()
        {
            TimeSpan timeout_limit = TimeSpan.FromSeconds(3);
            int      retryCount    = 2;

            if (retryCount <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(retryCount));
            }

            Cinemas cinemas = new Cinemas();

            cinemas.EscolherCinemaComSucesso();
            Cinemas.iconeMenuCinemas


            while (true)
            {
                try
                {
                    AndroidElement menu_filmes = _driver.FindElementByAccessibilityId("Filmes");
                    menu_filmes.Click();
                    break;
                }
                catch (StaleElementReferenceException)
                {
                    if (--retryCount == 0)
                    {
                        throw;
                    }
                    Common.WaitAndRetry(timeout_limit);
                }
            }
        }
        public void validaValorSnacks()
        {
            TimeSpan period   = TimeSpan.FromSeconds(2);
            int      tryCount = 2;

            if (tryCount <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(tryCount));
            }

            Cinemas cinemas = new Cinemas();

            cinemas.EscolherCinemaComSucesso();

            while (true)
            {
                try
                {
                    AndroidElement menu_snackbar = _driver.FindElementById(menuSnackBar);
                    menu_snackbar.Click();
                    break;
                }
                catch (StaleElementReferenceException)
                {
                    if (--tryCount == 0)
                    {
                        throw;
                    }
                    Common.WaitAndRetry(period);
                }
            }

            AndroidElement pipocas = _driver.FindElementByXPath(menuPipocas);

            pipocas.Click();

            AndroidElement add_pipocas1 = _driver.FindElement(MobileBy.AndroidUIAutomator(addPipocas1));

            add_pipocas1.Click();
            AndroidElement add_pipocas2 = _driver.FindElement(MobileBy.AndroidUIAutomator(addPipocas2));

            add_pipocas2.Click();

            AndroidElement preco_pipocas1    = _driver.FindElement(MobileBy.AndroidUIAutomator(precoPipocas1));
            decimal        preco1            = Decimal.Parse(preco_pipocas1.Text, NumberStyles.Currency);
            AndroidElement preco_pipocas2    = _driver.FindElement(MobileBy.AndroidUIAutomator(precoPipocas2));
            decimal        preco2            = Decimal.Parse(preco_pipocas2.Text, NumberStyles.Currency);
            AndroidElement soma_valor_snacks = _driver.FindElementById(somaValorSnacks);
            decimal        soma_final        = Decimal.Parse(soma_valor_snacks.Text, NumberStyles.Currency);

            if (!(preco1 + preco2 == soma_final))
            {
                throw new ArgumentException("App nao esta somando os valores corretamente");
            }
        }