public void TS03_TC04_Roster_RemoveRoster() { PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TS03_TC04_Roster_RemoveRoster"); String strtblname = "automation_shiftadministration"; String strtblname1 = "automation_rosteradministration"; String OrgRoster = "FighterSQN - Test Automation"; Int64 RosterID = 0; var connection = new ConnectToMySQL_Fetch_TestData(); var SidebarMenu = new FpSideMenus(); var PersonnelScheduleRoster = new clsPersonnelSchedulingRoster(); var testdataShift = connection.Select(strtblname, strTestCaseNo, strTestType); String strTDShiftName = testdataShift[4]; String strTDShortCode = testdataShift[5]; String strTDStartTime = testdataShift[6]; String strTDDuration = testdataShift[7]; String strTDCurrencies = testdataShift[8]; String strTDStatus = testdataShift[9]; var testdataRoster = connection.Select(strtblname1, strTestCaseNo, strTestType); string strTDRosterName = testdataRoster[4]; System.Threading.Thread.Sleep(1000); SidebarMenu.LnkRoster.Click(); System.Threading.Thread.Sleep(4000); string strConnectionString = "Data Source=" + ConfigurationManager.AppSettings["SQLServerDataSource"] + ";Initial Catalog=" + ConfigurationManager.AppSettings["SQLServerInitialCatalog"] + ";User Id=" + ConfigurationManager.AppSettings["SQLServerUserId"] + ";Password="******"SQLServerPassword"]; SqlConnection myConnection = new SqlConnection(strConnectionString); myConnection.Open(); SqlDataReader reader = null; String strQuery = "select RosterID from tblRoster where RosterName = '" + strTDRosterName + "';"; SqlCommand command = new SqlCommand(strQuery, myConnection); reader = command.ExecuteReader(); while (reader.Read()) { RosterID = Convert.ToInt64(reader.GetValue(0)); Console.WriteLine("RosterID" + RosterID); } reader.Close(); string strQuery1 = "delete from tblRosterPerson where RosterID = '" + RosterID + "';"; SqlCommand command1 = new SqlCommand(strQuery1, myConnection); command1.ExecuteNonQuery(); myConnection.Close(); System.Threading.Thread.Sleep(4000); }
public void TS03_TC03_Roster_ScheduleRoster() { PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TS03_TC03_Roster_ScheduleRoster"); String strtblname = "automation_shiftadministration"; String OrgRoster = "AT_Org Group1 - AT_Roster"; var connection = new ConnectToMySQL_Fetch_TestData(); var SidebarMenu = new FpSideMenus(); var PersonnelScheduleRoster = new clsPersonnelSchedulingRoster(); var testdataShift = connection.Select(strtblname, strTestCaseNo, strTestType); String strTDShiftName = testdataShift[4]; String strTDShortCode = testdataShift[5]; String strTDStartTime = testdataShift[6]; String strTDDuration = testdataShift[7]; String strTDCurrencies = testdataShift[8]; String strTDStatus = testdataShift[9]; System.Threading.Thread.Sleep(1000); SidebarMenu.LnkRoster.Click(); System.Threading.Thread.Sleep(4000); PropertiesCollection.driver.FindElement(By.XPath("//*[@id=\"divMainBody\"]/div[2]/div[2]/div[1]/div[1]/span/span/span[2]")).Click(); // Get all of the options IList <IWebElement> options = PropertiesCollection.driver.FindElements(By.XPath("//*[@id=\"divMainBody\"]/div[2]/div[2]/div[1]/div[1]/span/select/option")); // Loop through the options and select the one that matches System.Console.WriteLine("Count of options =" + options.Count); for (int i = 0; i < options.Count; i++) { System.Console.WriteLine("Option" + options.ElementAt(i)); if (options.ElementAt(i).Text.Equals(OrgRoster)) { options.ElementAt(i).Click(); break; } } PersonnelScheduleRoster.ScheduleRoster(strTDShiftName, strTDShortCode, strTDStartTime, strTDDuration, strTDCurrencies); System.Threading.Thread.Sleep(4000); }