/// <summary> /// Método para validar el login /// </summary> public static void ValidacionLogin() { if (PropiedadColeccionDriver.driver != null) { var pestañasNavegador = PropiedadColeccionDriver.driver.WindowHandles; if (pestañasNavegador.Count > 0) { var dropDownMenu = PropiedadColeccionDriver.driver.FindElements(By.ClassName("user-menu")); if (dropDownMenu.Count > 0) { ElementosWebLogin elementosLogout = new ElementosWebLogin(); elementosLogout.btnCerrar.Click(); elementosLogout.btnCerrarSesion.Click(); } } else { Prueba.Iniciar(ParametrosEjecucion.Navegador, ParametrosEjecucion.RutaDelSitio); } } else { Prueba.Iniciar(ParametrosEjecucion.Navegador, ParametrosEjecucion.RutaDelSitio); } }
public void AA1_LoginSGI(IList <ParametroPrueba> parametroPrueba) { string usuario = parametroPrueba.FirstOrDefault(x => x.Nombre.Equals("Usuario")).Valor; string password = parametroPrueba.FirstOrDefault(x => x.Nombre.Equals("Password")).Valor; try { #region "VALIDACION LOGIN" Utilitarios.ValidacionLogin(); #endregion #region "EJECUCION DE LA PRUEBA" ElementosWebLogin elementosLogin = new ElementosWebLogin(); elementosLogin.txtUsuario.SendKeys(usuario); elementosLogin.txtPassword.SendKeys(password); Utilitarios.GenerarCaptura("AA1_LoginSGI_Captura1_Ingreso de Campos"); System.Threading.Thread.Sleep(1000); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(1000); Utilitarios.GenerarCaptura("AA1_LoginSGI_Captura2_Click botón Login"); /*Validacion de pagina inicial*/ if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { Utilitarios.GenerarCaptura("AA1_LoginSGI_Captura3_Error validación"); throw new ExcepcionSistema("VALIDACION: Error usuario no pudo iniciar sesión en la aplicación."); } #endregion } catch (ExcepcionSistema) { throw; } catch { throw; } finally { if (ParametrosEjecucion.CerrarNavegadorPorPrueba) { Prueba.Finalizar(); } } }
public void AA2_LoginMensajeErrorSGI() { Dictionary <string, string> diccionario = Utilitarios.ObtenerParametrosPorExcel("Login", "AA2_LoginMensajeErrorSGI"); string usuario = diccionario.Where(x => x.Key.Equals("Usuario")).FirstOrDefault().Value; string password = diccionario.Where(x => x.Key.Equals("Password")).FirstOrDefault().Value; try { #region "VALIDACION LOGIN" Utilitarios.ValidacionLogin(); #endregion #region "EJECUCION DE LA PRUEBA" ElementosWebLogin elementosLogin = new ElementosWebLogin(); System.Threading.Thread.Sleep(4000); elementosLogin.txtUsuario.SendKeys(usuario); System.Threading.Thread.Sleep(1000); elementosLogin.txtPassword.SendKeys(password); System.Threading.Thread.Sleep(1000); Utilitarios.GenerarCaptura("AA2_LoginMensajeErrorSGI_Captura1_Ingreso de campos"); System.Threading.Thread.Sleep(1500); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA2_LoginMensajeErrorSGI_Captura2_Click botón login"); /*Validacion de pagina inicial*/ if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { List <IWebElement> listaElementosTagName = Utilitarios.ObtieneElementosPorTag("div"); if (!listaElementosTagName.Where(x => x.Text.Equals("El nombre de usuario o la contraseña especificados son incorrectos.")).Any()) { Utilitarios.GenerarCaptura("AA2_LoginMensajeErrorSGI_Captura3_Error validación"); throw new ExcepcionSistema("VALIDACION: Error, no despliega mensaje que indica que el usuario o la contraseña son inválidos."); } else { elementosLogin.btnAceptar.Click(); } } #endregion } catch (ExcepcionSistema) { throw; } catch { throw; } finally { if (ParametrosEjecucion.CerrarNavegadorPorPrueba) { Prueba.Finalizar(); } } }
public void AA4_LogoutSGI() { Dictionary <string, string> diccionario = Utilitarios.ObtenerParametrosPorExcel("Login", "AA4_LogoutSGI"); string usuario = diccionario.Where(x => x.Key.Equals("Usuario")).FirstOrDefault().Value; string password = diccionario.Where(x => x.Key.Equals("Password")).FirstOrDefault().Value; try { #region "VALIDACION LOGIN" Utilitarios.ValidacionLogin(); #endregion #region "EJECUCIÓN DE LA PRUEBA" ElementosWebLogin elementosLogout = new ElementosWebLogin(); if (PropiedadColeccionDriver.driver != null) { var dropDownMenu = Utilitarios.ObtieneElementosPorClase("user-menu"); if (dropDownMenu.Count > 0) { elementosLogout.btnCerrar.Click(); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura1_Click botón cerrar"); System.Threading.Thread.Sleep(1500); elementosLogout.btnCerrarSesion.Click(); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura2_Click botón cerrar sesión"); if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio) { System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura3_Error validación"); throw new ExcepcionSistema("VALIDACION: Error, el usuario no pudo salir del sistema."); } } else { ElementosWebLogin elementosLogin = new ElementosWebLogin(); elementosLogin.txtUsuario.SendKeys(usuario); elementosLogin.txtPassword.SendKeys(password); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura4_Completa campos"); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura5_Click botón login"); if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { PropiedadColeccionDriver.driver.Url = ParametrosEjecucion.RutaDelSitio + "/Gestion"; } } } else { ElementosWebLogin elementosLogin = new ElementosWebLogin(); elementosLogin.txtUsuario.SendKeys(usuario); elementosLogin.txtPassword.SendKeys(password); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura6_Completa campos"); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura7_Click botón login"); if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { PropiedadColeccionDriver.driver.Url = ParametrosEjecucion.RutaDelSitio + "/Gestion"; } } elementosLogout.btnCerrar.Click(); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura8_Click botón cerrar"); elementosLogout.btnCerrarSesion.Click(); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura9_Click botón cerrar sesión"); if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio) { System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA4_LogoutSGI_Captura10_Error validación"); throw new ExcepcionSistema("VALIDACION: Error, el usuario no pudo salir del sistema."); } #endregion } catch (ExcepcionSistema) { throw; } catch { throw; } finally { if (ParametrosEjecucion.CerrarNavegadorPorPrueba) { Prueba.Finalizar(); } if (!ParametrosEjecucion.CerrarNavegadorPorPrueba && ParametrosEjecucion.CerrarNavegadorPorModulo) { Prueba.Finalizar(); } } }
public void AA3_LoginCamposRequeridos() { try { #region "VALIDACION LOGIN" Utilitarios.ValidacionLogin(); #endregion #region "EJECUCION DE LA PRUEBA" ElementosWebLogin elementosLogin = new ElementosWebLogin(); System.Threading.Thread.Sleep(1000); elementosLogin.txtUsuario.Clear(); System.Threading.Thread.Sleep(1000); elementosLogin.txtPassword.Clear(); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA3_LoginCamposRequeridos_Captura1_Limpia campos"); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA3_LoginCamposRequeridos_Captura2_Click botón login"); List <IWebElement> listaElementoTagName = Utilitarios.ObtieneElementosPorTag("div"); if (!listaElementoTagName.Where(x => x.Text.Equals("Nombre de usuario es obligatorio")).Any()) { System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA3_LoginCamposRequeridos_Captura3_Error Validacion"); throw new ExcepcionSistema("VALIDACION: Error, al desplegar mensaje de Usuario requerido."); } else if (!listaElementoTagName.Where(x => x.Text.Equals("Contraseña es obligatorio")).Any()) { System.Threading.Thread.Sleep(1500); Utilitarios.GenerarCaptura("AA3_LoginCamposRequeridos_Captura4_Error validación"); throw new ExcepcionSistema("VALIDACION: Error, al desplegar mensaje de Contraseña requerido."); } #endregion } catch (ExcepcionSistema) { throw; } catch { throw; } finally { if (ParametrosEjecucion.CerrarNavegadorPorPrueba) { Prueba.Finalizar(); } } }
/// <summary> /// Método para Iniciar la ejecución de la prueba /// </summary> public static void ValidacionIniciarPrueba() { string usuario = ParametrosEjecucion.Usuario; string password = ParametrosEjecucion.Password; if (PropiedadColeccionDriver.driver != null) { var pestañasNavegador = PropiedadColeccionDriver.driver.WindowHandles; if (pestañasNavegador.Count > 0) { /*VALIDACION DE LOGEO*/ var dropDownMenu = PropiedadColeccionDriver.driver.FindElements(By.ClassName("user-menu")); if (dropDownMenu.Count > 0) { if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { PropiedadColeccionDriver.driver.Url = ParametrosEjecucion.RutaDelSitio + "/Gestion"; } } else { ElementosWebLogin elementosLogin = new ElementosWebLogin(); elementosLogin.txtUsuario.SendKeys(usuario); elementosLogin.txtPassword.SendKeys(password); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(2000); if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { throw new ExcepcionSistema("VALIDACION: Error al inicial sesión en la aplicación."); } } } else { Prueba.Iniciar(ParametrosEjecucion.Navegador, ParametrosEjecucion.RutaDelSitio); ElementosWebLogin elementosLogin = new ElementosWebLogin(); elementosLogin.txtUsuario.SendKeys(usuario); elementosLogin.txtPassword.SendKeys(password); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(2000); if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { throw new ExcepcionSistema("VALIDACION: Error al inicial sesión en la aplicación."); } } } else { Prueba.Iniciar(ParametrosEjecucion.Navegador, ParametrosEjecucion.RutaDelSitio); ElementosWebLogin elementosLogin = new ElementosWebLogin(); elementosLogin.txtUsuario.SendKeys(usuario); elementosLogin.txtPassword.SendKeys(password); elementosLogin.btnLogin.Click(); System.Threading.Thread.Sleep(4000); if (PropiedadColeccionDriver.driver.Url != ParametrosEjecucion.RutaDelSitio + "/Gestion") { throw new ExcepcionSistema("VALIDACION: Error al inicial sesión en la aplicación."); } } }