public void assignTagToExistingAccountInit() { System.Threading.Thread.Sleep(1000); borrarArchivosTemp("E:\\workspace\\Maria_Repository\\assigningTagToAccount\\attachments\\"); assignTagToExistingAccount(); System.Threading.Thread.Sleep(1000); if (accountClosed == true) { Console.WriteLine("No se puede asignar un Tag a la cuenta " + accountNumbr.Substring(7, 16) + " porque está cerrada"); Assert.Fail("No se puede asignar un Tag a la cuenta " + accountNumbr.Substring(7, 16) + " porque está cerrada"); } if (NumbVehC == true) { Console.WriteLine("No se puede asignar un Tag a la cuenta " + accountNumbr.Substring(7, 16) + " porque no hay vehículo asociado a la cuenta"); Assert.Fail("No se puede asignar un Tag a la cuenta " + accountNumbr.Substring(7, 16) + " porque no hay vehículo asociado a la cuenta"); } if (TagAssigned == true) { Console.WriteLine("ERROR AL ASIGNAR TAG a la cuenta: " + accountNumbr.Substring(7, 16) + ", " + confirmationMessage); Assert.Fail("ERROR AL ASIGNAR TAG a la cuenta: " + accountNumbr.Substring(7, 16) + ", " + confirmationMessage); } System.Threading.Thread.Sleep(1000); Console.WriteLine("Se le asignado el el tag No." + tagIdNmbr + " a la cuenta " + accountNumbr.Substring(7, 16) + " correctamente"); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }
public void accountCreationInit() { accountCreation(); System.Threading.Thread.Sleep(1000); Console.WriteLine("Se ha creado la cuenta: " + accountNumbr.Substring(7, 16) + " correctamente"); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }
public void accountCreationWithVehicleInit() { CAC_accountCreationOnly.accountCreation(); System.Threading.Thread.Sleep(1000); elementClick("ctl00_ButtonsZone_BtnValidate_IB_Label");// Guardar Cuenta con el botón System.Threading.Thread.Sleep(2000); accountCreationWithVehicle(); Console.WriteLine("Se ha creado la cuenta: " + accountNumbr.Substring(7, 16) + " correctamente y con el vehículo creado con la matricula: " + matriNu); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }
public void accountReloadInit() { System.Threading.Thread.Sleep(1000); borrarArchivosTemp("E:\\workspace\\Maria_Repository\\accountReload\\attachments\\"); accountReload(); System.Threading.Thread.Sleep(1000); if (accountClosed) { Console.WriteLine("No se puede hacer Recarga a la cuenta " + accountNumbr.Substring(7, 9) + " porque está cerrada"); Assert.Fail("No se puede hacer Recarga a la cuenta " + accountNumbr.Substring(7, 9) + " porque está cerrada"); } System.Threading.Thread.Sleep(1000); Console.WriteLine("Se Recargado la cuenta " + accountNumbr.Substring(7, 9) + " correctamente y posee un saldo de: " + Saldo); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }
public void assigningVehcleToExistingAccountInit() { System.Threading.Thread.Sleep(1000); borrarArchivosTemp("E:\\workspace\\Maria_Repository\\assigningVehicleToAccount\\attachments\\"); assigningVehcleToExistingAccount(); System.Threading.Thread.Sleep(1000); CAC_accountCreationWithVehicle.accountCreationWithVehicle(); System.Threading.Thread.Sleep(200); if (accountClosed) { Console.WriteLine("No se puede asignar un Vehículo a la cuenta " + accountNumbr.Substring(7, 16) + " porque está cerrada"); Assert.Fail("No se puede asignar un Vehículo a la cuenta " + accountNumbr.Substring(7, 16) + " porque está cerrada"); } System.Threading.Thread.Sleep(1000); Console.WriteLine("Se le asignado el vehículo con la matrícula " + matriNu + " a la cuenta " + accountNumbr.Substring(7, 16) + " correctamente"); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }
public void accountCloseInit() { System.Threading.Thread.Sleep(1000); borrarArchivosTemp("E:\\workspace\\Maria_Repository\\accountClose\\attachments\\"); accountClose(); System.Threading.Thread.Sleep(1000); if (accountClosed) { Console.WriteLine("No se puede cerrar la cuenta " + accountNumbr.Substring(7, 16) + " porque ya está cerrada"); Assert.Fail("No se puede cerrar la cuenta " + accountNumbr.Substring(7, 16) + " porque ya está cerrada"); } if (NumbVehC) { Console.WriteLine("No se puede cerrar la cuenta " + accountNumbr.Substring(7, 9) + " porque tiene " + NumbVeh + " vehículo/s asignado/s"); Assert.Fail("No se puede cerrar la cuenta " + accountNumbr.Substring(7, 9) + " porque tiene " + NumbVeh + " vehículo/s asignado/s"); } System.Threading.Thread.Sleep(1000); Console.WriteLine("Se ha cerrado la cuenta " + accountNumbr.Substring(7, 16) + " correctamente"); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }
public void accountCreationAssigningTagInit() { System.Threading.Thread.Sleep(1000); borrarArchivosTemp("E:\\workspace\\Maria_Repository\\accountCreationAssigningTag\\attachments\\"); CAC_accountCreationOnly.accountCreation(); System.Threading.Thread.Sleep(2000); elementClick("ctl00_ButtonsZone_BtnValidate_IB_Label"); System.Threading.Thread.Sleep(1000); CAC_accountCreationWithVehicle.accountCreationWithVehicle(); System.Threading.Thread.Sleep(500); accountCreationAssigningTag(); System.Threading.Thread.Sleep(1000); if (errorTagAssignment) { Console.WriteLine("ERROR AL ASIGNAR TAG a la cuenta: " + accountNumbr.Substring(7, 9) + ", " + confirmationMessage); Assert.Fail("Tag Invalido: No se puede asignar un Tag al Vehiculo " + matriNu + " de la cuenta " + accountNumbr.Substring(7, 9)); return; } Console.WriteLine("Se ha creado la cuenta: " + accountNumbr.Substring(7, 9) + " con un Vehiculo con la matricula " + matriNu + " y el tag asignado No.: " + tagIdNmbr); System.Threading.Thread.Sleep(3000); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }
public void CACcrearOperadores() { Actions action = new Actions(driver); borrarArchivosTemp("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\"); try{ driver.Navigate().GoToUrl(CaCUrl); takeScreenShot("E:\\Selenium\\", "loginCACCVHPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\", "loginCACCVHPage", ".jpeg"); loginPage("00001", "00001"); takeScreenShot("E:\\Selenium\\", "homeCACCVHPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\", "homeCACCVHPage", ".jpeg"); BOVersion = driver.FindElement(By.Id("ctl00_statusRight")).Text; System.Threading.Thread.Sleep(2000); action.ClickAndHold(driver.FindElement(By.LinkText("Configuración sistema"))).Build().Perform(); System.Threading.Thread.Sleep(1000); action.MoveToElement(driver.FindElement(By.LinkText("Parámetros de cuenta"))); action.ClickAndHold(driver.FindElement(By.LinkText("Operadores"))).Build().Perform(); System.Threading.Thread.Sleep(500); driver.FindElement(By.LinkText("Gestión de operadores")).Click(); System.Threading.Thread.Sleep(1000); takeScreenShot("E:\\Selenium\\", "gestionOperadoresPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\", "gestionOperadoresPage", ".jpeg"); System.Threading.Thread.Sleep(500); elementClick("ctl00_ContentZone_BtnCreate"); System.Threading.Thread.Sleep(1000); takeScreenShot("E:\\Selenium\\", "crearOperadoresPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\", "crearOperadoresPage", ",.jpeg"); int userSel = ranNumbr(0, nameOp.Length - 1); new SelectElement(driver.FindElement(By.Id("ctl00_ContentZone_cmb_title_cmb_dropdown"))).SelectByText(sexSelc[userSel]); System.Threading.Thread.Sleep(100); new SelectElement(driver.FindElement(By.Id("ctl00_ContentZone_cmb_gender_cmb_dropdown"))).SelectByText(genderS[userSel]); driver.FindElement(By.Id("ctl00_ContentZone_forename_box_data")).SendKeys(nameOp[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_surname_box_data")).SendKeys(lastNameOp[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_address_box_data")).SendKeys(addressTec[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_postcode_box_data")).SendKeys(cpAdress[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_city_box_data")).SendKeys(townC[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_country_box_data")).SendKeys("España"); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_email_box_data")).SendKeys(nameOp[userSel].ToLower() + lastNameOp[userSel].ToLower() + "@tecsidel.es"); driver.FindElement(By.Id("ctl00_ContentZone_txt_phone_box_data")).SendKeys(workPhone1[userSel]); selectDropDown("ctl00_ContentZone_group_cmb_dropdown"); System.Threading.Thread.Sleep(1000); IWebElement operatorGroup = new SelectElement(driver.FindElement(By.Id("ctl00_ContentZone_group_cmb_dropdown"))).SelectedOption; string operatorG = operatorGroup.Text; driver.FindElement(By.Id("ctl00_ContentZone_dt_birth_box_date")).Clear(); driver.FindElement(By.Id("ctl00_ContentZone_dt_birth_box_date")).SendKeys(dateSel(new DateTime(1970, 1, 1), new DateTime(1980, 12, 31)).ToString("dd/MM/yyyy")); System.Threading.Thread.Sleep(3000); driver.FindElement(By.Id("ctl00_ContentZone_password_box_data")).SendKeys("00001"); driver.FindElement(By.Id("ctl00_ContentZone_password2_box_data")).SendKeys("00001"); System.Threading.Thread.Sleep(5000); takeScreenShot("E:\\Selenium\\", "allfilleddata", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\", "allfilleddata", ".jpeg"); elementClick("ctl00_ButtonsZone_BtnSubmit_IB_Label"); System.Threading.Thread.Sleep(2000); takeScreenShot("E:\\Selenium\\", "userCreated", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\", "userCreated", ".jpeg"); IWebElement tableResult = driver.FindElement(By.Id("ctl00_ContentZone_TblResults")); IList <IWebElement> userResults = tableResult.FindElements(By.TagName("tr")); if (userResults.Count < 14) { for (int i = 1; i <= userResults.Count; i++) { if (i == userResults.Count) { lastcreated = driver.FindElement(By.XPath("//table[@id='ctl00_ContentZone_TblResults']/tbody/tr[" + i + "]/td[2]")).Text; } } } else { elementClick("ctl00_ContentZone_tablePager_BtnLast"); tableResult = driver.FindElement(By.Id("ctl00_ContentZone_TblResults")); userResults = tableResult.FindElements(By.TagName("tr")); lastcreated = driver.FindElement(By.XPath("//table[@id='ctl00_ContentZone_TblResults']/tbody/tr[" + userResults.Count + "]/td[2]")).Text; } elementClick("ctl00_BtnLogOut"); System.Threading.Thread.Sleep(500); driver.SwitchTo().Alert().Accept(); System.Threading.Thread.Sleep(1000); loginPage(lastcreated, "00001"); takeScreenShot("E:\\Selenium\\", "userCreatedscreenHome", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\CAC_crearOperadores\\attachments\\", "userCreatedscreenHome", ".jpeg"); Console.WriteLine("Se ha Creado el " + lastcreated + " con la contraseaña: 00001" + " en el grupo de " + operatorG.Substring(04)); Console.WriteLine("Se ha probado en la versión del CAC BO: " + BOVersion.Substring(1, 16) + " y CAC Manager: " + BOVersion.Substring(17)); }catch (Exception e) { Console.WriteLine(e.GetBaseException()); Assert.Fail(); } }
public void BOHostcrearOperadores() { Actions action = new Actions(driver); borrarArchivosTemp("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\"); try{ driver.Navigate().GoToUrl(BoHostUrl); takeScreenShot("E:\\Selenium\\", "loginBOCVHPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\", "loginBOCVHPage", ".jpeg"); loginPage("00001", "00001"); takeScreenShot("E:\\Selenium\\", "homeBOVHPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\", "homeBOVHPage", ".jpeg"); BOVersion = driver.FindElement(By.Id("ctl00_statusRight")).Text; System.Threading.Thread.Sleep(2000); action.ClickAndHold(driver.FindElement(By.LinkText("Configuración sistema"))).Build().Perform(); System.Threading.Thread.Sleep(1000); action.MoveToElement(driver.FindElement(By.LinkText("Configuración de peaje"))); action.ClickAndHold(driver.FindElement(By.LinkText("Operadores"))).Build().Perform(); System.Threading.Thread.Sleep(500); driver.FindElement(By.LinkText("Gestión de operadores")).Click(); System.Threading.Thread.Sleep(1000); takeScreenShot("E:\\Selenium\\", "gestionOperadoresPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\", "gestionOperadoresPage", ".jpeg"); System.Threading.Thread.Sleep(500); elementClick("ctl00_ContentZone_BtnCreate"); System.Threading.Thread.Sleep(1000); takeScreenShot("E:\\Selenium\\", "crearOperadoresPage", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\", "crearOperadoresPage", ".jpeg"); int userSel = ranNumbr(0, nameOp.Length - 1); new SelectElement(driver.FindElement(By.Id("ctl00_ContentZone_cmb_title_cmb_dropdown"))).SelectByText(sexSelc[userSel]); System.Threading.Thread.Sleep(100); new SelectElement(driver.FindElement(By.Id("ctl00_ContentZone_cmb_gender_cmb_dropdown"))).SelectByText(genderS[userSel]); driver.FindElement(By.Id("ctl00_ContentZone_forename_box_data")).SendKeys(nameOp[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_surname_box_data")).SendKeys(lastNameOp[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_address_box_data")).SendKeys(addressTec[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_postcode_box_data")).SendKeys(cpAdress[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_city_box_data")).SendKeys(townC[userSel]); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_txt_country_box_data")).SendKeys("España"); System.Threading.Thread.Sleep(100); driver.FindElement(By.Id("ctl00_ContentZone_email_box_data")).SendKeys(nameOp[userSel].ToLower() + lastNameOp[userSel].ToLower() + "@tecsidel.es"); driver.FindElement(By.Id("ctl00_ContentZone_txt_phone_box_data")).SendKeys(workPhone1[userSel]); selectDropDown("ctl00_ContentZone_group_cmb_dropdown"); System.Threading.Thread.Sleep(100); selectDropDown("ctl00_ContentZone_cmb_typeDoc_cmb_dropdown"); System.Threading.Thread.Sleep(1000); IWebElement Docselected = new SelectElement(driver.FindElement(By.Id("ctl00_ContentZone_group_cmb_dropdown"))).SelectedOption; string DocSelectedText = Docselected.Text; if (DocSelectedText.Equals("TI")) { driver.FindElement(By.Id("ctl00_ContentZone_txt_numberDoc_box_data")).SendKeys(ranNumbr(1000000, 90000000) + "" + ranNumbr(1000000, 9000000)); } else { driver.FindElement(By.Id("ctl00_ContentZone_txt_numberDoc_box_data")).SendKeys(ranNumbr(10000000, 900000000) + "" + ranNumbr(1000000, 9000000)); } System.Threading.Thread.Sleep(1000); IWebElement operatorGroup = new SelectElement(driver.FindElement(By.Id("ctl00_ContentZone_group_cmb_dropdown"))).SelectedOption; string operatorG = operatorGroup.Text; driver.FindElement(By.Id("ctl00_ContentZone_dt_birth_box_date")).Clear(); driver.FindElement(By.Id("ctl00_ContentZone_dt_birth_box_date")).SendKeys(dateSel(new DateTime(1970, 1, 1), new DateTime(1980, 12, 31)).ToString("dd/MM/yyyy")); System.Threading.Thread.Sleep(3000); driver.FindElement(By.Id("ctl00_ContentZone_password_box_data")).SendKeys("00001"); driver.FindElement(By.Id("ctl00_ContentZone_password2_box_data")).SendKeys("00001"); System.Threading.Thread.Sleep(5000); takeScreenShot("E:\\Selenium\\", "allfilleddata", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\", "allfilleddata", ".jpeg"); elementClick("ctl00_ButtonsZone_BtnSubmit_IB_Label"); System.Threading.Thread.Sleep(2000); takeScreenShot("E:\\Selenium\\", "userCreated", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\", "userCreated", ".jpeg"); tableResult = driver.FindElement(By.Id("ctl00_ContentZone_TblResults")); userResults = tableResult.FindElements(By.TagName("tr")); if (userResults.Count > 15) { elementClick("ctl00_ContentZone_tablePager_BtnLast"); System.Threading.Thread.Sleep(500); tableResult = driver.FindElement(By.Id("ctl00_ContentZone_TblResults")); userResults = tableResult.FindElements(By.TagName("tr")); } for (int x = 1; x <= userResults.Count; x++) { if (x == userResults.Count) { lastcreated = driver.FindElement(By.XPath("//table[@id='ctl00_ContentZone_TblResults']/tbody/tr[" + x + "]/td[2]")).Text; } } elementClick("ctl00_ButtonsZone_BtnDownload_IB_Label"); if (isAlertPresent()) { driver.SwitchTo().Alert().Accept(); } System.Threading.Thread.Sleep(5000); string enviarViaLbl = driver.FindElement(By.Id("ctl00_LblError")).Text; if (enviarViaLbl.Contains("OK")) { enviarViaVer = enviarViaLbl.Substring(41).Replace("'", ""); Console.WriteLine("La telecarga de Operadores se ha enviado a Vía con la versión " + enviarViaVer); } else { Assert.Fail("Hay un error en envair telecargas a vía"); } elementClick("ctl00_BtnLogOut"); System.Threading.Thread.Sleep(500); driver.SwitchTo().Alert().Accept(); System.Threading.Thread.Sleep(5000); loginPage(lastcreated, "00001"); takeScreenShot("E:\\Selenium\\", "userCreatedscreenHome", timet + ".jpeg"); takeScreenShot("E:\\workspace\\Maria_Repository\\BOHost_crearOperadores\\attachments\\", "userCreatedscreenHome", ".jpeg"); Console.WriteLine("Se ha Creado el operador " + lastcreated + " con la contraseaña: 00001" + " en el grupo de " + operatorG.Substring(04)); Console.WriteLine("Se ha probado en la versión del BO Host: " + BOVersion.Substring(1, 15) + " y Host Manager: " + BOVersion.Substring(18)); System.Threading.Thread.Sleep(90000); string connectionUrlPlaza = "Data Source=172.18.130.188;Initial Catalog=COVIHONDURAS_QA_TOLLPLAZA; user id=sa;password=lediscet;"; connection = new SqlConnection(); connection.ConnectionString = connectionUrlPlaza; connection.Open(); SqlCommand query = new SqlCommand("select version, filename from dbo.atable where tabletype='operators' and version='" + enviarViaVer + "'", connection); SqlDataReader queryReader = query.ExecuteReader(); int i = 0; while (queryReader.Read()) { for (i = 0; i < 2; i++) { transactionsOp[0] = Convert.ToString(queryReader["version"]); transactionsOp[1] = Convert.ToString(queryReader["filename"]); transactionsOps.Add(transactionsOp[i]); } } if (transactionsOp[0] == null) { Assert.Fail("La Telecarga de Operadores no ha bajado a Plaza"); } else { Console.WriteLine("La telecarga de operadores con la version: " + transactionsOps[0] + " ha bajado a la plaza con el nombre de archivo: " + transactionsOps[1]); } } catch (Exception e) { Console.WriteLine(e.Message); Assert.Fail(); } }