public void ClosePage() { string current = SeleniumHelper.GetParentTab(); SeleniumHelper.CloseTab(); SeleniumHelper.SwitchToNewTab(current); }
public void CloseTopicTab() { SeleniumHelper.CloseTab(); SeleniumHelper.SwitchToNewTab(parentPage); Refresh(); }
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 VerifyPreserveFunctionalityOfAttendancePattern(string startDate, string endDate, string yeargroup, string pupilForeName, string pupilSurName, string pupilName, string MonAM, string MonPM, string TueAM, string TuePM, 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.NavigateToAttendancePattern(); var attendancePattern = new AttendancePatternDialog(); attendancePattern.IsPreserve = true; attendancePattern.StartDate = startDate; attendancePattern.EndDate = endDate; // Click on Add Pupil link var addPupilsDialogTriplet = attendancePattern.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(); // Add data into Pattern table var patternRow = attendancePattern.Table[0]; patternRow.MonAM = MonAM; patternRow.MonPM = MonPM; patternRow.TueAM = TueAM; patternRow.TuePM = TuePM; var confirmRequiredDialog1 = attendancePattern.ClickApply(); confirmRequiredDialog1.ClickApplyThisPattern(); attendancePattern.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 }
public void TC_ATT07_Validate_Deal_with_Chosen_Code_functionality(string foreName, string surName, string gender, string DOB, string dateOfAdmission, string yearGroup, string className, string academicYear, string searchMark) { SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator); #region Pre-Condition //Navigate to Pupil Record SeleniumHelper.NavigateQuickLink("Pupil Records"); var pupilRecords = new PupilRecordTriplet(); //Add new pupil var addNewPupilDialog = pupilRecords.AddNewPupil(); addNewPupilDialog.Forename = foreName; addNewPupilDialog.SurName = surName; addNewPupilDialog.Gender = gender; addNewPupilDialog.DateOfBirth = DOB; var registrationDetailDialog = addNewPupilDialog.Continue(); registrationDetailDialog.DateOfAdmission = dateOfAdmission; registrationDetailDialog.YearGroup = yearGroup; registrationDetailDialog.ClassName = className; registrationDetailDialog.CreateRecord(); var confirmRequiredDialog = new ConfirmRequiredDialog(); confirmRequiredDialog.ClickOk(); //Save pupil //var pupilRecord = PupilRecordPage.Create(); //pupilRecord.SavePupil(); SeleniumHelper.CloseTab("Pupil Record"); #endregion #region Test steps //Navigate to Deal with Chosen SeleniumHelper.NavigateMenu("Tasks", "Attendance", "Deal with Specific Marks"); var dealwithCodes = new DealWithSpecifcMarksTriplet(); //Select Search Criteria dealwithCodes.SearchCriteria.SelectAcademicYear = academicYear; dealwithCodes.SearchCriteria.SelectMark = searchMark; dealwithCodes.SearchCriteria.YearGroup = "Year 2"; var dealChosenCode = dealwithCodes.SearchCriteria.Search <DealWithSpecificMarkPage>(); //Input by keyboard dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][1].Marks = "/"; dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][2].Marks = "\\"; dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][3].Marks = "/"; //Input by drop-down dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][4].MarkDropDown = "A"; dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][5].MarkDropDown = "C"; //Save dealChosenCode.Save(); //Verify input marksRow = dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)]; Assert.AreEqual("/", marksRow[1].Marks, "Cannot input by keyboard"); Assert.AreEqual("\\", marksRow[2].Marks, "Cannot input by keyboard"); Assert.AreEqual("/", marksRow[3].Marks, "Cannot input by keyboard"); Assert.AreEqual("A", marksRow[4].Marks, "Cannot input by dropdown"); Assert.AreEqual("C", marksRow[5].Marks, "Cannot input by dropdown"); Assert.AreEqual("A", marksRow[6].Marks, "Cannot input by code list"); Assert.AreEqual("B", marksRow[7].Marks, "Cannot input by code list"); Assert.AreEqual("C", marksRow[8].Marks, "Cannot input by code list"); //Verify can edit in mode overwrite dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][1].MarkDropDown = "A"; Assert.AreEqual("A", dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][1].Text, "Mark cannot be edit in overwrite mode by dropdown"); dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][2].Select(); dealChosenCode.Code = "B"; Assert.AreEqual("B", dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][2].Text, "Mark cannot be edit in overwrite mode by select from code list"); //Verify cannot edit with invalid value dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][3].Marks = "T"; Assert.AreEqual("/", dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][3].Text, "Mark can be edit with invalid value by keyboard"); //Add comment var addComment = dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][1].AddComment(); addComment.Comment = "Test Comment"; addComment.ClickOk(); //Save dealChosenCode.Save(); //Verify comment dealChosenCode = dealChosenCodes.SearchCriteria.Search <DealWithChosenPage>(); addComment = dealChosenCode.Marks[String.Format("{0}, {1}", surName, foreName)][1].AddComment(); Assert.AreEqual("Test Comment", addComment.Comment, "Can not add comment in Deal with Chosen code page"); addComment.ClickCancel(); //Verify mark of Edit Mark page SeleniumHelper.NavigateQuickLink("Edit Marks"); var editMarkTriplet = new EditMarksTriplet(); editMarkTriplet.SearchCriteria.Week = true; editMarkTriplet.SearchCriteria.SelectClass(className); editMarkTriplet.SearchCriteria.SelectYearGroup(yearGroup); var editMarks = editMarkTriplet.SearchCriteria.Search <EditMarksPage>(); var marks = editMarks.Marks[String.Format("{0}, {1}", surName, foreName)]; Assert.AreEqual("A", marks[1].Text, "Change in Deal Chosen Screen is not record"); Assert.AreEqual("B", marks[2].Text, "Change in Deal Chosen Screen is not record"); Assert.AreEqual("/", marks[3].Text, "Change in Deal Chosen Screen is not record"); Assert.AreEqual("A", marks[4].Text, "Change in Deal Chosen Screen is not record"); Assert.AreEqual("C", marks[5].Text, "Change in Deal Chosen Screen is not record"); Assert.AreEqual("A", marks[6].Text, "Change in Deal Chosen Screen is not record"); Assert.AreEqual("B", marks[7].Text, "Change in Deal Chosen Screen is not record"); Assert.AreEqual("C", marks[8].Text, "Change in Deal Chosen Screen is not record"); #endregion }