public void AddNoSpecialDate(WorkdayCalendarData testData) { //Click '+ Calendar' button. TimeSettingsWorkday.PrepareToAddWorkdayCalendar(); TimeManager.ShortPause(); //Input valid name TimeSettingsWorkday.FillInName(testData.InputData.CommonName); //Click "Save" button without any special date TimeSettingsWorkday.ClickSaveButton(); TimeManager.MediumPause(); JazzMessageBox.LoadingMask.WaitLoading(); //Verify saved successfully. Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); //Verify the label text Assert.IsTrue(TimeSettingsWorkday.IsWorkdayCalendarTextCorrect(testData.ExpectedData.LabelText)); //Verify there is no any special date added. Assert.AreEqual(testData.InputData.SpecialDate.Length, TimeSettingsWorkday.GetSpecialDateItemsNumber()); }
public void AddCommonFieldsIllegal(WorkdayCalendarData testData) { //Click '+ Calendar' button. TimeSettingsWorkday.PrepareToAddWorkdayCalendar(); TimeManager.ShortPause(); //Input illegal inputs for common fields: name TimeSettingsWorkday.FillInName(testData.InputData.CommonName); //Click "Save" button. TimeManager.MediumPause(); TimeSettingsWorkday.ClickSaveButton(); JazzMessageBox.LoadingMask.WaitLoading(); TimeManager.LongPause(); //verify that the saving is failed and error messages are displayed below the fields. Assert.IsTrue(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsCancelButtonDisplayed()); Assert.IsFalse(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsNameInvalidMsgCorrect(testData.ExpectedData)); //Click 'Cancel' button to quit the addition. TimeSettingsWorkday.ClickCancelButton(); TimeManager.ShortPause(); Assert.IsFalse(TimeSettingsWorkday.IsCancelButtonDisplayed()); TimeManager.ShortPause(); }
public void ModifyInvalidWorkday(WorkdayCalendarData testData) { //Select a calendar. TimeSettingsWorkday.SelectCalendar("工休日ForModifyInvalid"); TimeManager.ShortPause(); //Click 'Modify' button. TimeSettingsWorkday.ClickModifyButton(); TimeManager.ShortPause(); //Change the end month, end date of range1 so that it is overlapped with range2 TimeSettingsWorkday.SelectEndMonth(testData.InputData.SpecialDate[0].EndMonth, 1); TimeSettingsWorkday.SelectEndDate(testData.InputData.SpecialDate[0].EndDate, 1); //Change name to be a duplicated name; or null TimeSettingsWorkday.FillInName(testData.InputData.CommonName); //Click "Save" button. TimeSettingsWorkday.ClickSaveButton(); JazzMessageBox.LoadingMask.WaitLoading(); TimeManager.LongPause(); //verify that the saving is failed and error messages are displayed below the fields. Assert.IsTrue(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsCancelButtonDisplayed()); Assert.IsFalse(TimeSettingsWorkday.IsModifyButtonDisplayed()); TimeManager.MediumPause(); Assert.IsTrue(TimeSettingsWorkday.IsNameInvalidMsgCorrect(testData.ExpectedData)); Assert.IsTrue(TimeSettingsWorkday.IsRangeInvalidMsgCorrect(testData.ExpectedData, 1)); //Click 'Cancel' button to quit the modification. TimeSettingsWorkday.ClickCancelButton(); TimeManager.ShortPause(); }
public void AddInvalidWorkday(WorkdayCalendarData testData) { //Click '+ Calendar' button. TimeSettingsWorkday.PrepareToAddWorkdayCalendar(); TimeManager.ShortPause(); //Input invalid inputs, e.g. required fields are null; duplicated name; overlapped ranges TimeSettingsWorkday.AddSpecialDates(testData); TimeManager.ShortPause(); TimeSettingsWorkday.FillInName(testData.InputData.CommonName); TimeManager.ShortPause(); //Click "Save" button. TimeSettingsWorkday.ClickSaveButton(); TimeManager.LongPause(); //verify that the saving is failed and error messages are displayed below the fields. Assert.IsTrue(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsCancelButtonDisplayed()); Assert.IsFalse(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsNameInvalidMsgCorrect(testData.ExpectedData)); Assert.IsTrue(TimeSettingsWorkday.IsTypeInvalidMsgCorrect(testData.ExpectedData, 1)); Assert.IsTrue(TimeSettingsWorkday.IsRangeInvalidMsgCorrect(testData.ExpectedData, 1)); //Click 'Cancel' button to quit the addition. TimeSettingsWorkday.ClickCancelButton(); TimeManager.ShortPause(); Assert.IsFalse(TimeSettingsWorkday.IsCancelButtonDisplayed()); }
public void ModifyValidWorkday(WorkdayCalendarData testData) { //Select the calendar (Both of Calendar1 and Calendar2 can be modified). TimeSettingsWorkday.SelectCalendar(testData.InputData.CommonName); TimeManager.ShortPause(); //Click 'Modify' button TimeSettingsWorkday.ClickModifyButton(); TimeManager.ShortPause(); //Modify the Name, add more ranges TimeSettingsWorkday.FillInName(testData.ExpectedData.CommonName); TimeSettingsWorkday.AddSpecialDates(testData); //Click "Save" button TimeSettingsWorkday.ClickSaveButton(); JazzMessageBox.LoadingMask.WaitLoading(); //verify modification is successful Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsFalse(TimeSettingsWorkday.IsCancelButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.ExpectedData.CommonName)); //Verify there are special dates added. Assert.AreEqual(testData.InputData.SpecialDate.Length, TimeSettingsWorkday.GetSpecialDateItemsNumber()); }
public void ModifyWorkdayCancelled(WorkdayCalendarData testData) { //Select a calendar which has two special date ranges. TimeSettingsWorkday.SelectCalendar(testData.ExpectedData.CommonName); TimeManager.ShortPause(); //Click 'Modify' button. TimeSettingsWorkday.ClickModifyButton(); TimeManager.ShortPause(); //Click "Save" button directly without any change TimeSettingsWorkday.ClickSaveButton(); TimeManager.ShortPause(); //Click 'Modify' button again TimeSettingsWorkday.ClickModifyButton(); TimeManager.ShortPause(); ///Change name with valid input TimeSettingsWorkday.FillInName(testData.InputData.CommonName); //Click 'x' icon to delete one range TimeSettingsWorkday.ClickDeleteRangeItemButton(1); //Click "Cancel" button TimeSettingsWorkday.ClickCancelButton(); TimeManager.ShortPause(); //verify that the modification is cancelled and original information still displayes, there are still two ranges. Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsFalse(TimeSettingsWorkday.IsCancelButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.AreEqual(2, TimeSettingsWorkday.GetSpecialDateItemsNumber()); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.ExpectedData.CommonName)); }
public void DeleteWorkdayCancelled(WorkdayCalendarData testData) { //Select the Calendar. TimeSettingsWorkday.SelectCalendar(testData.InputData.CommonName); //Click 'Delete' button TimeManager.ShortPause(); TimeSettingsWorkday.ClickDeleteButton(); //Click 'Give Up' button to cancel the deletion. TimeManager.ShortPause(); TimeSettingsWorkday.ClickMsgBoxGiveUpButton(); //Select the Calendar again. TimeSettingsWorkday.SelectCalendar(testData.InputData.CommonName); //Click 'Delete' button TimeManager.ShortPause(); TimeSettingsWorkday.ClickDeleteButton(); //Click 'x' icon to close the deletion confirmation popup. TimeManager.ShortPause(); TimeSettingsWorkday.ClickMsgBoxCloseButton(); //Verify that the Calendar is not deleted when cancel or close the window, and still exists in the list. TimeManager.ShortPause(); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); //Go to other tab(e.g. worktime tab), then back again, verify that the calendar still exists in the list. TimeSettingsWorktime.NavigatorToWorktimeCalendarSetting(); TimeSettingsWorkday.NavigatorToWorkdayCalendarSetting(); TimeManager.MediumPause(); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); }
public void DeleteWorkdaySuccessful(WorkdayCalendarData testData) { //Select the Calendar. TimeSettingsWorkday.SelectCalendar(testData.InputData.CommonName); //Click 'Delete' button TimeManager.ShortPause(); TimeSettingsWorkday.ClickDeleteButton(); //Click 'Delete' button on the confirmation window. TimeManager.ShortPause(); TimeSettingsWorkday.ClickMsgBoxDeleteButton(); JazzMessageBox.LoadingMask.WaitLoading(); TimeManager.LongPause(); //Verify that the Calendar is deleted successfully and NOT exists in the list. Assert.IsFalse(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); //Go to other tab(e.g. worktime tab), then back again, verify that the deleted calendar NOT exists in the list. TimeSettingsWorktime.NavigatorToWorktimeCalendarSetting(); TimeSettingsWorkday.NavigatorToWorkdayCalendarSetting(); TimeManager.MediumPause(); Assert.IsFalse(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); }
public void DeleteWorkdayFailed(WorkdayCalendarData testData) { //Select the Calendar. TimeSettingsWorkday.SelectCalendar(testData.InputData.CommonName); //Click 'Delete' button TimeManager.ShortPause(); TimeSettingsWorkday.ClickDeleteButton(); //Verify that the message 'Are your sure to delete it?' is displayed on message box. Assert.IsTrue(JazzMessageBox.MessageBox.GetMessage().Contains(testData.ExpectedData.PopMessage[0])); //Click 'Delete' button to confirm the deletion. TimeManager.ShortPause(); TimeSettingsWorkday.ClickMsgBoxDeleteButton(); TimeManager.LongPause(); //Verify that error message like "Calendar has been used and can't be deleted" pops up. Assert.IsTrue(JazzMessageBox.MessageBox.GetMessage().Contains(testData.ExpectedData.PopMessage[1])); TimeManager.ShortPause(); //Click 'OK' button to close the deletion failed message box. TimeManager.ShortPause(); TimeSettingsWorkday.ClickMsgBoxOKButton(); //Verify that the Calendar is not deleted and still exists in the list. TimeManager.ShortPause(); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); //Go to other tab(e.g. worktime tab), then back again, verify that the calendar still exists in the list. TimeSettingsWorktime.NavigatorToWorktimeCalendarSetting(); TimeSettingsWorkday.NavigatorToWorkdayCalendarSetting(); TimeManager.MediumPause(); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); }
public void ModifyToDeleteSpecialDate(WorkdayCalendarData testData) { //Select a calendar which has three special date ranges. TimeSettingsWorkday.SelectCalendar(testData.InputData.CommonName); TimeManager.ShortPause(); //Click 'Modify' button. TimeSettingsWorkday.ClickModifyButton(); TimeManager.ShortPause(); //Click 'x' near one range, e.g. delete range1 TimeSettingsWorkday.ClickDeleteRangeItemButton(1); //Click 'Save' button TimeSettingsWorkday.ClickSaveButton(); JazzMessageBox.LoadingMask.WaitLoading(); //Verify modification is saved successfully, and only two ranges left. Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.AreEqual(2, TimeSettingsWorkday.GetSpecialDateItemsNumber()); //Click 'Modify' button again. TimeSettingsWorkday.ClickModifyButton(); TimeManager.ShortPause(); //Click 'x' near all the other two ranges TimeSettingsWorkday.ClickDeleteRangeItemButton(2); TimeSettingsWorkday.ClickDeleteRangeItemButton(1); //Click 'Save' button TimeSettingsWorkday.ClickSaveButton(); JazzMessageBox.LoadingMask.WaitLoading(); //Verify modification is saved successfully, and no any special date range left. Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.AreEqual(0, TimeSettingsWorkday.GetSpecialDateItemsNumber()); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); }
public void AddSpecialDates(WorkdayCalendarData testData) { //Click '+' icon each time when add a special date record //Amy's note: due to the order of dynamic element will be different if click the '+' icon after the first record has been input. That is why click + icon multiple times continuaslly here.. for (int elementPosition = 1; elementPosition <= testData.InputData.SpecialDate.Length; elementPosition++) { ClickAddSpecialDateButton(); TimeManager.ShortPause(); } //Input record(s) based on the input data file for (int elementPosition = 1; elementPosition <= testData.InputData.SpecialDate.Length; elementPosition++) { int inputDataArrayPosition = elementPosition - 1; SelectSpecialDateType(testData.InputData.SpecialDate[inputDataArrayPosition].Type, elementPosition); SelectStartMonth(testData.InputData.SpecialDate[inputDataArrayPosition].StartMonth, elementPosition); SelectStartDate(testData.InputData.SpecialDate[inputDataArrayPosition].StartDate, elementPosition); SelectEndMonth(testData.InputData.SpecialDate[inputDataArrayPosition].EndMonth, elementPosition); SelectEndDate(testData.InputData.SpecialDate[inputDataArrayPosition].EndDate, elementPosition); TimeManager.ShortPause(); } }
public void AddWorkdayCancelled(WorkdayCalendarData testData) { //Click '+ Calendar' button. TimeSettingsWorkday.PrepareToAddWorkdayCalendar(); TimeManager.ShortPause(); //Click "Cancel" button directly without any input. TimeSettingsWorkday.ClickCancelButton(); TimeManager.ShortPause(); //Click '+ Calendar' button again TimeSettingsWorkday.PrepareToAddWorkdayCalendar(); TimeManager.ShortPause(); //Input valid input TimeSettingsWorkday.FillInName(testData.InputData.CommonName); //Click "Cancel" button TimeSettingsWorkday.ClickCancelButton(); TimeManager.ShortPause(); //verify that the addition is cancelled and NOT exists in the list. Assert.IsFalse(TimeSettingsWorkday.IsCalendarExist(testData.InputData.CommonName)); Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsFalse(TimeSettingsWorkday.IsCancelButtonDisplayed()); //Click '+ Calendar' button again TimeSettingsWorkday.PrepareToAddWorkdayCalendar(); TimeManager.ShortPause(); //verify that the previous input has been cleared. Assert.AreEqual(testData.ExpectedData.CommonName, TimeSettingsWorkday.GetNameValue()); //Click "Cancel" button TimeSettingsWorkday.ClickCancelButton(); TimeManager.ShortPause(); Assert.IsFalse(TimeSettingsWorkday.IsCancelButtonDisplayed()); }
public void ModifyTimeRange(WorkdayCalendarData testData) { //Select a calendar which has special date ranges. TimeSettingsWorkday.SelectCalendar(testData.InputData.CommonName); TimeManager.ShortPause(); //Click 'Modify' button. TimeSettingsWorkday.ClickModifyButton(); TimeManager.ShortPause(); //Change the type of 时间1 to be '非工作日' TimeSettingsWorkday.SelectSpecialDateType(testData.ExpectedData.SpecialDate[0].Type, 1); //Change the end date of 范围1 TimeSettingsWorkday.SelectEndDate(testData.ExpectedData.SpecialDate[0].EndDate, 1); //Change the end month of 范围2 TimeSettingsWorkday.SelectEndMonth(testData.ExpectedData.SpecialDate[1].EndMonth, 2); //Change the start month, start date of 范围3 TimeSettingsWorkday.SelectStartMonth(testData.ExpectedData.SpecialDate[2].StartMonth, 3); TimeSettingsWorkday.SelectStartDate(testData.ExpectedData.SpecialDate[2].StartDate, 3); //Change the start month, start date of 范围4 TimeSettingsWorkday.SelectStartMonth(testData.ExpectedData.SpecialDate[3].StartMonth, 4); TimeSettingsWorkday.SelectStartDate(testData.ExpectedData.SpecialDate[3].StartDate, 4); //Change the start date of 范围5 TimeSettingsWorkday.SelectStartDate(testData.ExpectedData.SpecialDate[4].StartDate, 5); //Click 'Save' button TimeSettingsWorkday.ClickSaveButton(); JazzMessageBox.LoadingMask.WaitLoading(); //Verify modification is saved successfully. Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsModifyButtonDisplayed()); }
public void AddValidWorkday(WorkdayCalendarData testData) { //Click '+ Calendar' button. TimeSettingsWorkday.PrepareToAddWorkdayCalendar(); TimeManager.ShortPause(); //Verify the label text Assert.IsTrue(TimeSettingsWorkday.IsWorkdayCalendarTextCorrect(testData.ExpectedData.LabelText)); //Input valid name TimeSettingsWorkday.FillInName(testData.InputData.CommonName); //Add special dates (including type and time range). TimeSettingsWorkday.AddSpecialDates(testData); //Click "Save" button TimeSettingsWorkday.ClickSaveButton(); TimeManager.MediumPause(); JazzMessageBox.LoadingMask.WaitLoading(); //Verify saved successfully. Assert.IsFalse(TimeSettingsWorkday.IsSaveButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsModifyButtonDisplayed()); Assert.IsTrue(TimeSettingsWorkday.IsCalendarExist(testData.ExpectedData.CommonName)); //Verify special dates are added successfully. Assert.AreEqual(testData.InputData.SpecialDate.Length, TimeSettingsWorkday.GetSpecialDateItemsNumber()); for (int elementPosition = 1; elementPosition <= testData.InputData.SpecialDate.Length; elementPosition++) { int inputDataArrayPosition = testData.InputData.SpecialDate.Length - elementPosition; Assert.AreEqual(testData.InputData.SpecialDate[inputDataArrayPosition].Type, TimeSettingsWorkday.GetSpecialDateTypeValue(elementPosition)); Assert.AreEqual(testData.InputData.SpecialDate[inputDataArrayPosition].StartMonth, TimeSettingsWorkday.GetStartMonthValue(elementPosition)); Assert.AreEqual(testData.InputData.SpecialDate[inputDataArrayPosition].StartDate, TimeSettingsWorkday.GetStartDateValue(elementPosition)); Assert.AreEqual(testData.InputData.SpecialDate[inputDataArrayPosition].EndMonth, TimeSettingsWorkday.GetEndMonthValue(elementPosition)); Assert.AreEqual(testData.InputData.SpecialDate[inputDataArrayPosition].EndDate, TimeSettingsWorkday.GetEndDateValue(elementPosition)); } }