public void ShouldhaveValidationWarningMessage_if_NoPupil_Or_MarkSelected() { SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator); AttendanceNavigations.NavigateToApplyMarkOverDateRange(); var applyMarkOverDateRange = new ApplyMarksOverDateRangeDialog(); applyMarkOverDateRange.IsPreserve = true; applyMarkOverDateRange.StartDate = SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString(); applyMarkOverDateRange.EndDate = SeleniumHelper.GetFirstDayOfWeek(DateTime.Now).ToShortDateString(); applyMarkOverDateRange.ClickApplyThisMark(); Assert.IsTrue(applyMarkOverDateRange.IsValidationWarningDisplayed()); }
public void TC_ATT002_EnterMarksOVerDateRange(string fullName, string sureName, string foreName, string classesData, string mark, string academicYear) { #region PRE-CONDITIONS: SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator); SeleniumHelper.NavigateMenu("Tasks", "Attendance", "Edit Marks"); var editMarksTripletPage = new EditMarksTriplet(); editMarksTripletPage.SearchCriteria.Week = true; editMarksTripletPage.SearchCriteria.SelectClass("1A"); var editMarksPage = editMarksTripletPage.SearchCriteria.Search <EditMarksPage>(); editMarksPage.ModePreserve = false; var marks = editMarksPage.Marks; marks[fullName][1].Text = String.Empty; marks[fullName][2].Text = String.Empty; marks[fullName][3].Text = String.Empty; marks[fullName][4].Text = String.Empty; marks[fullName][5].Text = String.Empty; marks[fullName][6].Text = String.Empty; marks[fullName][7].Text = String.Empty; marks[fullName][8].Text = String.Empty; marks[fullName][9].Text = String.Empty; marks[fullName][10].Text = String.Empty; editMarksPage.SaveConfirmDelete(true); SeleniumHelper.CloseTab("Edit Marks"); #endregion #region STEPS: //Navigate to Apply Marks Over Date Range page SeleniumHelper.NavigateMenu("Tasks", "Attendance", "Apply Marks Over Date Range"); var applyMarksOverDateRange = new ApplyMarksOverDateRangeDialog(); applyMarksOverDateRange.IsPreserve = true; //Click on Add Pupil Link var addPupilsDialogTriplet = applyMarksOverDateRange.AddPupil(); // Select some options addPupilsDialogTriplet.SearchCriteria.SearchByPupilName = String.Format("{0}, {1}", sureName, foreName); var addPupilDialogSearchPage = addPupilsDialogTriplet.SearchCriteria; var classes = addPupilDialogSearchPage.Classes; classes[classesData].Select = true; // Search and select a pupil var addPupilsDetailsPage = addPupilDialogSearchPage.Search <AddPupilsDetailsPage>(); addPupilsDetailsPage.Pupils.FirstOrDefault(x => x.Text.Trim().Equals(String.Format("{0}, {1}", sureName, foreName))).Click();; addPupilsDetailsPage.AddSelectedPupils(); // Click on OK button addPupilsDialogTriplet.ClickOk(); //Select Academic Year and Code from the dropdown applyMarksOverDateRange.SelectAcademicYear = academicYear; applyMarksOverDateRange.SelectMark = mark; //Apply Marks var confirmRequiredDialog = applyMarksOverDateRange.ClickApply(); confirmRequiredDialog.ClickOk(); applyMarksOverDateRange.ClosePatternDialog(); // Navigate to Edit marks SeleniumHelper.NavigateMenu("Tasks", "Attendance", "Edit Marks"); var editmarkTriplet = new EditMarksTriplet(); editmarkTriplet.SearchCriteria.Week = true; editmarkTriplet.SearchCriteria.SelectClass("1A"); editMarksPage = editmarkTriplet.SearchCriteria.Search <EditMarksPage>(); var editMarksTable = editMarksPage.Marks; //Verify that Pattern is applied successfully var marksRow = editMarksPage.Marks[String.Format("{0}, {1}", sureName, foreName)]; Assert.AreEqual(marksRow[1].Text, "Mark has applied to Monday AM"); Assert.AreEqual(marksRow[2].Text, "Mark has applied to Monday PM"); Assert.AreEqual(marksRow[3].Text, "Mark has applied to Tuesday AM"); Assert.AreEqual(marksRow[4].Text, "Mark has applied to Tuesday PM"); Assert.AreEqual(marksRow[5].Text, "Mark has applied to Wednesday AM"); Assert.AreEqual(marksRow[6].Text, "Mark has applied to Wednesday PM"); Assert.AreEqual(marksRow[7].Text, "Mark has applied to Thursday AM"); Assert.AreEqual(marksRow[8].Text, "Mark has applied to Thursday PM"); Assert.AreEqual(marksRow[9].Text, "Mark has applied to Friday AM"); Assert.AreEqual(marksRow[10].Text, "Mark has applied to Friday AM"); #endregion }
public void VerifyPreserveFunctionalityOfApplyMarkOverDateRange(string startDate, string endDate, string yeargroup, string pupilForeName, string pupilSurName, string pupilName, string Mark, string mark1, string mark2, string dateOfBirth, string DateOfAdmission) { #region Data Preperation DateTime dobSetup = Convert.ToDateTime(dateOfBirth); DateTime dateOfAdmissionSetup = Convert.ToDateTime(DateOfAdmission); var learnerIdSetup = Guid.NewGuid(); var BuildPupilRecord = this.BuildDataPackage(); BuildPupilRecord.CreatePupil(learnerIdSetup, pupilSurName, pupilForeName, dobSetup, dateOfAdmissionSetup, yeargroup); DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: BuildPupilRecord); SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator); Wait.WaitForDocumentReady(); AutomationSugar.NavigateMenu("Tasks", "Attendance", "Edit Marks"); Wait.WaitLoading(); var editMarksTripletPage = new EditMarksTriplet(); editMarksTripletPage.SearchCriteria.StartDate = startDate; editMarksTripletPage.SearchCriteria.Week = true; editMarksTripletPage.SearchCriteria.SelectYearGroup(yeargroup); var editMarksPage = editMarksTripletPage.SearchCriteria.Search <EditMarksPage>(); editMarksPage.ModePreserve = false; editMarksPage.ModeHorizontal = true; var editmarkTable = editMarksPage.Marks; IEnumerable <SchoolAttendanceCode> attendanceNotRequiredCodes = Queries.GetAttendanceNotRequiredCodes(); List <string> codes = attendanceNotRequiredCodes.Select(x => x.Code).ToList <string>(); if (codes.Contains(editmarkTable[pupilName][2].Text)) { Console.WriteLine("Marks can't be overwritten on Attendance Not Required Codes"); return; } var oldMarkAM = editmarkTable[pupilName][2].Text = mark1; var oldMarkPM = editmarkTable[pupilName][3].Text = mark2; var BlankMarkAM = editmarkTable[pupilName][4].Text = String.Empty; var BlankMarkPM = editmarkTable[pupilName][5].Text = String.Empty; editMarksPage.ClickSave(); SeleniumHelper.CloseTab("Edit Marks"); #endregion #region STEPS AttendanceNavigations.NavigateToApplyMarkOverDateRange(); var applyMarkOverDateRange = new ApplyMarksOverDateRangeDialog(); applyMarkOverDateRange.IsPreserve = true; applyMarkOverDateRange.StartDate = startDate; applyMarkOverDateRange.EndDate = endDate; applyMarkOverDateRange.SelectMark = Mark; // Click on Add Pupil link var addPupilsDialogTriplet = applyMarkOverDateRange.AddPupil(); // Select some options addPupilsDialogTriplet.SearchCriteria.SearchByPupilName = String.Format("{0}, {1}", pupilSurName, pupilForeName); var addPupilDialogSearchPage = addPupilsDialogTriplet.SearchCriteria; // Search and select a pupil var addPupilsDetailsPage = addPupilDialogSearchPage.Search <AddPupilsDetailsPage>(); addPupilsDetailsPage.AddAllPupils(); // Click on OK button addPupilsDialogTriplet.ClickOk(); var confirmRequiredDialog1 = applyMarkOverDateRange.ClickApply(); confirmRequiredDialog1.ClickApplyThisMark(); applyMarkOverDateRange.ClosePatternDialog(); //Navigate to Edit marks & Click on Search AutomationSugar.NavigateMenu("Tasks", "Attendance", "Edit Marks"); var editmarkTriplet = new EditMarksTriplet(); editmarkTriplet.SearchCriteria.StartDate = startDate; editmarkTriplet.SearchCriteria.Week = true; editmarkTriplet.SearchCriteria.SelectYearGroup(yeargroup); editMarksPage = editmarkTriplet.SearchCriteria.Search <EditMarksPage>(); var editMarksTable1 = editMarksPage.Marks; //Verfiy Preserve functionality Assert.AreEqual(oldMarkAM, editMarksTable1[pupilName][2].Text, "For Existing records, Marks can't be overwritten in Preserve Mode"); Assert.AreEqual(oldMarkPM, editMarksTable1[pupilName][3].Text, "For Existing records, Marks can't be overwritten in Preserve Mode"); Assert.AreNotEqual(BlankMarkAM, editMarksTable1[pupilName][4].Text, "For Blank records, Mark can be overwritten in Preserve Mode"); Assert.AreNotEqual(BlankMarkPM, editMarksTable1[pupilName][5].Text, "For Blank record, Mark can be overwritten in Preserve Mode"); #endregion }