public void CopyShiftAdmin() { strTestCaseNo = "TC004_Reg"; strtblname = "automation_shiftadministration"; strTestType = "Regression"; PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC04_CopyShiftAdmin"); FpAdminMenus adminmenus = new FpAdminMenus(); adminmenus.AdminClick(); adminmenus.LnkShiftAdministration.Click(); clsShiftAdministration shiftadmin = new clsShiftAdministration(); var connection = new ConnectToMySQL_Fetch_TestData(); var testdataShift = connection.Select(strtblname, strTestCaseNo, strTestType); strShiftName = testdataShift[4]; shiftadmin.CopyShiftdetails(strShiftName); string[] shiftdetails = shiftadmin.RetrieveShiftdetails(strShiftName + " (Copy)"); string strfbwebshiftname = shiftdetails[0]; string strfbwebshortcode = shiftdetails[1]; string strfbwebstarttime = shiftdetails[2]; string strfbwebDuration = shiftdetails[3]; string strfbwebCurrencies = shiftdetails[4]; string strfbwebStatus = shiftdetails[5]; try { Assert.AreEqual(strShiftName + " (Copy)", strfbwebshiftname); PropertiesCollection.test.Log(Status.Pass, strfbwebstarttime + " Copied Shift Name validated Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebstarttime + " Copied Shift Name not validated Succesfully"); } try { Assert.AreEqual(strUpdatedStartdate, strfbwebstarttime); PropertiesCollection.test.Log(Status.Pass, strfbwebstarttime + " Copied Shift Start Date validated Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebstarttime + " Copied Shift Start Date not validated Succesfully"); } try { Assert.AreEqual(strUpdatedDuration, strfbwebDuration); PropertiesCollection.test.Log(Status.Pass, strfbwebstarttime + " Copied Shift Duration validated Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebstarttime + " Copied Shift Duration not validated Succesfully"); } Thread.Sleep(4000); }
public void TS03_TC01_ShiftAdmin_Addshift() { PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TS03_TC01_Smoke_ShiftAdmin_Addshift"); var connection = new ConnectToMySQL_Fetch_TestData(); var testdataShift = connection.Select(strtblname, strTestCaseNo, strTestType); var TopbarMenu = new clsMainPage_TopbarMenu(); var ShiftAdministration = new clsShiftAdministration(); TopbarMenu.NavigatetoShiftAdministration(); String strTDShiftName = testdataShift[4]; String strTDShortCode = testdataShift[5]; String strTDStartTime = testdataShift[6]; String strTDDuration = testdataShift[7]; String strTDCurrencies = testdataShift[8]; String strTDStatus = testdataShift[9]; /********* Move to Roster and check if the 'Exit Edit' is enabled***********/ /********* Delete the shift if its already present********/ String[] shiftdetails1 = ShiftAdministration.RetrieveShiftdetails(strTDShiftName); Console.WriteLine(shiftdetails1[0]); if (shiftdetails1[0].IsNullOrEmpty() == false) { ShiftAdministration.DeleteShiftdetails(shiftdetails1[0]); } /**********************************************************/ ShiftAdministration.AddShiftdetails(strTDShiftName, strTDShortCode, strTDStartTime, strTDDuration, strTDCurrencies); String[] shiftdetails = ShiftAdministration.RetrieveShiftdetails(strTDShiftName); String strfbwebshiftname = shiftdetails[0]; String strfbwebshortcode = shiftdetails[1]; String strfbwebstarttime = shiftdetails[2]; String strfbwebDuration = shiftdetails[3]; String strfbwebCurrencies = shiftdetails[4]; String strfbwebStatus = shiftdetails[5]; try { Assert.AreEqual(strTDShiftName, strfbwebshiftname); PropertiesCollection.test.Log(Status.Pass, "Shift Name: " + strfbwebshiftname + " created and validated"); } catch { PropertiesCollection.test.Log(Status.Fail, "Shift Name is not matching"); throw; } try { Assert.AreEqual(strTDStartTime, strfbwebstarttime); PropertiesCollection.test.Log(Status.Pass, "Shift Start time: " + strfbwebstarttime + " created and validated on Shift Admin Screen"); } catch { PropertiesCollection.test.Log(Status.Fail, "Shift Start time is not matching on Shift Admin screen"); throw; } try { Assert.AreEqual(strTDDuration, strfbwebDuration); PropertiesCollection.test.Log(Status.Pass, "Shift Duration: " + strfbwebDuration + " created and validated on Shift Admin Screen"); } catch { PropertiesCollection.test.Log(Status.Fail, "Shift Duration is not matching on Shift Admin screen"); throw; } try { Assert.AreEqual(strTDCurrencies, strfbwebCurrencies); PropertiesCollection.test.Log(Status.Pass, "Currency: " + strfbwebCurrencies + " created and validated on Shift Admin Screen"); } catch { PropertiesCollection.test.Log(Status.Fail, "Currencies are not matching on Shift Admin screen"); throw; } try { Assert.AreEqual(strTDStatus, strfbwebStatus); PropertiesCollection.test.Log(Status.Pass, "Shift Status Active?: " + strfbwebStatus + " created and validated on Shift Admin screen"); } catch { PropertiesCollection.test.Log(Status.Fail, "Shift Status is not matching"); throw; } }
public void TS03_TC06_ShiftAdmin_DeleteShift() { PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TS03_TC06_ShiftAdmin_DeleteShift"); String strtblname = "automation_shiftadministration"; string[] list; var connection = new ConnectToMySQL_Fetch_TestData(); list = connection.Select(strtblname, strTestCaseNo, strTestType); string strTDShiftName = list[4]; Int64 ShiftTypeID = 0; Int64 PeopleID = 0; Int64 RosterID = 0; Int64 RosterShiftTypeID = 0; Int64 ShiftPersonID = 0; var TopbarMenu = new clsMainPage_TopbarMenu(); var ShiftAdministration = new clsShiftAdministration(); TopbarMenu.NavigatetoShiftAdministration(); 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 ShiftTypeID from tblShiftType where ShiftTypeName = '" + strTDShiftName + "';"; SqlCommand command = new SqlCommand(strQuery, myConnection); reader = command.ExecuteReader(); while (reader.Read()) { ShiftTypeID = Convert.ToInt64(reader.GetValue(0)); Console.WriteLine("ShiftTypeID" + ShiftTypeID); } reader.Close(); string strQuery1 = "select RosterID from tblRosterShiftType where ShiftTypeID = '" + ShiftTypeID + "';"; SqlCommand command1 = new SqlCommand(strQuery1, myConnection); reader = command1.ExecuteReader(); while (reader.Read()) { RosterID = Convert.ToInt64(reader.GetValue(0)); Console.WriteLine("RosterID" + RosterID); } reader.Close(); string strQuery2 = "select RosterShiftTypeID from tblRosterShiftType where ShiftTypeID = '" + ShiftTypeID + "';"; SqlCommand command2 = new SqlCommand(strQuery2, myConnection); reader = command2.ExecuteReader(); while (reader.Read()) { RosterShiftTypeID = Convert.ToInt64(reader.GetValue(0)); Console.WriteLine("RosterShiftTypeID" + RosterShiftTypeID); } reader.Close(); string strQuery3 = "select PeopleID from tblPeople where Surname = 'testuser1';"; SqlCommand command3 = new SqlCommand(strQuery3, myConnection); reader = command3.ExecuteReader(); while (reader.Read()) { PeopleID = Convert.ToInt64(reader.GetValue(0)); Console.WriteLine("PeopleID" + PeopleID); } reader.Close(); string strQuery4 = "select ShiftPersonID from tblShiftPerson where PeopleID = '" + PeopleID + "';"; SqlCommand command4 = new SqlCommand(strQuery4, myConnection); reader = command4.ExecuteReader(); while (reader.Read()) { ShiftPersonID = Convert.ToInt64(reader.GetValue(0)); Console.WriteLine("ShiftPersonID " + ShiftPersonID); } reader.Close(); string strQuery5 = "delete from tblRosterShiftType where ShiftTypeID ='" + ShiftTypeID + "';"; SqlCommand command5 = new SqlCommand(strQuery5, myConnection); command5.ExecuteNonQuery(); string strQuery6 = "delete from tblShiftPersonCurrency where ShiftPersonID = '" + ShiftPersonID + "';"; SqlCommand command6 = new SqlCommand(strQuery6, myConnection); command6.ExecuteNonQuery(); string strQuery7 = "delete from tblShiftTypeCurrency where ShiftTypeID = '" + ShiftTypeID + "';"; SqlCommand command7 = new SqlCommand(strQuery7, myConnection); command7.ExecuteNonQuery(); string strQuery8 = "delete from tblShiftType where ShiftTypeName = '" + strTDShiftName + "';"; SqlCommand command8 = new SqlCommand(strQuery8, myConnection); command8.ExecuteNonQuery(); myConnection.Close(); string[] shiftdetails = ShiftAdministration.RetrieveShiftdetails(list[4]); string strfbwebshiftname = shiftdetails[0]; try { Assert.IsNull(strfbwebshiftname); PropertiesCollection.test.Log(Status.Pass, "Shift : " + list[4] + " is deleted and validated on Shift Admin screen"); } catch { PropertiesCollection.test.Log(Status.Fail, "Error: not deleted"); throw; } }
public void AddShiftAdmin() { PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC01_AddShiftAdmin"); FpAdminMenus adminmenus = new FpAdminMenus(); adminmenus.AdminClick(); adminmenus.LnkShiftAdministration.Click(); clsShiftAdministration shiftadmin = new clsShiftAdministration(); strTestCaseNo = "TC001_Reg"; strtblname = "automation_shiftadministration"; strTestType = "Regression"; var connection = new Database.ConnectToMySQL_Fetch_TestData(); 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]; shiftadmin.AddShiftdetails(strTDShiftName, strTDShortCode, strTDStartTime, strTDDuration, strTDCurrencies); string[] shiftdetails = shiftadmin.RetrieveShiftdetails(strTDShiftName); string strfbwebshiftname = shiftdetails[0]; string strfbwebshortcode = shiftdetails[1]; string strfbwebstarttime = shiftdetails[2]; string strfbwebDuration = shiftdetails[3]; string strfbwebCurrencies = shiftdetails[4]; string strfbwebStatus = shiftdetails[5]; try { Assert.AreEqual(strTDShiftName, strfbwebshiftname); PropertiesCollection.test.Log(Status.Pass, strfbwebshiftname + " Shift created Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebshiftname + " Shift not created Succesfully"); throw; } try { Assert.AreEqual(strTDStartTime, strfbwebstarttime); PropertiesCollection.test.Log(Status.Pass, strfbwebstarttime + " Shift Start time validated Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebstarttime + " Shift Start Time not validated Succesfully"); throw; } try { Assert.AreEqual(strTDDuration, strfbwebDuration); PropertiesCollection.test.Log(Status.Pass, strfbwebDuration + " Shift Duration validated Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebDuration + " Shift Duration not validated Succesfully"); throw; } try { Assert.AreEqual(strTDCurrencies, strfbwebCurrencies); PropertiesCollection.test.Log(Status.Pass, strfbwebDuration + " Shift Currencies validated Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebCurrencies + " Shift Currencies not validated Succesfully"); throw; } try { Assert.AreEqual(strTDStatus, strfbwebStatus); PropertiesCollection.test.Log(Status.Pass, strfbwebDuration + " Shift Status validated Succesfully"); } catch { PropertiesCollection.test.Log(Status.Fail, strfbwebStatus + " Shift Status not validated Succesfully"); throw; } }