public void EditMarks_Register_And_Verify_InsetDay_Functionality(string academicYearName, Dictionary <string, DateTime> Inset) { // #region Data Preperation SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator); Wait.WaitForDocumentReady(); AutomationSugar.NavigateMenu("Tasks", "School Management", "Academic Years"); Wait.WaitLoading(); var academicYearTriplet = new AcademicYearTriplet(); var academicYearResult = academicYearTriplet.SearchCriteria.Search(); var academicYearTarget = academicYearResult.FirstOrDefault(p => p.AcademicYear.Contains(academicYearName)); academicYearTarget.Click(); var academicYearDetailPage = new AcademicYearDetailPage(); // Inset Day academicYearDetailPage.ClickInsetDayLink(); academicYearDetailPage.InsetDayTable.GetLastRow().Name = "InsetDay"; academicYearDetailPage.InsetDayTable.GetLastRow().Date = Inset["InsetDay"].Date.ToShortDateString(); academicYearDetailPage.InsetDayTable.GetLastRow().AM = true; academicYearDetailPage.InsetDayTable.GetLastRow().PM = true; academicYearDetailPage.Save(); if (academicYearDetailPage.IsValidationMessageDisplay()) { Console.WriteLine("Can't have duplicate inset day for the same date range"); return; } AutomationSugar.NavigateMenu("Tasks", "Attendance", "Edit Marks"); var editMarksTripletPage = new EditMarksTriplet(); editMarksTripletPage.SearchCriteria.StartDate = Inset["InsetDay"].Date.ToShortDateString(); editMarksTripletPage.SearchCriteria.Day = true; editMarksTripletPage.SearchCriteria.SelectYearGroup("Year 1"); var editMarksPage = editMarksTripletPage.SearchCriteria.Search <EditMarksPage>(); var editmarkTable = editMarksPage.Marks; if (editMarksPage.IsValidationMessageDisplay()) { Console.WriteLine("It's Non-working Day"); return; } IEnumerable <SchoolAttendanceCode> getHolidays = Queries.GetHolidays(); List <string> codes = getHolidays.Select(x => x.Code).ToList <string>(); if (codes.Contains(editmarkTable[1][2].Text)) { Console.WriteLine("Marks can't be overwritten on Holidays"); return; } IEnumerable <SchoolAttendanceCode> getInsetDays = Queries.GetInsetDay(); List <string> inset = getInsetDays.Select(d => d.Code).ToList <string>(); Assert.That(inset[0].Equals(editmarkTable[1][2].Text), "For Existing records, Marks InsetDay can't be applied"); #region : Post-Condition : Delete Inset Day AutomationSugar.NavigateMenu("Tasks", "School Management", "Academic Years"); //Wait.WaitLoading(); var academicYearTriplet1 = new AcademicYearTriplet(); var academicYearResult1 = academicYearTriplet1.SearchCriteria.Search(); var academicYearTarget1 = academicYearResult1.FirstOrDefault(p => p.AcademicYear.Contains(academicYearName)); academicYearTarget1.Click(); var academicYearDetail1 = new AcademicYearDetailPage(); academicYearDetail1.InsetDayTable.DeleteRowIfExist(academicYearDetail1.InsetDayTable.Rows.FirstOrDefault(x => Convert.ToDateTime(x.Date, CultureInfo.InvariantCulture) == Convert.ToDateTime(Inset["InsetDay"], CultureInfo.InvariantCulture).Date)); academicYearDetail1.Save(); #endregion }
public void EditMarks_Register_And_Verify_SchoolHoliday_Functionality(string academicYearName, string schoolHoliday, DateTime[] SchoolHoliday) { //#region Data Preperation SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator); Wait.WaitForDocumentReady(); AutomationSugar.NavigateMenu("Tasks", "School Management", "Academic Years"); Wait.WaitLoading(); var academicYearTriplet = new AcademicYearTriplet(); var academicYearResult = academicYearTriplet.SearchCriteria.Search(); var academicYearTarget = academicYearResult.FirstOrDefault(p => p.AcademicYear.Contains(academicYearName)); academicYearTarget.Click(); var academicYearDetailPage = new AcademicYearDetailPage(); // School Holiday academicYearDetailPage.ClickAddSchoolHolidayLink(); academicYearDetailPage.SchoolHolidayTable.GetLastRow().Name = schoolHoliday; academicYearDetailPage.SchoolHolidayTable.GetLastRow().StartDate = SchoolHoliday[0].ToShortDateString(); academicYearDetailPage.SchoolHolidayTable.GetLastRow().EndDate = SchoolHoliday[1].ToShortDateString(); academicYearDetailPage.Save(); if (academicYearDetailPage.IsValidationMessageDisplay()) { Console.WriteLine("Can't have duplicate Holidays day for the same date range"); return; } AutomationSugar.NavigateMenu("Tasks", "Attendance", "Edit Marks"); var editMarksTripletPage = new EditMarksTriplet(); editMarksTripletPage.SearchCriteria.StartDate = SchoolHoliday[0].ToShortDateString(); editMarksTripletPage.SearchCriteria.Day = true; editMarksTripletPage.SearchCriteria.SelectYearGroup("Year 1"); var editMarksPage = editMarksTripletPage.SearchCriteria.Search <EditMarksPage>(); var editmarkTable = editMarksPage.Marks; if (editMarksPage.IsValidationMessageDisplay()) { Console.WriteLine("It's Non-working Day"); return; } Assert.AreEqual("#", editmarkTable[1][2].Text, "For Existing records, Marks InsetDay can't be applied"); #region : Post-Condition : Delete Public HoliDay AutomationSugar.NavigateMenu("Tasks", "School Management", "Academic Years"); var academicYearTriplet1 = new AcademicYearTriplet(); var academicYearResult1 = academicYearTriplet1.SearchCriteria.Search(); var academicYearTarget1 = academicYearResult1.FirstOrDefault(p => p.AcademicYear.Contains(academicYearName)); academicYearTarget1.Click(); var academicYearDetail1 = new AcademicYearDetailPage(); academicYearDetail1.PublicHolidayTable.DeleteRowIfExist(academicYearDetail1.PublicHolidayTable.Rows.FirstOrDefault(x => Convert.ToDateTime(x.Date, CultureInfo.InvariantCulture) == Convert.ToDateTime(SchoolHoliday[0], CultureInfo.InvariantCulture).Date)); academicYearDetail1.Save(); #endregion }