Exemple #1
0
        public When_calling_Applicants_find_service() : base()
        {
            var stubResponse = new HttpResponseMessage();

            stubResponse.Content = new StringContent(ApplicantGenerator.Json());

            HttpClient.Setup(client => client.Post(It.IsAny <Uri>(), It.IsAny <HttpContent>()))
            .Throws(new Exception("Applicant find should use GET"));
            HttpClient.Setup(client => client.Get(It.IsAny <Uri>()))
            .Returns(stubResponse)
            .Callback <Uri>(c => { UriUsed = c; });
        }
        public void ShouldDeserializeApplicantAsExpected()
        {
            var applicant    = JsonConvert.DeserializeObject <Applicant>(ApplicantGenerator.Json());
            var applicantRef = ApplicantGenerator.Applicant(true);

            Assert.AreEqual(applicant.Id, applicantRef.Id);
            Assert.AreEqual(applicant.CreatedAt, applicantRef.CreatedAt);
            Assert.AreEqual(applicant.HRef, applicantRef.HRef);
            Assert.AreEqual(applicant.Title, applicantRef.Title);
            Assert.AreEqual(applicant.FirstName, applicantRef.FirstName);
            Assert.AreEqual(applicant.MiddleName, applicantRef.MiddleName);
            Assert.AreEqual(applicant.LastName, applicantRef.LastName);
            Assert.AreEqual(applicant.Gender, applicantRef.Gender);
            Assert.AreEqual(applicant.DateOfBirth, applicantRef.DateOfBirth);
            Assert.AreEqual(applicant.Telephone, applicantRef.Telephone);
            Assert.AreEqual(applicant.Mobile, applicantRef.Mobile);
            Assert.AreEqual(applicant.Country, applicantRef.Country);

            Assert.AreEqual(applicant.IdNumbers.Count(), applicantRef.IdNumbers.Count());

            var ssn = new IdNumber {
                Type = "ssn", Value = "433-54-3937", StateCode = null
            };
            var driving_license = new IdNumber {
                Type = "driving_license", Value = "I1234562", StateCode = "CA"
            };
            var found_ssn             = false;
            var found_driving_license = false;

            foreach (var id in applicant.IdNumbers)
            {
                found_ssn             |= CompareIdNumbers(id, applicantRef.IdNumbers.First());
                found_driving_license |= CompareIdNumbers(id, applicantRef.IdNumbers.Last());
            }

            Assert.IsTrue(found_ssn);
            Assert.IsTrue(found_driving_license);

            var found_current_addr  = false;
            var found_previous_addr = false;

            foreach (var address in applicant.Addresses)
            {
                found_current_addr  |= CompareAddresses(address, applicantRef.Addresses.First());
                found_previous_addr |= CompareAddresses(address, applicantRef.Addresses.Last());
            }

            Assert.IsTrue(found_current_addr);
            Assert.IsTrue(found_previous_addr);
        }
        public void TeacherFit_Displayed_for_New_Applicant()
        {
            // page objects
            var landingPage    = new DefaultLandingPage(Driver);
            var applicantPages = new ApplicantPages(Driver);

            // workflows
            var applicationWorkflows = new ApplicationWorkflows(Driver, test);

            // applicant data
            var applicantData = new ApplicantGenerator();

            try
            {
                // create new applicant
                landingPage.ClickExternalLogin();
                test.Log(LogStatus.Pass, "Click 'External Login'");

                Driver.SwitchToPopup();
                applicantPages.ClickEmploymentApplicationTab();
                test.Log(LogStatus.Pass, "Click the 'Employment Application' tab");

                applicationWorkflows.FillOutPersonalInfo(applicantData);

                applicantPages.EmploymentApplicationPages.ClickNextPage();
                test.Log(LogStatus.Pass, "Click 'Next Page'");

                applicantPages.EmploymentApplicationPages.ClickVacancyDesired();
                test.Log(LogStatus.Pass, "Click 'Vacancy Desired'");

                applicantPages.EmploymentApplicationPages.VacancyDesiredPage.SelectVacancy(vacancyDesired);
                test.Log(LogStatus.Pass, "Select job: " + vacancyDesired);

                applicantPages.EmploymentApplicationPages.ClickSaveAsDraft();
                test.Log(LogStatus.Pass, "Click 'Save as Draft'");

                // navigate to Teacher Fit
                applicantPages.EmploymentApplicationPages.ClickTeacherFit();
                test.Log(LogStatus.Pass, "Click 'TeacherFit'");

                // Assert that the page is displayed
                Assert.IsTrue(applicantPages.EmploymentApplicationPages.FitPages.IsDisplayed(), "The Teacher Fit starting page is not displayed");
                test.Log(LogStatus.Pass, "The teacher fit starting page is displayed");
            }
            catch (Exception e)
            {
                HandleException(e, Driver);
                throw;
            }
        }
Exemple #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var context = serviceProvider.GetService <ApiContext>();

            ApplicantGenerator.GenerateApplicant(context);

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Hahn API v1");
            });


            app.UseHttpsRedirection();

            app.UseStaticFiles();

            app.UseSerilogRequestLogging();

            app.UseRouting();

            // Added WithExposeHeaders to expose the Location Header to the client.
            app.UseCors(options =>
                        options
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .WithExposedHeaders("Location"));

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                //endpoints.MapControllers();
                endpoints.MapDefaultControllerRoute();
            });
        }
        public void TeacherFit_New_Applicant()
        {
            // page objects
            var landingPage    = new DefaultLandingPage(Driver);
            var applicantPages = new ApplicantPages(Driver);

            // workflows
            var applicationWorkflows = new ApplicationWorkflows(Driver, test);

            // data
            var applicantData  = new ApplicantGenerator();
            var vacancyDesired = 1171;

            try
            {
                // create new applicant
                landingPage.ClickExternalLogin();
                test.Log(LogStatus.Pass, "Click 'External Login'");

                Driver.SwitchToPopup();
                applicantPages.ClickEmploymentApplicationTab();
                test.Log(LogStatus.Pass, "Click the 'Employment Application' tab");

                applicationWorkflows.FillOutPersonalInfo(applicantData);

                applicantPages.EmploymentApplicationPages.ClickNextPage();
                test.Log(LogStatus.Pass, "Click 'Next Page'");

                applicantPages.EmploymentApplicationPages.ClickVacancyDesired();
                test.Log(LogStatus.Pass, "Click 'Vacancy Desired'");

                applicantPages.EmploymentApplicationPages.VacancyDesiredPage.SelectVacancy(vacancyDesired);
                test.Log(LogStatus.Pass, "Select vacancy: " + vacancyDesired);

                applicantPages.EmploymentApplicationPages.ClickSaveAsDraft();
                test.Log(LogStatus.Pass, "Click 'Save As Draft'");

                // take teacherfit
                applicantPages.EmploymentApplicationPages.ClickTeacherFit();
                test.Log(LogStatus.Pass, "Click 'TeacherFit'");

                Assert.IsTrue(applicantPages.EmploymentApplicationPages.FitPages.IsDisplayed(), "The Teacher Fit starting page is not displayed");
                test.Log(LogStatus.Pass, "The teacher fit starting page is displayed");

                applicationWorkflows.CompleteFitAssessment();

                // assert that the assessment has been completed
                Assert.IsTrue(applicantPages.EmploymentApplicationPages.FitPages.AssessmentCompleted(), "The fit assessment has not been completed");
                test.Log(LogStatus.Pass, "The fit assessment has been completed successfully");

                // submit the application
                applicantPages.EmploymentApplicationPages.ClickFinishAndSubmit();
                test.Log(LogStatus.Pass, "Click 'Finish and Submit'");

                // assert that the screen does not indicate that the teacherfit assessment needs to be completed
                Assert.IsTrue(applicantPages.EmploymentApplicationPages.ConfirmationPage.StepIsCompleted("TeacherFit"),
                              "The confirmation page indicates the TeacherFit assessment was not completed");
                test.Log(LogStatus.Pass, "The confirmation page indicates that the TeacherFit assessment was completed");
            }
            catch (Exception e)
            {
                HandleException(e, Driver);
                throw;
            }
        }
Exemple #6
0
        public void Applicant_Send_Email()
        {
            // pages
            var applicantProfilePage = new ApplicantProfilePages(_driver);
            var applicantMenu        = new ApplicantAdminMenu(_driver);
            var email          = new EmailPage(_driver);
            var landingPage    = new DefaultLandingPage(_driver);
            var applicantPages = new ApplicantPages(_driver);

            // workflows
            var searchWorkflows      = new SearchWorkflows(_driver);
            var applicationWorkflows = new ApplicationWorkflows(_driver, test);

            // test data
            var applicantData = new ApplicantGenerator();
            var emailBody     = Faker.TextFaker.Sentence();

            try
            {
                // create applicant
                BrowseTo(BaseUrls["ApplitrackLandingPage"], _driver);
                landingPage.ClickExternalLogin();
                _driver.SwitchToPopup();
                applicantPages.ClickEmploymentApplicationTab();
                applicationWorkflows.FillOutPersonalInfo(applicantData);
                applicantPages.EmploymentApplicationPages.ClickNextPage();
                applicantPages.EmploymentApplicationPages.ClickPostalAddress();
                applicationWorkflows.FillOutPermanentAddress(applicantData.Address);
                _driver.SwitchToDefaultFrame();
                _driver.SwitchToFrameById("AppDataPage");
                applicantData.AppNo = applicantPages.EmploymentApplicationPages.GetAppNo();
                test.Log(LogStatus.Info, "AppNo is: " + applicantData.AppNo);
                _driver.SwitchToDefaultFrame();
                applicantPages.EmploymentApplicationPages.ClickSaveAsDraft();
                _driver.ClosePopup();

                // login
                BrowseTo(BaseUrls["ApplitrackLoginPage"], _driver);
                test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]);
                var loginWorkflow = new LoginWorkflows(_driver);
                loginWorkflow.LoginAsSuperUser();

                // Open the applicant page
                BrowseTo($"{_driver.Url}?AppNo={applicantData.AppNo}", _driver);
                _driver.SwitchToFrameById("App" + applicantData.AppNo);

                // Click the Email button
                applicantProfilePage.Toolbar.ClickEmailButton();
                test.Log(LogStatus.Pass, "Click the Email button");

                // Send the email
                _driver.SwitchToPopup();
                _driver.SwitchToFrameByClass("cke_wysiwyg_frame");
                email.EnterEmailBody(emailBody);
                _driver.SwitchToDefaultFrame();
                email.ClickSendMessageButton();
                test.Log(LogStatus.Pass, "Click the Send Message button");

                // Assert that the email address is displayed on the page
                Assert.IsTrue(email.IsEmailAddressDisplayed(applicantData.Email), "Expected email: " + applicantData.Email + " is not on the screen");
                test.Log(LogStatus.Pass, "The email address: " + applicantData.Email + " appears on the page");
                _driver.ClosePopup();

                _driver.SwitchToDefaultFrame();
                _driver.SwitchToFrameById("App" + applicantData.AppNo);
                applicantMenu.ClickCommuncationLog();

                _driver.SwitchToFrameById("MainContentsIFrame");

                Assert.IsTrue(applicantProfilePage.CommunicationLogPage.IsCommunicationDisplayed(emailBody), "Email is not displayed on the Communication Log page");
                test.Log(LogStatus.Pass, "Email is displayed on the Communication Log page");
            }
            catch (Exception e)
            {
                HandleException(e, _driver);
                throw;
            }
        }
Exemple #7
0
        public void CallService()
        {
            var applicant = ApplicantGenerator.Applicant(false);

            ApplicantService.Create(applicant);
        }