public void Test_CreateEditDeleteRole() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Roles"); selenium.WaitForPageToLoad("30000"); selenium.Click("//input[@value='Create Role']"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1"); selenium.Click("ctl00_Body_ctl00_SaveButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Test Role #1"), "Text 'Test Role #1' not found when it should be."); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); selenium.ChooseOkOnNextConfirmation(); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this role?") > -1, "Confirm box didn't appear when expected."); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("deleted successfully"), "Text 'deleted successfully' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Test Role"), "Text 'Test Role' found when it shouldn't be."); }
public void DeleteCourse() { selenium.WaitForPageToLoad("40000"); selenium.Click("link=Create New"); selenium.WaitForPageToLoad("40000"); selenium.Type("id=Name", "forDeletion"); selenium.Click("css=input[value=\"Create\"]"); selenium.WaitForPageToLoad("40000"); selenium.Click("xpath=//tr[contains(.,'forDeletion')]//a[text()='Delete']"); selenium.GetConfirmation(); selenium.WaitForPageToLoad("40000"); }
public TT Navigate <TT>(Action action, bool chooseOkOnConfirmation) where TT : PageBase, new() { var target = new TT(); InitPage(target); if (chooseOkOnConfirmation) { _selenium.ChooseOkOnNextConfirmation(); } action(); if (chooseOkOnConfirmation) { if (_selenium.IsConfirmationPresent()) { _selenium.GetConfirmation(); } } WaitLoad(target); AssertErrorPage(target); AssertCorrectPageLoaded(target); return(target); }
/// <summary> /// Click on a button/ radio-button/ check-box present in the page /// </summary> /// <param name="locator">The locator.</param> /// <param name="type">Type of locator</param> public void Click(string locator, FindType type = FindType.ById) { _selenium.ChooseOkOnNextConfirmation(); _selenium.Click(locator); if (_selenium.IsConfirmationPresent()) { _selenium.GetConfirmation(); } }
public void Test_CreateEditDeleteUser() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); selenium.Click("ctl00_Body_ctl00_CreateButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Test1"); selenium.Type("ctl00_Body_ctl00_LastName", "Test1"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "test1"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.AddSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); selenium.Click("ctl00_Body_ctl00_SaveButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Test1"), "Text 'Test1' not found when it should be."); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Test2"); selenium.Type("ctl00_Body_ctl00_LastName", "Test2"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "test2"); selenium.RemoveSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); selenium.ChooseOkOnNextConfirmation(); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton"); Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this user?") > -1, "Confirm box didn't appear when expected."); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Test1"), "Text 'Test1' found when it shouldn't be."); }
public void TheEliminarCorrectoTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]"); Assert.AreEqual("Desea aliminar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se elimino satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
public void TheEliminarCancelarTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.ChooseCancelOnNextConfirmation(); selenium.Click("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]"); Assert.AreEqual("Desea aliminar", selenium.GetConfirmation()); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); }
public void TheEditarCorrectoTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=DNI", "12345677"); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Editar al cliente", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se Edito satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
public void TheRegistrarCamposVaciosTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("RegistrarCliente", selenium.GetText("css=h2")); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Ingresar Campos Faltantes", selenium.GetText("css=div.validation-summary-errors")); }
public void TheEditarCampoVacioTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Edad", "20"); selenium.Type("id=Apellidos", ""); selenium.Click("css=button.btn.btn-default"); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Desea Editar al cliente", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("EditarCliente", selenium.GetText("css=h2")); }
public void TheRegistrarDatosInvalidosTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Nombre", "1234561"); selenium.Type("id=Apellidos", "123456"); selenium.Type("id=DNI", "kkk"); selenium.Type("id=Edad", "j"); selenium.Select("id=Nivel", "label=Universitario"); selenium.Type("id=Telefono", "kkl"); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Datos Incorrectos", selenium.GetText("css=div.validation-summary-errors")); }
public void TheRegistrarCorrectoTest() { selenium.Open("/"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Nombre", "Maria"); selenium.Type("id=Apellidos", "Magdalena"); selenium.Type("id=DNI", "12345678"); selenium.Type("id=Edad", "20"); selenium.Select("id=Sexo", "label=Femenino"); selenium.Select("id=Nivel", "label=Superior"); selenium.Type("id=Telefono", "123456789"); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se Registro satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
public void TheRegistrar_CancelarTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Nombre", "Maria"); selenium.Type("id=Apellidos", "Magdalena"); selenium.Type("id=DNI", "12345677"); selenium.Type("id=Edad", "20"); selenium.Select("id=Sexo", "label=Femenino"); selenium.Select("id=Nivel", "label=Universitario"); selenium.Type("id=Telefono", "123456789"); selenium.ChooseCancelOnNextConfirmation(); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); Assert.AreEqual("RegistrarCliente", selenium.GetText("css=h2")); }