Esempio n. 1
0
        public void TestMethod1()
        {
            #region classes utilizadas para navegação.
            DadosLogin login  = new DadosLogin();
            NavegaMenu navega = new NavegaMenu();
            #endregion

            IWebDriver driver = login.LogarNoSistema();
            System.Threading.Thread.Sleep(8000);
            // driver = navega.NavegaOperacional(driver);
            driver = navega.NavegaOperacional(driver);
            driver = navega.NavegaRenovacao(driver);
            driver = navega.NavegaVendas(driver);
            driver = navega.NavegaInicio(driver);
            driver = navega.NavegaPortal(driver);
            driver = navega.NavegaPosVendas(driver);
            driver = navega.NavegaVendas(driver);
            System.Threading.Thread.Sleep(4000);

            //comando para acesso ao iframe
            driver.SwitchTo().Frame("ZonaInterna");
            driver.FindElement(By.ClassName("submenunovotitulo"));

            //escolhendo o menu por javascript executando função diretamente.
            IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
            js.ExecuteScript("SelecionaModuloJQuery('','NOVOORCAMENTO','AcompanhamentoVendas|Professional','NOVOORCAMENTO','Novo orçamento');");

            System.Threading.Thread.Sleep(5000);
        }
Esempio n. 2
0
        public void IncluirClientePf()
        {
            #region classes utilizadas.
            //Classe que faz login no sistema.
            DadosLogin login = new DadosLogin();
            //Classe instanciada para os metodos de navegação.
            NavegaMenu navega = new NavegaMenu();
            //Classe instanciada para gerar numero cpf aleatório.
            GeradorCpfCnpj Cpf = new GeradorCpfCnpj();
            #endregion

            //login no sistema.
            IWebDriver driver = login.LogarNoSistema();
            //Esperando tela de inicio carregar.
            System.Threading.Thread.Sleep(8000);


            string cpf  = "";
            int    fase = 0;
            int    cad  = 1;
            while (fase < 2)
            {
                if (fase == 1)
                {
                    driver.SwitchTo().DefaultContent();
                    driver.SwitchTo().DefaultContent();
                }
                //navegando até o operacional.
                driver = navega.NavegaOperacional(driver);

                //comando para acesso ao iframe
                driver.SwitchTo().Frame("ZonaInterna");
                //escolhendo o menu por javascript executando função diretamente.
                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript("SelecionaModuloJQuery('ConsultaCliente;Fast/FrmCadastroNovo.aspx?pagina=Cliente1', 'CLIENTE', 'Professional|Beneficios', 'CLIENTE', 'Clientes');");
                System.Threading.Thread.Sleep(5000);

                if (cad == 1)
                {
                    //Clica no botão incluir.
                    driver.FindElement(By.Id("BtIncluir")).Click();

                    #region Cadastro dos dados do cliente.
                    #region Dados principais
                    //comando para acesso ao iframe
                    driver.SwitchTo().Frame("ZonaInterna");
                    driver.FindElement(By.Id("Cliente_Nome")).SendKeys("Lucas Teste Automacao");
                    cpf = Cpf.CadastroPF();
                    driver.FindElement(By.Id("Cliente_CgcCpf")).SendKeys(cpf);
                    driver.FindElement(By.Id("Cliente_Sexo1")).Click();

                    {//para clicar e selecionar grupo de produção
                        driver.FindElement(By.XPath("//*[@id=\"DIVCliente_GrupoHierarquico\"]/div/span/span[1]/span")).Click();
                        driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys("quiver");
                        System.Threading.Thread.Sleep(2000);
                        driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys(Keys.Down);
                        driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys(Keys.Enter);
                    }

                    //Selecionando caracteristica. quase chorei pra fazer funcionar.
                    IWebElement   elemento = driver.FindElement(By.Id("Cliente_Caracteristica"));
                    SelectElement combo    = new SelectElement(elemento);
                    combo.SelectByIndex(2);
                    System.Threading.Thread.Sleep(2000);
                    driver.FindElement(By.Id("Cliente_EMail")).SendKeys("*****@*****.**");
                    #endregion
                    System.Threading.Thread.Sleep(2000);
                    #region Dados Complementares.
                    //driver.FindElement(By.Id("DadosComplementares_Box")).Click();
                    js.ExecuteScript("openAtalho(\"BoxDadosComplementares\");");


                    driver.FindElement(By.Id("Cliente_InscrEstadual")).SendKeys(Cpf.GerarRG());
                    driver.FindElement(By.Id("Cliente_DataNascimento")).SendKeys("01/01/1995");

                    //Selecionando documento de identidade. quase chorei pra fazer funcionar.
                    IWebElement   comboDocIdent = driver.FindElement(By.Id("Cliente_TipoIdent"));
                    SelectElement cbDocIdent    = new SelectElement(comboDocIdent);
                    cbDocIdent.SelectByIndex(6);

                    //data de exp rg e orgão exp.
                    driver.FindElement(By.Id("Cliente_DataExp")).SendKeys("01/01/2000");
                    driver.FindElement(By.Id("Cliente_OrgaoExp")).SendKeys("SSP");
                    driver.FindElement(By.Id("BtGravar")).Click();
                    #endregion


                    #region Cadastro de endereço e telefone.

                    { //Cadastro de telefone.
                        driver.FindElement(By.Id("BtIncluirClienteTelefone1")).Click();
                        System.Threading.Thread.Sleep(2000);
                        driver.SwitchTo().Frame("ZonaInterna");
                        driver.FindElement(By.Id("ClienteFone_DDD")).SendKeys("11");
                        driver.FindElement(By.Id("ClienteFone_Telefone")).SendKeys("12345678");
                        //Selecionando telefone em combo. quase chorei pra fazer funcionar.
                        elemento = driver.FindElement(By.Id("ClienteFone_TipoTelefone"));
                        combo    = new SelectElement(elemento);
                        combo.SelectByIndex(8);

                        driver.FindElement(By.Id("ClienteFone_FonePref")).Click();

                        driver.FindElement(By.Id("BtGravar")).Click();
                        driver.FindElement(By.Id("Button1")).Click();
                    }
                    { //Cadastro de Endereço
                        System.Threading.Thread.Sleep(5000);

                        //após clicar do sair tive qeu voltar para default e depois acessar 2 iframes
                        driver.SwitchTo().DefaultContent();
                        driver.SwitchTo().Frame("ZonaInterna");
                        driver.SwitchTo().Frame("ZonaInterna");
                        driver.FindElement(By.Id("BtIncluirClienteEndereco1")).Click();
                        System.Threading.Thread.Sleep(5000);
                        driver.SwitchTo().Frame("ZonaInterna");
                        driver.FindElement(By.Id("ClienteEnder_Cep")).SendKeys("01227000");
                        driver.FindElement(By.Id("ClienteEnder_Complemento")).Click();
                        System.Threading.Thread.Sleep(5000);
                        driver.FindElement(By.Id("ClienteEnder_Numero")).SendKeys("171");
                        driver.FindElement(By.Id("BtGravar")).Click();
                        driver.FindElement(By.Id("Button1")).Click();
                    }
                    #endregion

                    #endregion

                    cad = 2;
                    fase++;
                }
                #region Validação do cadastro do cliente mediante a consulta.
                else
                {
                    //aqui não precisou selecionar o zona interna pois ele já veio carregado lá de cima do código.
                    //Selecionando tipo de consulta de cliente.
                    System.Threading.Thread.Sleep(2000);
                    IWebElement   elemento = driver.FindElement(By.Name("TipoConsultaWeb"));
                    SelectElement combo    = new SelectElement(elemento);
                    combo.SelectByIndex(3);
                    driver.FindElement(By.Id("CgcCpfCli")).SendKeys(cpf);
                    driver.FindElement(By.XPath("//*[@id=\"SpanToolBarRightB\"]/button")).Click();
                    //Espera necessária para gerar o elemento na tela.
                    System.Threading.Thread.Sleep(3000);
                    driver.FindElement(By.Id("BtEdiReg")).Click();
                    fase++;
                    // System.Threading.Thread.Sleep(10000);
                }
                #endregion
            }
        }
Esempio n. 3
0
        public void IncluirSegNovo()
        {
            #region Classes utilizadas para login e navegação ate o modulo.
            //Classe que faz login no sistema.
            DadosLogin login = new DadosLogin();
            //Classe instanciada para os metodos de navegação.
            NavegaMenu navega = new NavegaMenu();
            //Classe instanciada para cadastro do item tipo controle auto.
            CadastroItemAuto cadItem = new CadastroItemAuto();
            //Classe instanciada para cadastro de premio.
            CadastroPremio premioCadastro = new CadastroPremio();
            //Classe instanciada para validar valores e calculo comissão e repasse.
            CadastroComissao comissaoCadastro = new CadastroComissao();
            #endregion

            //login no sistema.
            IWebDriver driver = login.LogarNoSistema();
            //Esperando tela de inicio carregar.
            System.Threading.Thread.Sleep(8000);

            //navega ao menu operacional.
            driver = navega.NavegaOperacional(driver);

            //comando para acesso ao iframe
            driver.SwitchTo().Frame("ZonaInterna");
            //escolhendo o menu por javascript executando função diretamente.
            IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
            js.ExecuteScript("SelecionaModuloJQuery('ConsultaEmissaoERecusa;Fast/FrmCadastroNovo.aspx?pagina=Documento','EMISSOESRECUSAS','Professional','EMISSOESRECUSAS','Propostas/Apólices'); ");
            System.Threading.Thread.Sleep(5000);

            //gerando o número de apólice, ROB+DATA DO CADASTRO+AT (Apolice Tipo) e o número 1 de seguro novo.

            string apolice = "";
            int    n       = 1;

            DateTime numeroApolice = DateTime.Today;
            apolice = "ROB" + numeroApolice.ToString("dd/MM/yyyy") + "AT" + n;

            //IWebElement selecionaConsultaDoc = driver.FindElement(By.Id("TipoConsulta2"));
            // SelectElement comboConsultaDoc = new SelectElement(selecionaConsultaDoc);
            //comboConsultaDoc.SelectByValue("2");
            // driver.FindElement(By.Id("NoApolice")).SendKeys(apolice);
            //driver.FindElement(By.XPath("//*[@id=\"SpanToolBarRightB\"]/button")).Click();


            driver.FindElement(By.Id("BtIncluir")).Click();

            System.Threading.Thread.Sleep(5000);

            //Driver entrando no iframe para acesso ao form de cadastro.
            driver.SwitchTo().Frame("ZonaInterna");
            #region Cadastro capa do doc
            {//processo para clicar e selecionar em combos dinamicos.
                driver.FindElement(By.XPath("//*[@id=\"DIVDocumento_Cliente\"]/div/span/span[1]/span")).Click();

                driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys("CADASTRO ROBO PARA INCLUIR SEGUROS");
                System.Threading.Thread.Sleep(3000);
                driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys(Keys.Down);
                driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys(Keys.Enter);
            }


            driver.FindElement(By.Id("Documento_Apolice")).SendKeys(apolice);
            //Selecionando seguradora.
            IWebElement   seguradora      = driver.FindElement(By.Id("Documento_Seguradora"));
            SelectElement comboSeguradora = new SelectElement(seguradora);
            comboSeguradora.SelectByValue("10126");
            System.Threading.Thread.Sleep(2000);
            //
            IWebElement   produto      = driver.FindElement(By.Id("Documento_Produto"));
            SelectElement comboProduto = new SelectElement(produto);
            comboProduto.SelectByValue("553");

            {//para clicar e selecionar grupo de produção
                driver.FindElement(By.XPath("//*[@id=\"DIVDocumento_GrupoHierarquico\"]/div/span/span[1]/span")).Click();
                driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys("quiver");
                System.Threading.Thread.Sleep(2000);
                driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys(Keys.Down);
                driver.FindElement(By.XPath("/html/body/span[2]/span/span[1]/input")).SendKeys(Keys.Enter);
            }
            {// Executa a inclusão do inicio de vigência.
             // Pega o dia da execução e usa como vigencia.
                DateTime iniVigencia = DateTime.Today;
                driver.FindElement(By.Id("Documento_InicioVigencia")).SendKeys(iniVigencia.ToString());
                driver.FindElement(By.Id("Documento_InicioVigencia")).SendKeys(Keys.Tab);
                driver.FindElement(By.Id("Documento_DataEmissao")).SendKeys(iniVigencia.ToString());
                driver.FindElement(By.Id("Documento_TipoNegocio1")).Click();
                System.Threading.Thread.Sleep(1000);
                //driver.FindElement(By.Id("BtGravar")).Click();
                driver = navega.BtnGravar(driver);
            }
            #endregion
            #region Cadastro Item.
            driver = cadItem.CadItemAuto(driver);
            #endregion

            #region cadastro de prêmio.
            // Cadastro de premio em proposta/seguros
            driver = premioCadastro.CadastraPremio(driver, navega, 20, 5, 10000);
            #endregion

            //validação de comissão e repasse.
            #region validação do cálculo de prêmios, comissão e repasse.
            driver = comissaoCadastro.ValidaComRepNormalParc(driver, navega);
            #endregion

            driver.Quit();
        }
Esempio n. 4
0
        public void TesteImpressaoSeguroNovo()
        {
            #region Classes utilizadas para login e navegação ate o modulo.
            //Classe que faz login no sistema.
            DadosLogin login = new DadosLogin();
            //Classe instanciada para os metodos de navegação.
            NavegaMenu navega = new NavegaMenu();
            #endregion
            int x = 0;
            while (x < 2)
            {
                //login no sistema.
                IWebDriver driver = login.LogarNoSistema();
                //Esperando tela de inicio carregar.
                System.Threading.Thread.Sleep(8000);

                //navega ao menu operacional.
                driver = navega.NavegaOperacional(driver);

                //comando para acesso ao iframe
                driver.SwitchTo().Frame("ZonaInterna");
                //escolhendo o menu por javascript executando função diretamente.
                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript("SelecionaModuloJQuery('ConsultaEmissaoERecusa;Fast/FrmCadastroNovo.aspx?pagina=Documento','EMISSOESRECUSAS','Professional','EMISSOESRECUSAS','Propostas/Apólices'); ");
                System.Threading.Thread.Sleep(5000);

                //gerando o número de apólice, ROB+DATA DO CADASTRO+AT (Apolice Tipo) e o número 1 de seguro novo.

                string apolice = "";
                int    n       = 1;

                DateTime numeroApolice = DateTime.Today;
                apolice = "ROB" + numeroApolice.ToString("dd/MM/yyyy") + "AT" + n;

                IWebElement   selecionaConsultaDoc = driver.FindElement(By.Id("TipoConsulta2"));
                SelectElement comboConsultaDoc     = new SelectElement(selecionaConsultaDoc);
                comboConsultaDoc.SelectByValue("2");
                driver.FindElement(By.Id("NoApolice")).SendKeys(apolice);
                driver.FindElement(By.XPath("//*[@id=\"SpanToolBarRightB\"]/button")).Click();
                System.Threading.Thread.Sleep(2500);
                driver.SwitchTo().DefaultContent();
                driver.SwitchTo().Frame("ZonaInterna");
                driver.FindElement(By.Id("BtEdiReg")).Click();
                System.Threading.Thread.Sleep(3500);
                driver.SwitchTo().DefaultContent();
                driver.SwitchTo().Frame("ZonaInterna");
                driver.SwitchTo().Frame("ZonaInterna");
                driver.FindElement(By.Id("BtImprimir")).Click();
                System.Threading.Thread.Sleep(3000);
                driver.SwitchTo().DefaultContent();
                driver.SwitchTo().Frame("ZonaInterna");
                driver.SwitchTo().Frame("ZonaInterna");
                driver.SwitchTo().Frame("RptImpressaoProposta");

                switch (x)
                {
                case 0:
                    driver.FindElement(By.Id("ViasImpressao1")).Click();
                    break;

                case 1:
                    driver.FindElement(By.Id("ViasImpressao2")).Click();
                    break;
                }

                for (int i = 1; i <= 5; i++)
                {
                    driver.FindElement(By.XPath("/html/body/form/div[5]/div[1]/div/div/div/div[2]/div[1]/div[2]/div/div[" + i + "]/div/div/input")).Click();
                }

                driver.FindElement(By.Id("BtAnexar")).Click();
                System.Threading.Thread.Sleep(15000);
                driver.SwitchTo().DefaultContent();
                string validaResultadoImp = driver.FindElement(By.XPath("//*[@id=\"dialog_janela\"]/div/div/div[1]/h5")).Text;
                Assert.AreEqual(validaResultadoImp, "Relatório");
                driver.Quit();
                x++;
            }
        }