public void Can_Update_ApplicationStatus_As_Keyboard_Entries()
        {
            //Arrange
            DataPackage dataPackage = GetApplicationStatusDataPackage();

            using (new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage))
            {
                //Act
                NavigateAndSetupCriteriaAndDoTheSearchAndGetDetail();
                ApplicationStatusDetail.ScrollToApplicationStatus();
                ApplicationStatusDetail.ClickFirstCellofColumn(ApplicationStatusDetail.ApplicationStatusDefaultColumnNumber);
                ApplicationStatusDetail.GetEditor().SendKeys("Withdrawn");
                ApplicationStatusDetail.GetEditor().SendKeys(Keys.Down);
                ApplicationStatusDetail.GetEditor().SendKeys(Keys.Enter);
                //                ApplicationStatusDetail.ClickFirstCellofColumn("1");
                //                ApplicationStatusDetail.ScrollToApplicantName();

                //Assert and Verify
                AutomationSugar.Log("Verify the first cell update");
                List <IWebElement> cells = (ApplicationStatusDetail.FindcellsForColumn(ApplicationStatusDetail.ApplicationStatusDefaultColumnNumber));

                string expected = "Withdrawn";
                string actual   = cells[0].Text;

                Assert.AreEqual(expected, actual);
            }
        }
        public void Can_Update_ApplicationStatus_As_Mouse_Clicks()
        {
            //Arrange
            DataPackage dataPackage = GetApplicationStatusDataPackage();

            using (new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage))
            {
                //Act
                ApplicationStatusDetail appDetail = NavigateAndSetupCriteriaAndDoTheSearchAndGetDetail();
                ApplicationStatusDetail.ScrollToApplicationStatus();
                ApplicationStatusDetail.ClickFirstCellofColumn(ApplicationStatusDetail.ApplicationStatusDefaultColumnNumber);

                //IWebElement dropDown = SeleniumHelper.Get(ApplicationStatusDetail.ApplicationStatusSelector);
                //SeleniumHelper.ScrollToByAction(dropDown);
                //Thread.Sleep(TimeSpan.FromSeconds(2));
                //dropDown.Click();

                appDetail.SetCellApplicationStatusDropDown("Rejected");

                //Assert and Verify
                AutomationSugar.Log("Verify the results");
                List <IWebElement> cells = (ApplicationStatusDetail.FindcellsForColumn(ApplicationStatusDetail.ApplicationStatusDefaultColumnNumber));

                string expected = "Rejected";
                string actual   = cells[0].Text;

                Assert.AreEqual(expected, actual);
            }
        }
Exemplo n.º 3
0
        public void SearchCurrentPupilByName(string textForSearch)
        {
            #region Data Pupil Setup

            #region Create a new pupil, so that it can be attached later to the newly created contact1

            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "TestData_Pupil");
            var         pupilForename = Utilities.GenerateRandomString(10, "Forename_TestData_Pupil" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 10, 01), new DateTime(2012, 08, 01));

            #endregion
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);


            #endregion

            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.EnterSearchTextForPupilContacts(textForSearch);
            double millisecs = searchBox.SearchTimeInMillisecs;
            searchBox.Log("Results fetched in " + millisecs + " milliseconds");
            Assert.Less(millisecs, AddressBookConstants.MaxAcceptableSearchTimeInMillisecs);
        }
Exemplo n.º 4
0
        public void PromptToSaveChangesOnNavigationToOtherScreen()
        {
            #region Data Pupil Setup

            #region Create a new pupil, so that it can be attached later to the newly created contact1

            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "LinkForPupil2");
            var         pupilForename = Utilities.GenerateRandomString(10, "LinkForPupil2" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 10, 01), new DateTime(2012, 08, 01));

            #endregion
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);


            #endregion

            SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            NavigateToOtherScreen.GoToRoomScreen();
            RoomPage SchoolRoomPage = new RoomPage();
            SchoolRoomPage.CreateSchoolRoom();
            SchoolRoomPage.EnterShortName("Rm60");
            AddressBookSearchPage searchBox = new AddressBookSearchPage();
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupils(pupilForename);
            AddressBookPopup popup = searchBox.ClickOnFirstPupilRecord();
            popup.ClickPupilDetailsLink();
            popup.WaitForConfirmationDialogToAppear();
            WebContext.Screenshot();
            bool DialogDisplayed = SeleniumHelper.Get("save_continue_commit_dialog").Displayed;
            Assert.IsTrue(DialogDisplayed, "Failure to popup confirmation Dialog");
        }
Exemplo n.º 5
0
        public void LinkToPupilRecordFromPupilInfo()
        {
            #region Data Pupil Setup

            #region Create a new pupil, so that it can be attached later to the newly created contact1

            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "LinkForPupil");
            var         pupilForename = Utilities.GenerateRandomString(10, "LinkForPupil" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 10, 01), new DateTime(2012, 08, 01));

            #endregion
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);


            #endregion

            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupils(pupilForename);
            AddressBookPopup popup = searchBox.ClickOnFirstPupilRecord();
            popup.ClickPupilDetailsLink();
            bool value = SeleniumHelper.Get(AddressBookElements.OpenedPupilRecordTab).Displayed;
            Assert.IsTrue(value);
        }
Exemplo n.º 6
0
        public void DisplayStaffAddressDetails(string buildingNo, string street, string district, string city,
                                               string postCode, string countryPostCode, string language, string placeOfWork,
                                               string jobTitle, string occupation, string priority, string relationship)
        {
            #region Arrange
            var staffId   = Guid.NewGuid();
            var forename  = SeSugar.Utilities.GenerateRandomString(10, "Staff_AddressBook_address");
            var surname   = SeSugar.Utilities.GenerateRandomString(10, "Staff_AddressBook_address");
            var startDate = DateTime.Today.AddDays(-1);

            var       staffRecordData = StaffRecordPage.CreateStaffRecord(out staffId, forename, surname, startDate);
            DataSetup DataSetStaff    = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: staffRecordData);

            #endregion

            SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.PersonnelOfficer);
            AutomationSugar.NavigateMenu("Tasks", "Staff", "Staff Records");
            POM.Helper.Wait.WaitLoading();
            var staffContactTriplet = new StaffRecordTriplet();
            staffContactTriplet.SearchCriteria.StaffName = String.Format("{0}, {1}", surname, forename);
            //staffContactTriplet.SearchCriteria.Search();
            //staffContactTriplet.SearchCriteria.Search();
            var resultPupils = staffContactTriplet.SearchCriteria.Search();
            int count        = resultPupils.Count();
            if (count == 1)
            {
                var staffSearchTile = resultPupils.FirstOrDefault(t => t.Name.Equals(String.Format("{0}, {1}", surname, forename)));
                var staffRecord     = staffSearchTile == null ? null : staffSearchTile.Click <StaffRecordPage>();
                staffSearchTile.Click <StaffRecordPage>();


                staffRecord.SelectAddressesTab();
                var addAddressDialog = staffRecord.ClickAddAddress();
                addAddressDialog.ClickManualAddAddress();
                // Add new address
                addAddressDialog.BuildingNo      = buildingNo;
                addAddressDialog.Street          = street;
                addAddressDialog.District        = district;
                addAddressDialog.City            = city;
                addAddressDialog.PostCode        = postCode;
                addAddressDialog.CountryPostCode = countryPostCode;
                addAddressDialog.ClickOk();
                AutomationSugar.Log("Created a new address to the staff record");
                staffContactTriplet.ClickSave();
            }

            AddressBookSearchPage searchBox = new AddressBookSearchPage();
            searchBox.ClearText();
            searchBox.EnterSearchTextForStaff(surname);
            searchBox.ClickOnFirstStaffRecord();
            AddressBookPopup popup = new AddressBookPopup();
            popup.GetStaffBasicDetails();
            Assert.IsTrue(popup.IsAddressDisplayed());
        }
        public void Can_Delete_ApplicationStatus_In_BulkUpdate_Screen()
        {
            //Arrange
            DataPackage dataPackage = GetApplicationStatusDataPackage();

            using (new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage))
            {
                //Act
                ApplicationStatusDetail appDetail = NavigateAndSetupCriteriaAndDoTheSearchAndGetDetail();
                AutomationSugar.Log("Delete all the previously flood filled application status");
                appDetail.DeleteApplicationStatusColumnValues();

                //Assert
                AutomationSugar.Log("Verify application status");
                Assert.IsTrue(hasGridResultsSuceeded(ApplicationStatusDetail.ApplicationStatusDefaultColumnNumber, string.Empty));
            }
        }
Exemplo n.º 8
0
        public void Can_FloodFill_ApplicationStatus_In_BulkUpdate_Screen()
        {
            //Arrange
            DataPackage dataPackage = GetApplicationStatusDataPackage();

            using (new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage))
            {
                //Act
                ApplicationStatusDetail appDetail = NavigateAndSetupCriteriaAndDoTheSearchAndGetDetail();
                AutomationSugar.Log("Flood fill the application status column");
                appDetail.FloodFillApplicationStatusColumnWith("Reserved");

                //Assert
                AutomationSugar.Log("Verify the results");
                Assert.IsTrue(hasGridResultsSuceeded(ApplicationStatusDetail.ApplicationStatusDefaultColumnNumber, "Reserved"));
            }
        }
Exemplo n.º 9
0
        public void DisplayPupilContactBasicDetails()
        {
            #region Data Pupil Setup

            #region Create a new pupil, so that it can be attached later to the newly created contact1

            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "CurrentPUPIL");
            var         pupilForename = Utilities.GenerateRandomString(10, "CurrentPUPIL" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 10, 01), new DateTime(2012, 08, 01));

            #endregion

            #region Pre-Condition: Create new contact 1 and refer to pupil

            //Arrange
            AutomationSugar.Log("***Pre-Condition: Create new contact1 and refer to pupil");
            Guid pupilContactId1             = Guid.NewGuid();
            Guid pupilContactRelationshipId1 = Guid.NewGuid();
            //Add pupil contact
            var contactSurname1  = Utilities.GenerateRandomString(10, "PupilContact_WithBasicDetails" + Thread.CurrentThread.ManagedThreadId);
            var contactForename1 = Utilities.GenerateRandomString(10, "PupilContact_WithBasicDetails" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddPupilContact(pupilContactId1, contactSurname1, contactForename1);
            dataPackage.AddPupilContactRelationship(pupilContactRelationshipId1, pupilId, pupilContactId1);
            #endregion


            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);


            #endregion


            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupilContacts(contactForename1);
            searchBox.ClickOnFirstPupilContactRecord();
            AddressBookPopup popup = new AddressBookPopup();
            Assert.IsNotNull(AddressBookElements.DisplayPopup);
            Assert.IsTrue(popup.GetPupilContactBasicDetails());
        }
Exemplo n.º 10
0
        public void DisplayPupilContactAssociatedToPupilDetails()
        {
            #region Data Pupil Setup

            #region Create a new pupil, so that it can be attached later to the newly created contact1

            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "Communications_Surname");
            var         pupilForename = Utilities.GenerateRandomString(10, "Communications_Forename" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 01, 01), new DateTime(2012, 09, 01));

            #endregion

            #region Pre-Condition: Create new contact 1 and refer to pupil

            //Arrange
            AutomationSugar.Log("***Pre-Condition: Create new contact1 and refer to pupil");
            Guid pupilContactId1             = Guid.NewGuid();
            Guid pupilContactRelationshipId1 = Guid.NewGuid();
            //Add pupil contact
            var contactSurname1  = Utilities.GenerateRandomString(10, "SeleniumPupilContact1_Surname" + Thread.CurrentThread.ManagedThreadId);
            var contactForename1 = Utilities.GenerateRandomString(10, "SeleniumPupilContact1_Forename" + Thread.CurrentThread.ManagedThreadId);
            var titleContact1    = "Mrs";
            dataPackage.AddPupilContact(pupilContactId1, contactSurname1, contactForename1);
            dataPackage.AddPupilContactRelationship(pupilContactRelationshipId1, pupilId, pupilContactId1);
            #endregion


            #endregion

            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);

            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupils(pupilForename);
            AddressBookPopup popup = searchBox.ClickOnFirstPupilRecord();
            Assert.Greater(popup.HaveAssociatedPupil(), 1);
        }
        private ApplicationStatusDetail NavigateAndSetupCriteriaAndDoTheSearchAndGetDetail()
        {
            AutomationSugar.Log("Navigate to Application Status Bulk Update Screen");
            var bulkUpdateNavigation = new AdmissionsBulkUpdateNavigation();

            bulkUpdateNavigation.NavigateToBulkUpdateApplicationStatus(LoginAs);

            AutomationSugar.Log("Setup search criteria");
            var appStatusSearchScreen = new ApplicationStatusSearch();

            PageObjectModel.Helper.Wait.WaitForAjaxReady(By.ClassName("locking-mask-loading"));
            appStatusSearchScreen.AdmissionYear = _admissionYear;
            PageObjectModel.Helper.Wait.WaitForAjaxReady(By.ClassName("locking-mask"));
            appStatusSearchScreen.IntakeGroup = _schoolIntakeName;
            PageObjectModel.Helper.Wait.WaitForAjaxReady(By.ClassName("locking-mask"));
            appStatusSearchScreen.AdmissionGroup = _admissionGroupName;
            PageObjectModel.Helper.Wait.WaitForAjaxReady(By.ClassName("locking-mask"));
            AutomationSugar.Log("Do search");
            ApplicationStatusDetail detail    = appStatusSearchScreen.ClickOnSearch();
            ApplicationStatusDetail appDetail = new ApplicationStatusDetail();

            return(appDetail);
        }
Exemplo n.º 12
0
        public void DisplayPupilBasicDetailsOnEnter()
        {
            #region Data Pupil Setup

            #region Create a new pupil, so that it can be attached later to the newly created contact1

            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "PupilEnterKey_Test");
            var         pupilForename = Utilities.GenerateRandomString(10, "PupilEnterKey_Test" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 10, 01), new DateTime(2012, 08, 01));

            #endregion
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);

            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupils("PupilEnterKey_Test");
            searchBox.HitEnteronFirstPupilRecord();
            AddressBookPopup popup = new AddressBookPopup();
            popup.WaitForDialogToAppear();
            Assert.IsTrue(popup.GetPupilBasicDetails());
        }
Exemplo n.º 13
0
        private DataPackage GetDataPackage(string suffix, int sleep)
        {
            lock (_lockObject)
            {
                Thread.Sleep(TimeSpan.FromSeconds(sleep));
                var dataPackage = this.BuildDataPackage();
                //Create School NC Year
                schoolNCYearId = Guid.NewGuid();
                dataPackage.AddSchoolNCYearLookup(schoolNCYearId);
                //Create YearGroup and its set memberships
                yearGroupId = Guid.NewGuid();
                var yearGroupShortName = Utilities.GenerateRandomString(3, "SN");
                yearGroupFullName = Utilities.GenerateRandomString(10, "FN");
                dataPackage.AddYearGroupLookup(yearGroupId, schoolNCYearId, yearGroupShortName, yearGroupFullName, 1);

                //Create first pupil
                Guid pupilId            = Guid.NewGuid();
                Guid learnerEnrolmentId = Guid.NewGuid();
                Guid applicantId        = Guid.NewGuid();
                var  pupilSurname       = Utilities.GenerateRandomString(10, "TestPupil1_Surname" + suffix);
                var  pupilForename      = Utilities.GenerateRandomString(10, "TestPupil1_Forename" + suffix);

                contactSurname1 = Utilities.GenerateRandomString(10, "TestPupilContact1_Surname" + suffix);
                var contactForename1 = Utilities.GenerateRandomString(10, "TestPupilContact1_Forename" + suffix);
                var contactForename2 = Utilities.GenerateRandomString(10, "TestPupilContact2_Forename" + suffix);

                FirstSalutationName = string.Format("Mr {0}", contactSurname1);
                FirstAddresseeName  = string.Format("Mr {0} {1}", contactForename1[0], contactSurname1);

                dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2010, 01, 01),
                                            new DateTime(2015, 09, 01), enrolStatus: "C", uniqueLearnerEnrolmentId: learnerEnrolmentId,
                                            salutation: FirstSalutationName, addressee: FirstAddresseeName, yearGroupId: yearGroupId,
                                            schoolNCYearId: schoolNCYearId);

                #region Pre-Condition: Create new contact 1 and refer to pupil

                //Arrange
                AutomationSugar.Log("Create new contact1 and refer to pupil");
                Guid pupilContactId1             = Guid.NewGuid();
                Guid pupilContactRelationshipId1 = Guid.NewGuid();
                //Add pupil contact
                dataPackage.AddPupilContact(pupilContactId1, contactSurname1, contactForename1);
                dataPackage.AddPupilContactRelationship(pupilContactRelationshipId1, pupilId, pupilContactId1,
                                                        hasParentalResponsibility: true);
                dataPackage.AddBasicLearnerContactAddress(pupilId, pupilContactId1, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(),
                                                          new DateTime(2016, 01, 01));

                #endregion Pre-Condition: Create new contact 1 and refer to pupil

                //Create second pupil
                pupilId            = Guid.NewGuid();
                learnerEnrolmentId = Guid.NewGuid();
                applicantId        = Guid.NewGuid();
                pupilSurname       = Utilities.GenerateRandomString(10, "TestPupil2_Surname" + suffix);
                pupilForename      = Utilities.GenerateRandomString(10, "TestPupil2_Forename" + suffix);

                contactSurname2    = Utilities.GenerateRandomString(10, "TestPupilContact2_Surname" + suffix);
                LastSalutationName = string.Format("Mr {0}", contactSurname2);
                LastAddresseeName  = string.Format("Mr {0} {1}", contactForename2[0], contactSurname2);
                dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2010, 01, 02),
                                            new DateTime(2015, 09, 02), enrolStatus: "C", uniqueLearnerEnrolmentId: learnerEnrolmentId,
                                            salutation: LastSalutationName, addressee: LastAddresseeName, yearGroupId: yearGroupId,
                                            schoolNCYearId: schoolNCYearId);

                #region Pre-Condition: Create new contact 2 and refer to pupil

                AutomationSugar.Log("Create new contact2 and refer to pupil");
                Guid pupilContactId2             = Guid.NewGuid();
                Guid pupilContactRelationshipId2 = Guid.NewGuid();
                //Add pupil contact

                dataPackage.AddPupilContact(pupilContactId2, contactSurname2, contactForename2);
                dataPackage.AddPupilContactRelationship(pupilContactRelationshipId2, pupilId, pupilContactId2,
                                                        hasParentalResponsibility: true);
                dataPackage.AddBasicLearnerContactAddress(pupilId, pupilContactId2, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(),
                                                          new DateTime(2016, 01, 01));

                #endregion Pre-Condition: Create new contact 2 and refer to pupil

                return(dataPackage);
            }
        }
Exemplo n.º 14
0
        public void TC_ATT006_Validate_Additional_Information_Displayed(string pupilSurName, string pupilForeName, string gender, DateTime dateOfBirth,
                                                                        DateTime DateOfAdmission, string YearGroup, string className, string pupilName, string contactSurname, string startDate, string startDateBefore)
        {
            #region Pre-Conditions:

            #region Pre-Condition: Create a new pupil for test

            AutomationSugar.Log("Data Creation started");
            var learnerId   = Guid.NewGuid();
            var dataPackage = this.BuildDataPackage();
            dataPackage.CreatePupil(learnerId, pupilSurName, pupilForeName, dateOfBirth, DateOfAdmission, YearGroup);

            AutomationSugar.Log("***Pre-Condition: Create new contact1 and refer to pupil");
            var  dataPackageNew              = this.BuildDataPackage();
            Guid learnerContactId            = Guid.NewGuid();
            Guid pupilContactRelationshipId1 = Guid.NewGuid();

            //Add pupil contact
            var contactSurname1  = Utilities.GenerateRandomString(10, "SeleniumPupilContact1_Surname" + Thread.CurrentThread.ManagedThreadId);
            var contactForename1 = Utilities.GenerateRandomString(10, "SeleniumPupilContact1_Forename" + Thread.CurrentThread.ManagedThreadId);
            var titleContact1    = "Mrs";
            dataPackageNew.AddPupilContact(learnerContactId, contactSurname1, contactForename1);
            dataPackageNew.AddPupilContactRelationship(pupilContactRelationshipId1, learnerId, learnerContactId);

            #endregion

            using (new DataSetup(packages: new DataPackage[] { dataPackage, dataPackageNew }))
            {
                // Login
                SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.ClassTeacher);

                // Navigate to take register
                AutomationSugar.NavigateMenu("Tasks", "Attendance", "Take Register");

                // Enter values to search
                var takeRegisterTriplet = new TakeRegisterTriplet();
                takeRegisterTriplet.SearchCriteria.StartDate = startDateBefore;
                takeRegisterTriplet.SearchCriteria.Week      = true;
                takeRegisterTriplet.SearchCriteria.SelectYearGroup(YearGroup);
                var takeRegisterPage  = takeRegisterTriplet.SearchCriteria.Search <TakeRegisterDetailPage>();
                var takeRegisterTable = takeRegisterPage.Marks;

                // Enter pre-condition mark
                takeRegisterTable[pupilName][1].Text = "/";
                takeRegisterTable[pupilName][2].Text = "N";
                takeRegisterTable[pupilName][3].Text = "N";
                takeRegisterTable[pupilName][4].Text = "N";
                takeRegisterTable[pupilName][5].Text = "/";
                takeRegisterTable[pupilName][6].Text = "/";

                // Save Value
                takeRegisterPage.ClickSave();

                #endregion

                #region Steps

                // Enter values to search again
                takeRegisterTriplet = new TakeRegisterTriplet();
                takeRegisterTriplet.SearchCriteria.StartDate = startDate;
                takeRegisterTriplet.SearchCriteria.Day       = true;
                takeRegisterPage  = takeRegisterTriplet.SearchCriteria.Search <TakeRegisterDetailPage>();
                takeRegisterTable = takeRegisterPage.Marks;

                // Verify birthday cake displays
                takeRegisterTable = takeRegisterPage.Marks;
                Assert.AreEqual(true, takeRegisterTable[pupilName].IsBirthdayCakeDisplay(), "Birthday cake does not displays");

                // Click pupil name
                takeRegisterTable[pupilName].ClickCellPupilName();
                var pupilDetailDialog = new PupilDetailDialog();

                // Verify pupil name and DOB is displayed.
                Assert.IsTrue(pupilDetailDialog.PupilName.Contains(pupilName), "Pupil name is not correct");
                Assert.IsTrue(pupilDetailDialog.PupilDOB.Contains(dateOfBirth.ToString("dd MMMM yyyy")), "Date of Birth is not correct");

                // Verify contact detail displays
                Assert.AreEqual(true, pupilDetailDialog.IsContactDetailDisplay(), "Contact detail does not display");

                #endregion
            }
        }
        public void DisplayPupilContactAddressDetails(string forenameContact, string surnameContact, string title, string gender, string salutation,
                                                      string addressee, string buildingNo, string street, string district, string city,
                                                      string county, string postCode, string countryPostCode, string language, string placeOfWork,
                                                      string jobTitle, string occupation, string priority, string relationship)
        {
            //Create a new pupil, so that it can be attached later to the newly created contact
            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "TestPupil_Surname" + Thread.CurrentThread.ManagedThreadId);
            var         pupilForename = Utilities.GenerateRandomString(10, "TestPupil_Forename" + Thread.CurrentThread.ManagedThreadId);

            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 01, 01), new DateTime(2012, 09, 01));

            #region Pre-Condition: Create new contact 1 and refer to pupil

            //Arrange
            AutomationSugar.Log("***Pre-Condition: Create new contact1 and refer to pupil");
            Guid pupilContactId1             = Guid.NewGuid();
            Guid pupilContactRelationshipId1 = Guid.NewGuid();
            //Add pupil contact

            dataPackage.AddPupilContact(pupilContactId1, forenameContact, surnameContact);
            dataPackage.AddPupilContactRelationship(pupilContactRelationshipId1, pupilId, pupilContactId1);

            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);
            #endregion


            AutomationSugar.Log("Data Creation Finished");
            //SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            //AutomationSugar.Log("Logged in to the system as School Administrator");
            SharedComponents.Helpers.SeleniumHelper.Login(SharedComponents.Helpers.SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            AutomationSugar.Log("Logged in to the system as Test User");

            // Navigate to Pupil Contracts
            AutomationSugar.NavigateMenu("Tasks", "Pupils", "Pupil Contacts");

            AutomationSugar.Log("Navigated to Pupil Contacts");

            var pupilContactTriplet = new PupilContactTriplet();
            pupilContactTriplet.SearchCriteria.ContactName = String.Format("{0}, {1}", surnameContact, forenameContact);
            Thread.Sleep(4);
            pupilContactTriplet.SearchCriteria.Search();
            var resultPupils = pupilContactTriplet.SearchCriteria.Search();
            int count        = resultPupils.Count();
            if (count == 1)
            {
                var pupilcontactSearchTile = resultPupils.FirstOrDefault(t => t.Name.Equals(String.Format("{0}, {1}", surnameContact, forenameContact)));
                var pupilcontactRecord     = pupilcontactSearchTile == null ? null : pupilcontactSearchTile.Click <PupilContactPage>();
                pupilcontactSearchTile.Click <PupilContactPage>();

                // Select Addresses Tab
                pupilcontactRecord.SelectAddressesTab();
                var addAddressDialog = pupilcontactRecord.ClickAddanAdditionalAddressLink();
                addAddressDialog.ClickManualAddAddress();
                // Add new address
                addAddressDialog.BuildingNo      = buildingNo;
                addAddressDialog.Street          = street;
                addAddressDialog.District        = district;
                addAddressDialog.City            = city;
                addAddressDialog.County          = county;
                addAddressDialog.PostCode        = postCode;
                addAddressDialog.CountryPostCode = countryPostCode;
                addAddressDialog.ClickOk();
                AutomationSugar.Log("Created a new address to the pupil contact");


                // Save
                pupilContactTriplet.ClickSave();

                AddressBookSearchPage searchBox = new AddressBookSearchPage();
                searchBox.ClearText();
                searchBox.EnterSearchTextForPupilContacts(surnameContact);
                searchBox.ClickOnFirstPupilContactRecord();
                AddressBookPopup popup = new AddressBookPopup();
                Assert.IsTrue(popup.IsAddressDisplayed());
            }
        }
Exemplo n.º 16
0
        private DataPackage GetDataPackageWithNoSalutation(string suffix, out string firstSalutationName, out string lastSalutationName, out string firstAddresseeName, out string lastAddresseeName)
        {
            lock (_lockObject2)
            {
                var       schoolIntakeId           = Guid.NewGuid();
                var       admissionGroupId         = Guid.NewGuid();
                string    admissionTerm            = "Spring";
                const int numberOfPlannedAdmission = 31;
                const int capacity = 10;
                _admissionYear = string.Format("{0}/{1}", (DateTime.Now.Year), (DateTime.Now.Year + 1));
                var dateOfAdmission = new DateTime(DateTime.Today.Year, 8, 1);

                _admissionGroupName = Utilities.GenerateRandomString(10, "AGN101_" + suffix);
                var yearGroup         = Queries.GetFirstYearGroup();
                var yearGroupFullName = yearGroup.FullName;
                _schoolIntakeName = string.Format("{0} - {1} {2} {3}", _admissionYear, admissionTerm, yearGroupFullName,
                                                  _admissionGroupName);

                var dataPackage = this.BuildDataPackage();
                dataPackage.AddSchoolIntake(
                    schoolIntakeId,
                    _admissionYear,
                    admissionTerm,
                    yearGroup,
                    numberOfPlannedAdmission,
                    _admissionGroupName,
                    dateOfAdmission,
                    capacity,
                    admissionGroupId,
                    schoolInTakeName: _schoolIntakeName);

                //Create first applicant
                Guid pupilId            = Guid.NewGuid();
                Guid learnerEnrolmentId = Guid.NewGuid();
                Guid applicantId        = Guid.NewGuid();
                var  pupilSurname       = Utilities.GenerateRandomString(10, "pSur1" + suffix);
                var  pupilForename      = Utilities.GenerateRandomString(10, "pFore1" + suffix);

                var contactForename1 = Utilities.GenerateRandomString(10, "CFore1" + suffix);
                contactSurname1 = Utilities.GenerateRandomString(10, "CSur1" + suffix);

                firstSalutationName = string.Format("Mr {0}", contactSurname1);
                firstAddresseeName  = string.Format("Mr {0} {1}", contactForename1[0], contactSurname1);

                dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2010, 01, 01),
                                            new DateTime(2015, 09, 01), enrolStatus: "F", uniqueLearnerEnrolmentId: learnerEnrolmentId,
                                            addressee: firstAddresseeName);
                dataPackage.AddBasicApplicant(applicantId, pupilId, learnerEnrolmentId, admissionGroupId, new DateTime(2015, 09, 01));

                #region Pre-Condition: Create new contact 1 and refer to pupil

                //Arrange
                AutomationSugar.Log("Create new contact1 and refer to pupil");
                Guid pupilContactId1             = Guid.NewGuid();
                Guid pupilContactRelationshipId1 = Guid.NewGuid();
                //Add pupil contact

                dataPackage.AddPupilContact(pupilContactId1, contactSurname1, contactForename1);
                dataPackage.AddPupilContactRelationship(pupilContactRelationshipId1, pupilId, pupilContactId1,
                                                        hasParentalResponsibility: true);
                dataPackage.AddBasicLearnerContactAddress(pupilId, pupilContactId1, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(),
                                                          new DateTime(2016, 01, 01));

                #endregion Pre-Condition: Create new contact 1 and refer to pupil

                //Create second applicant
                pupilId            = Guid.NewGuid();
                learnerEnrolmentId = Guid.NewGuid();
                applicantId        = Guid.NewGuid();
                pupilSurname       = Utilities.GenerateRandomString(10, "pSur2" + suffix);
                pupilForename      = Utilities.GenerateRandomString(10, "pFore2" + suffix);

                var contactForename2 = Utilities.GenerateRandomString(10, "CFore2" + suffix);
                contactSurname2    = Utilities.GenerateRandomString(10, "CSur2" + suffix);
                lastSalutationName = string.Format("Mr {0}", contactSurname2);
                lastAddresseeName  = string.Format("Mr {0} {1}", contactForename2[0], contactSurname2);
                dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2010, 01, 02),
                                            new DateTime(2015, 09, 02), enrolStatus: "F", uniqueLearnerEnrolmentId: learnerEnrolmentId,
                                            addressee: lastAddresseeName);
                dataPackage.AddBasicApplicant(applicantId, pupilId, learnerEnrolmentId, admissionGroupId, new DateTime(2015, 09, 02));

                #region Pre-Condition: Create new contact 2 and refer to pupil

                AutomationSugar.Log("Create new contact2 and refer to pupil");
                Guid pupilContactId2             = Guid.NewGuid();
                Guid pupilContactRelationshipId2 = Guid.NewGuid();

                //Add pupil contact
                dataPackage.AddPupilContact(pupilContactId2, contactSurname2, contactForename2);
                dataPackage.AddPupilContactRelationship(pupilContactRelationshipId2, pupilId, pupilContactId2,
                                                        hasParentalResponsibility: true);
                dataPackage.AddBasicLearnerContactAddress(pupilId, pupilContactId2, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(),
                                                          new DateTime(2016, 01, 01));

                #endregion Pre-Condition: Create new contact 2 and refer to pupil

                return(dataPackage);
            }
        }
        public void DisplayPupilContactTelephoneDetails(string dateOfBirth, string DateOfAdmission, string yearGroup, string telNo, string email)
        {
            #region Data Pupil contact Setup



            AutomationSugar.Log("Data Creation started");
            Guid        pupilId       = Guid.NewGuid();
            DataPackage dataPackage   = this.BuildDataPackage();
            var         pupilSurname  = Utilities.GenerateRandomString(10, "TestData_Pupil");
            var         pupilForename = Utilities.GenerateRandomString(10, "TestData_Pupil" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddBasicLearner(pupilId, pupilSurname, pupilForename, new DateTime(2005, 10, 01), new DateTime(2012, 08, 01));

            #endregion

            #region Pre-Condition: Create new contact 1 and refer to pupil

            //Arrange
            AutomationSugar.Log("***Pre-Condition: Create new contact1 and refer to pupil");
            Guid pupilContactId1             = Guid.NewGuid();
            Guid pupilContactRelationshipId1 = Guid.NewGuid();
            //Add pupil contact
            var contactSurname1  = Utilities.GenerateRandomString(10, "Suvarna" + Thread.CurrentThread.ManagedThreadId);
            var contactForename1 = Utilities.GenerateRandomString(10, "Gill" + Thread.CurrentThread.ManagedThreadId);
            dataPackage.AddPupilContact(pupilContactId1, contactSurname1, contactForename1);
            dataPackage.AddPupilContactRelationship(pupilContactRelationshipId1, pupilId, pupilContactId1);

            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: dataPackage);
            #endregion

            #region Add email and Tel

            //  Create a new pupil, so that it can be attached later to the newly created contact1
            SharedComponents.Helpers.SeleniumHelper.Login(SharedComponents.Helpers.SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            TaskMenuBar taskMenuInstance = new TaskMenuBar();
            taskMenuInstance.WaitForTaskMenuBarButton();
            AutomationSugar.NavigateMenu("Tasks", "Pupils", "Pupil Contacts");
            var pupilContactTriplet = new PupilContactTriplet();
            pupilContactTriplet.SearchCriteria.ContactName = String.Format("{0}, {1}", contactSurname1, contactForename1);
            Thread.Sleep(2);
            pupilContactTriplet.SearchCriteria.Search();
            pupilContactTriplet.SearchCriteria.Search();
            var resultPupils = pupilContactTriplet.SearchCriteria.Search();
            int count        = resultPupils.Count();
            if (count == 1)
            {
                var pupilcontactSearchTile = resultPupils.FirstOrDefault(t => t.Name.Equals(String.Format("{0}, {1}", contactSurname1, contactForename1)));
                var pupilcontactRecord     = pupilcontactSearchTile == null ? null : pupilcontactSearchTile.Click <PupilContactPage>();
                pupilcontactSearchTile.Click <PupilContactPage>();


                // Add Pupil Telephone number


                Wait.WaitUntilDisplayed(By.CssSelector("[data-maintenance-container='LearnerContactTelephones']"));
                pupilcontactRecord = new PupilContactPage();
                pupilcontactRecord.ClickAddTelephoneNumber();
                pupilcontactRecord.TelephoneNumberTable[0].TelephoneNumber = telNo;

                // Add Email Address
                pupilcontactRecord.ClickAddEmailAddress();
                pupilcontactRecord.EmailTable[0].EmailAddress = email;
                pupilContactTriplet.ClickSave();

                #endregion


                AddressBookSearchPage searchBox = new AddressBookSearchPage();
                searchBox.ClearText();
                searchBox.EnterSearchTextForPupilContacts(contactForename1);
                searchBox.ClickOnFirstPupilContactRecord();
                AddressBookPopup popup = new AddressBookPopup();
                popup.GetPupilContactBasicDetails();
                Assert.IsTrue(popup.IsPupilTelephoneDisplayed());
            }
            else
            {
                throw new Exception();
            }
        }