Пример #1
0
        public IActionResult Cleanup()
        {
            var setup = new DataSetup(_dbSettings);

            setup.Cleanup();
            return(new OkResult());
        }
Пример #2
0
        public async Task SetupWorkspaceAudits(string baseTemplateName, string primaryServerName, string username, string password, string injectAuditDataQuery, IServicesMgr servicesManager)
        {
            // Setup
            var testWorkspaceName = "TestWorkspaceName";

            DataSetup.Setup();

            // Create Workspace
            var workspaceId = await CreateWorkspace.CreateWorkspaceAsync(testWorkspaceName, baseTemplateName, servicesManager, username, password);

            // Inject Audits by running SQL script against the workspace database
            using (var conn = await connectionFactory.GetWorkspaceConnectionAsync(workspaceId))
            {
                await conn.ExecuteAsync(
                    injectAuditDataQuery,
                    new
                {
                    workspace = workspaceId,
                    startHour = DateTime.UtcNow.AddDays(-7),
                    endHour   = DateTime.UtcNow,
                    suggestedExecutionTime = (int?)null,
                    usersPerHour           = 3,
                    minExecutionTime       = 1000,
                    maxExecutionTime       = 10000,
                    auditsPerHour          = 1000,
                    primaryServerName
                });
            }
        }
Пример #3
0
        public IActionResult LoadInitialData()
        {
            var setup = new DataSetup(_dbSettings);

            setup.LoadInitialData();
            return(new OkResult());
        }
Пример #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");
        }
Пример #5
0
        public void ShouldAddSelectedPupilsInGrid(string startDate, string endDate, string yeargroup, string pupilForeName, string pupilSurName,
                                                  string pupilName, string dateOfBirth, string DateOfAdmission)
        {
            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);

            AttendancePatternPage page           = AttendanceNavigations.NavigateToAttendancePatternFromTaskMenu();
            AttendanceSearchPanel searchcriteria = page.ClickAddPupilLink();

            var checkbox = SeleniumHelper.Get(AttendanceElements.AddPupilPopUpElements.PupilPickerSearchPanel);

            checkbox.Click(SimsBy.AutomationId("section_menu_Year Group"));
            checkbox.FindCheckBoxAndClick("Year Group", new List <string> {
                yeargroup
            });
            PupilPickerAvailablePupilSection AvailablePupils = searchcriteria.PupilPickerSearchButton();

            AvailablePupils.GetAvailablePupils();
            PupilPickerSelectedPupilSection selectedPupil = AvailablePupils.AddSelectedPupil();
            AttendancePatternPage           app1          = selectedPupil.ClickAttendancePattern_PupilPickerOkButton();

            Assert.IsTrue(app1.trashIcon.Displayed);
        }
Пример #6
0
        public async Task Execute(CancellationToken cancellationToken, EventWorker eventWorker = null)
        {
            cancellationToken.ThrowIfCancellationRequested();

            DataSetup.Setup();

            this.queuingConfiguration.ConfigureSystem();
            var worker = await this.eventWorkerService.CreateWorker(eventWorker);

            // Mark any events and event locks as orphaned since we haven't started processing anything yet.
            await this.eventOrphanService.MarkOrphanedEventsErrored(worker);

            await this.logger.LogVerboseAsync(
                $"Starting Job Server on Event Worker Id: {worker?.Id} - Name: {worker?.Name}");

            using (var server = this.kernel.Get <IJobServer>())
            {
                await server.WaitTillProcessesAreDone(cancellationToken);

                await this.logger.LogVerboseAsync(
                    $"Processes done, begin jobServer dispose on Event Worker Id: {worker?.Id} - Name: {worker?.Name}");
            }

            await this.logger.LogVerboseAsync(
                $"Job Server disposed on Event Worker Id: {worker?.Id} - Name: {worker?.Name}");

            await this.eventWorkerService.RemoveCurrentWorker();

            await this.logger.LogVerboseAsync(
                $"Removed Event Worker Id: {worker?.Id} - Name: {worker?.Name}");
        }
Пример #7
0
        public void CheckPupilResultsOrder(string forenameSetup, string surnameSetup, string gender, string dateOfBirth, string DateOfAdmission, string yearGroup)
        {
            #region Data Preparation
            SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            TaskMenuBar taskMenuInstance = new TaskMenuBar();
            taskMenuInstance.WaitForTaskMenuBarButton();
            DateTime dobSetup             = Convert.ToDateTime(dateOfBirth);
            DateTime dateOfAdmissionSetup = Convert.ToDateTime(DateOfAdmission);

            var learnerIdSetup   = Guid.NewGuid();
            var BuildPupilRecord = this.BuildDataPackage();
            #endregion

            BuildPupilRecord.AddBasicLearner(learnerIdSetup, surnameSetup, forenameSetup, dobSetup, dateOfAdmissionSetup, genderCode: "1", enrolStatus: "C");
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: BuildPupilRecord);

            AddressBookSearchPage searchBox = new AddressBookSearchPage();
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupils(surnameSetup);
            POM.Helper.SeleniumHelper.Sleep(2);
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupils(surnameSetup);
            var selectedElements = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId("PreferredListName_Learner")));
            Assert.That(selectedElements[0].Text.Contains(forenameSetup));
        }
Пример #8
0
        public IActionResult Initialize()
        {
            var setup = new DataSetup(_dbSettings);

            setup.Initialize();
            return(new OkResult());
        }
Пример #9
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);
        }
Пример #10
0
        public static void Initialize(TestContext _)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("testsettings.json");

            var configuration = builder.Build();

            configuration.GetSection("DBSettings").Bind(DBSettings);
            DBSettings.SqlProviderFactory = SqlClientFactory.Instance;

            DataConfiguration.Initialize();
            var setup = new DataSetup(DBSettings);

            setup.Initialize();
            setup.LoadUnitTestData();

            WebApiFactory = new WebApplicationFactory <Startup>()
                            .WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    services.Configure <DBSettings>(options =>
                    {
                        options.StorageConnectionString    = DBSettings.StorageConnectionString;
                        options.SqlConnectionString        = DBSettings.SqlConnectionString;
                        options.ReplicaSqlConnectionString = DBSettings.ReplicaSqlConnectionString;
                    });
                });
            });

            StartupWebApiProject();
        }
Пример #11
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);
        }
Пример #12
0
        public void DisplayPupilTelephoneDetails(string pupilSurName, string pupilForeName, string gender, string dateOfBirth, string DateOfAdmission, string yearGroup, string telNo, string email)
        {
            #region Data Preparation
            SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            TaskMenuBar taskMenuInstance = new TaskMenuBar();
            taskMenuInstance.WaitForTaskMenuBarButton();


            DateTime dobSetup             = Convert.ToDateTime(dateOfBirth);
            DateTime dateOfAdmissionSetup = Convert.ToDateTime(DateOfAdmission);
            var      learnerIdSetup       = Guid.NewGuid();
            var      BuildPupilRecord     = this.BuildDataPackage();
            BuildPupilRecord.AddBasicLearner(learnerIdSetup, pupilSurName, pupilForeName, dobSetup, dateOfAdmissionSetup, genderCode: "1", enrolStatus: "C");
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: BuildPupilRecord);

            AutomationSugar.NavigateMenu("Tasks", "Pupils", "Pupil Records");
            var pupilRecordTriplet = new PupilRecordTriplet();
            pupilRecordTriplet.SearchCriteria.PupilName = String.Format("{0}, {1}", pupilSurName, pupilForeName);
            POM.Helper.SeleniumHelper.Sleep(4);
            pupilRecordTriplet.SearchCriteria.Search();
            var resultPupils = pupilRecordTriplet.SearchCriteria.Search();
            int count        = resultPupils.Count();
            if (count == 1)
            {
                var pupilSearchTile = resultPupils.FirstOrDefault(t => t.Name.Equals(String.Format("{0}, {1}", pupilSurName, pupilForeName)));
                var pupilRecord     = pupilSearchTile == null ? null : pupilSearchTile.Click <PupilRecordPage>();
                pupilSearchTile.Click <PupilRecordPage>();
                //    Thread.Sleep(1000);
                //    Assert.AreNotEqual(null, pupilRecord, "Did not find pupil");

                // Add Pupil Telephone number
                pupilRecord.SelectPhoneEmailTab();
                pupilRecord = new PupilRecordPage();
                pupilRecord.ClickAddTelephoneNumber();
                pupilRecord.TelephoneNumberTable[0].TelephoneNumber = telNo;

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

                pupilRecord = PupilRecordPage.Create();
                pupilRecord.SavePupil();

                //Assert
                //    Assert.AreEqual(true, pupilRecord.IsSuccessMessageDisplayed(), "Success message is not display");
                #endregion

                AddressBookSearchPage searchBox = new AddressBookSearchPage();
                searchBox.ClearText();
                searchBox.EnterSearchTextForPupils(pupilSurName);
                AddressBookPopup popup = searchBox.ClickOnFirstPupilRecord();
                Assert.IsTrue(popup.IsPupilTelephoneDisplayed());
            }
            else
            {
                throw new Exception();
            }
        }
Пример #13
0
        static void Main(string[] args)
        {
            var seasonRule = DataSetup.SetupSeasonRule(10);

            var season = seasonRule.Create(null, 1, 1, 1, new SeasonGameCreator(null, true, 1));



            //var schedule = new Schedule();

            //Scheduler.MergeSchedules(schedule, divASched, divBSched, divCSched, divDSched, confASched, confBSched, interConfSched);

            var random = new Random();

            var schedule = season.Schedule;

            while (!schedule.IsComplete())
            {
                var day = schedule.GetNextInCompleteDay();

                day.Games.ToList().ForEach(g =>
                {
                    if (!g.Complete)
                    {
                        g.Play(random);
                    }

                    if (!g.Processed)
                    {
                        if (g is ICompetitionGame)
                        {
                            ((ICompetitionGame)g).Competition.ProcessGame((ICompetitionGame)g);
                        }
                    }
                });
            }

            season.UpdateRankings();

            season.GetStandingsByDivisionLevel(DivisionLevel.League).ToList().ForEach(standings =>
            {
                Console.WriteLine(standings);
            });

            season.GetStandingsByDivisionLevel(DivisionLevel.Conference).ToList().ForEach(standings =>
            {
                Console.WriteLine(standings);
            });

            season.GetStandingsByDivisionLevel(DivisionLevel.Province).ToList().ForEach(standings =>
            {
                Console.WriteLine(standings);
            });

            Console.ReadLine();
        }
Пример #14
0
        public object Calculate(CustomDataElement testDataObject, int k, List <string> fileData, string[] selectColumns, string classColumn)
        {
            var data = DataSetup.SetUpData(fileData, selectColumns, classColumn);

            var neighbors = GetNeighbors(data, testDataObject, k);

            var type = SelectType(neighbors);

            return(type);
        }
Пример #15
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());
        }
Пример #16
0
        /// <summary>
        /// Main calculation method.
        /// </summary>
        /// <param name="testDataElement">new test object data</param>
        /// <param name="fileData">input data</param>
        /// <param name="selectColumns">selected data column numbers</param>
        /// <param name="classColumn">class column number</param>
        /// <returns></returns>
        public string Calculate(CustomDataElement testDataElement, List <string> fileData, string[] selectColumns, string classColumn)
        {
            var data = DataSetup.SetUpData(fileData, selectColumns, classColumn);

            var classDictionary = SeparateData(data);

            var summary = GetClassSummary(classDictionary);

            var probabilities = GetProbabilities(summary, testDataElement);

            var prediction = GetPrediction(probabilities);

            return(prediction.Key);
        }
Пример #17
0
        public void DisplayStaffEmailDetails()
        {
            #region Arrange
            var staffId   = Guid.NewGuid();
            var forename  = SeSugar.Utilities.GenerateRandomString(10, "Staff_AddressBook_Email");
            var surname   = SeSugar.Utilities.GenerateRandomString(10, "Staff_AddressBook_Email");
            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>();
            }


            string emailId = "*****@*****.**";

            //   Wait.WaitUntilDisplayed(By.CssSelector("[data-maintenance-container='LearnerContactTelephones']"));
            var Record = new StaffRecordPage();
            Record.SelectPhoneEmailTab();
            Record.ClickAddEmailId();
            Record.EmailTable[0].EmailAddress = emailId;
            staffContactTriplet.ClickSave();

            POM.Helper.SeleniumHelper.Logout();
            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation(SeleniumHelper.iSIMSUserType.PersonnelOfficer);
            searchBox.ClearText();
            searchBox.EnterSearchTextForStaff(surname);
            searchBox.ClickOnFirstStaffRecord();
            AddressBookPopup popup = new AddressBookPopup();
            popup.GetStaffBasicDetails();
            Assert.IsTrue(popup.IsEmailDisplayed());
        }
 protected override void ExecuteAgent()
 {
     try
     {
         using (var source = this.cancellationTokenSourceFactory.GetCancellationTokenSource())
         {
             this.cancellationTokenSource = source;
             DataSetup.Setup();
             this.ExecutePdbAgent(cancellationTokenSource.Token);
         }
     }
     catch (Exception ex)
     {
         string merged = $@"{this.Name} Failed.: {ex.ToString()}".Truncate(30000);
         this.RaiseError(merged, string.Empty);
     }
 }
Пример #19
0
 public void CheckStaffResultsOrder()
 {
     #region Arrange
     var       staffId         = Guid.NewGuid();
     var       forename        = SeSugar.Utilities.GenerateRandomString(10, "ResultOrder_Staff");
     var       surname         = SeSugar.Utilities.GenerateRandomString(10, "ResultOrder_Staff");
     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.SchoolAdministrator);
     AddressBookSearchPage searchBox = new AddressBookSearchPage();
     searchBox.ClearText();
     searchBox.EnterSearchTextForStaff(surname);
     var selectedElements = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("search_result_tile_Staff")));
     Assert.IsTrue(selectedElements.Text.Contains("resultorder_staff"));
 }
Пример #20
0
        protected void Application_Start(object sender, EventArgs e)
        {
            AssemblyHelper.InitResolves();
            Application["ApplicationId"] = Guid.NewGuid().ToString();

            RouteTable.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = System.Web.Http.RouteParameter.Optional }
                ).RouteHandler = new SessionRouteHandler();

            AreaRegistration.RegisterAllAreas();

            DataSetup.Setup();

            //https://stackoverflow.com/a/20000098
            AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
        }
Пример #21
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());
        }
Пример #22
0
        public void DisplayStaffBasicDetails(string textForSearch)
        {
            #region Arrange
            var staffId   = Guid.NewGuid();
            var forename  = SeSugar.Utilities.GenerateRandomString(10, "Sheila");
            var surname   = SeSugar.Utilities.GenerateRandomString(10, "Fortune");
            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


            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.ClearText();
            searchBox.EnterSearchTextForStaff(textForSearch);
            AddressBookPopup popup = searchBox.ClickOnFirstStaffRecord();
            Assert.IsTrue(popup.GetStaffBasicDetails());
        }
Пример #23
0
        public void SearchCurrentStaffByName(string textForSearch)
        {
            #region Arrange
            var staffId   = Guid.NewGuid();
            var forename  = SeSugar.Utilities.GenerateRandomString(10, "Staff_AddressBook");
            var surname   = SeSugar.Utilities.GenerateRandomString(10, "Staff_AddressBook");
            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

            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.ClearText();
            searchBox.EnterSearchTextForStaff(textForSearch);
            double millisecs = searchBox.SearchTimeInMillisecs;
            searchBox.Log("Results fetched in " + millisecs + " milliseconds");
            Assert.Less(millisecs, AddressBookConstants.MaxAcceptableSearchTimeInMillisecs);
        }
Пример #24
0
        public void DisplayPupilBasicDetails(string forenameSetup, string surnameSetup, string gender, string dateOfBirth, string DateOfAdmission, string yearGroup)
        {
            #region Data Preparation

            DateTime dobSetup             = Convert.ToDateTime(dateOfBirth);
            DateTime dateOfAdmissionSetup = Convert.ToDateTime(DateOfAdmission);

            var learnerIdSetup   = Guid.NewGuid();
            var BuildPupilRecord = this.BuildDataPackage();
            #endregion

            BuildPupilRecord.AddBasicLearner(learnerIdSetup, surnameSetup, forenameSetup, dobSetup, dateOfAdmissionSetup, genderCode: "1", enrolStatus: "C");
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: BuildPupilRecord);

            AddressBookSearchPage searchBox = QuickSearch.QuickSearchNavigation();
            searchBox.ClearText();
            searchBox.EnterSearchTextForPupils(surnameSetup);
            AddressBookPopup popup = searchBox.ClickOnFirstPupilRecord();
            Assert.IsTrue(popup.GetPupilBasicDetails());
        }
Пример #25
0
        public void DoSetup()
        {
            database = new ScenarioSetup.TestDatabase("MagiQL-Tests", "MagiQL");

            var thisAssembly = typeof(TestSetup).Assembly;

            var schemaSetup = new SchemaSetup(thisAssembly);

            schemaSetup.BuildSchema();

            var dataSetup = new DataSetup(thisAssembly);

            dataSetup.SeedData();

            var columnSetup = new ColumnSetup(thisAssembly);

            columnSetup.CreateColumns();

            website = new WebApiSetup();
            website.Start();
        }
Пример #26
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);
        }
Пример #27
0
        public void LinkToStaffRecordFromStaffInfo()
        {
            #region Arrange
            var staffId   = Guid.NewGuid();
            var forename  = "Andrew";
            var surname   = "Gill";
            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);
            AddressBookSearchPage searchBox = new AddressBookSearchPage();
            searchBox.ClearText();
            searchBox.EnterSearchTextForStaff(textForSearch);
            AddressBookPopup popup = searchBox.ClickOnFirstStaffRecord();
            popup.ClickStaffDetailsLink();
            WebDriverWait wait = new WebDriverWait(WebContext.WebDriver, BrowserDefaults.TimeOut);
            wait.Until(ExpectedConditions.ElementExists(AddressBookElements.OpenedStaffRecordTab));
            bool value = SeleniumHelper.Get(AddressBookElements.OpenedStaffRecordTab).Displayed;
            Assert.IsTrue(value);
        }
Пример #28
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());
        }
Пример #29
0
        public void ClassTeacherPupilAddressDetailsAccess(string forenameSetup, string surnameSetup, string gender, string dateOfBirth, string DateOfAdmission, string yearGroup, string[] currentAddress)
        {
            #region Data Preparation

            DateTime dobSetup             = Convert.ToDateTime(dateOfBirth);
            DateTime dateOfAdmissionSetup = Convert.ToDateTime(DateOfAdmission);

            var learnerIdSetup   = Guid.NewGuid();
            var BuildPupilRecord = this.BuildDataPackage();
            #endregion

            BuildPupilRecord.AddBasicLearner(learnerIdSetup, surnameSetup, forenameSetup, dobSetup, dateOfAdmissionSetup, genderCode: "1", enrolStatus: "C");
            DataSetup DataSetPupil = new DataSetup(purgeBeforeInsert: false, purgeAfterTest: true, packages: BuildPupilRecord);

            //Address Add
            #region
            SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            SharedComponents.HomePages.TaskMenuBar menu = new SharedComponents.HomePages.TaskMenuBar();
            menu.WaitForTaskMenuBarButton();
            AutomationSugar.NavigateMenu("Tasks", "Pupils", "Pupil Records");
            AutomationSugar.WaitForAjaxCompletion();

            var pupilRecords = new PupilRecordTriplet();
            pupilRecords.SearchCriteria.PupilName = String.Format("{0}, {1}", surnameSetup, forenameSetup);
            pupilRecords.SearchCriteria.IsCurrent = true;
            var pupilSearchResults = pupilRecords.SearchCriteria.Search();
            AutomationSugar.WaitForAjaxCompletion();

            // This sometimes takes an eternity
            PupilRecordTriplet.PupilRecordSearchResultTile pupilTile = null;
            for (var cnt = 0; cnt < 10; cnt++)
            {
                Thread.Sleep(5000);
                pupilTile =
                    pupilSearchResults.FirstOrDefault(t => t.Name.Equals(String.Format("{0}, {1}", surnameSetup, forenameSetup)));
                if (pupilTile != null)
                {
                    break;
                }
            }
            var pupilRecord = pupilTile.Click <PupilRecordPage>();
            AutomationSugar.WaitForAjaxCompletion();
            pupilRecord.SelectAddressesTab();

            var addAddress = pupilRecord.ClickAddAddress();
            addAddress.ClickManualAddAddress();
            addAddress.BuildingNo      = currentAddress[0];
            addAddress.BuildingName    = currentAddress[1];
            addAddress.Flat            = currentAddress[2];
            addAddress.Street          = currentAddress[3];
            addAddress.District        = currentAddress[4];
            addAddress.City            = currentAddress[5];
            addAddress.County          = currentAddress[6];
            addAddress.PostCode        = currentAddress[7];
            addAddress.CountryPostCode = currentAddress[8];
            addAddress.ClickOk(5);

            //Save
            pupilRecord.SavePupil();
            AutomationSugar.WaitForAjaxCompletion();
            #endregion

            POM.Helper.SeleniumHelper.Logout();


            Assert.IsTrue(QuickControlAccess.canViewPupilAddressDetails(SeleniumHelper.iSIMSUserType.ClassTeacher, surnameSetup));
        }
Пример #30
0
        public void EditMarks_Register_Verify_Range_Of_functionalities(string dateSearch, string pupilForeName, string pupilSurName,
                                                                       string gender, string dateOfBirth, string DateOfAdmission, string YearGroup, string pupilName)
        {
            #region Pre-Conditions:

            // Navigate to Pupil Record
            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);

            #endregion

            #region TEST-STEPS
            SeleniumHelper.Login(SeleniumHelper.iSIMSUserType.SchoolAdministrator);
            SeleniumHelper.NavigateQuickLink("Edit Marks");

            var editMarksTriplet = new EditMarksTriplet();
            editMarksTriplet.SearchCriteria.StartDate = dateSearch;
            editMarksTriplet.SearchCriteria.SelectYearGroup(YearGroup);
            var editMarkPage = editMarksTriplet.SearchCriteria.Search <EditMarksPage>();

            var editmarkTable = editMarkPage.Marks;
            IEnumerable <SchoolAttendanceCode> getANRs = Queries.GetAttendanceNotRequiredCodes();
            List <string> codes = getANRs.Select(x => x.Code).ToList <string>();

            if (codes.Contains(editmarkTable[1][2].Text))
            {
                Console.WriteLine("Marks can't be overwritten on Holidays");
                return;
            }

            //Verify the Preserve Mode Functionality
            //editMarkPage = editMarksTriplet.SearchCriteria.Search<EditMarksPage>();
            editMarkPage.ModePreserve = true;

            //Enter Marks using Keyboard and Ensure blank marks can be edited while 'preserve' is enabled.
            var preserveModeMark = editMarkPage.Marks[pupilName][2].Text = "C";

            //Mark should be changed For Blank Cells in Preserve Mode
            Assert.AreEqual(preserveModeMark, editMarkPage.Marks[pupilName][2].Value, "Mark is updated when modePreserve is true");

            editMarkPage.ClickSave();

            //Enter Marks using Keyboard and Ensure previously existing marks cannot be edited while 'preserve' is enabled.
            var newmark = editMarkPage.Marks[pupilName][2].Text = "B";
            Assert.AreNotEqual(newmark, editMarkPage.Marks[pupilName][2].Value, "Mark is updated when modePreserve is true");

            //Enter mark using the code Dropdown List
            editMarkPage.Marks[pupilName][2].Focus();
            editMarkPage.CodeList = "B";

            //Mark can not be changed
            Assert.AreNotEqual("B", editMarkPage.Marks[pupilName][2].Value, "Mark is updated when modePreserve is true");

            //Select Overwrite  Mode : Verify the Overwrite Mode Functionality
            editMarkPage.ModePreserve = false;

            //Ensure attendance marks can be entered using the keyboard
            var originalMark = editMarkPage.Marks[pupilName][2].Text = "A";

            //Mark changed in Overwrite Mode
            Assert.AreEqual(originalMark, editMarkPage.Marks[pupilName][2].Value, "Mark is not updated when ModeOverwrite is true");

            //Enter mark using the code Dropdown List
            editMarkPage.Marks[pupilName][2].Focus();
            editMarkPage.CodeList = "A";

            //Check value the mark changed
            Assert.AreEqual("A", editMarkPage.Marks[pupilName][2].Value, "Mark is not updated when ModeOverwrite is true");
            editMarkPage.ClickSave();

            // FloodFill data
            var markGridColumns = editMarkPage.Marks.Columns;
            markGridColumns[2].TimeIndicatorSelected = "AM";
            var floodFillMark = editMarkPage.CodeList = "L";
            editMarkPage.ClickSave();

            Assert.AreEqual(floodFillMark, editMarkPage.Marks[pupilName][2].Value, "The selected cells can not be flood filled");
            Assert.AreEqual(floodFillMark, editMarkPage.Marks[Convert.ToInt16(editMarkPage.Marks.RowCount / 2)][2].Value, "The selected cells can not be flood filled");
            Assert.AreEqual(floodFillMark, editMarkPage.Marks[Convert.ToInt16(editMarkPage.Marks.RowCount - 1)][2].Value, "The selected cells can not be flood filled");

            //Edit the mark with invalid value
            var inVaildMark = editMarkPage.Marks[pupilName][2].Text = "K";

            //VP: Value of mark can not be "abc"
            Assert.AreNotEqual(inVaildMark, editMarkPage.Marks[pupilName][2].Value, "The cell should not update 'K' value");

            //Add comment to cell
            editMarkPage.Marks[pupilName][2].Focus();
            editMarkPage.Marks[pupilName][2].OpenComment();
            var commentDialog = new AddCommentDialog();
            commentDialog.Comment    = "Test Comment";
            commentDialog.MinuteLate = "100";
            commentDialog.ClickOk();

            //Check comment added
            editMarkPage.Marks[pupilName][3].Focus();
            editMarkPage.Marks[pupilName][2].Focus();
            editMarkPage.Marks[pupilName][2].OpenComment();
            commentDialog = new AddCommentDialog();
            Assert.AreEqual("Test Comment", commentDialog.Comment, "Comment is not saved");
            commentDialog.ClickOk();

            //Click Save
            editMarkPage.ClickSave();

            //Check Message success display
            Assert.AreEqual(true, editMarkPage.IsSuccessMessageDisplayed(), "Success message doesn't display");

            #endregion
        }