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; } }
public void TestSetup() { // extent reports setup _test = ExtentTestManager.StartTest(TestContext.Properties["TestCaseName"].ToString(), TestContext.Properties["TestCaseDescription"].ToString()) .AssignCategory("Smoke"); // browser setup _driver = SetUp(_BT); _driver.Manage().Window.Maximize(); _test.Log(LogStatus.Info, "Begin applicant creation"); // create applicant BrowseTo(BaseUrls["ApplitrackLandingPage"], _driver); _test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLandingPage"]); var landingPage = new DefaultLandingPage(_driver); var applicantPages = new ApplicantPages(_driver); var applicationWorkflows = new ApplicationWorkflows(_driver, _test); var applicantProfile = new ApplicantProfilePages(_driver); var hireWizard = new HireWizardPage(_driver); _applicantData = new ApplicantGenerator(); 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(); _isApplicantCreated = true; // login to admin BrowseTo(BaseUrls["ApplitrackLoginPage"], _driver); _test.Log(LogStatus.Info, "Logging into system at URL: " + BaseUrls["ApplitrackLoginPage"]); var loginWorkflow = new LoginWorkflows(_driver); loginWorkflow.LoginAsSuperUser(); // Navigate to the Notes page because selenium has trouble interacting with the window BrowseTo(BaseUrls["ApplitrackLoginPage"] + @"/onlineapp/admin/Action-LeaveNote.aspx?AppNo=" + _applicantData.AppNo + @"&HideSaveAndClose=1", _driver); // Hire the applicant applicantProfile.ApplicantNotesPages.ApplicantNotesTab.SelectHiredYes(); _test.Log(LogStatus.Info, "Select 'Yes' for hired."); applicantProfile.ApplicantNotesPages.ApplicantNotesTab.ClickSave(); _test.Log(LogStatus.Info, "Click 'Save'"); hireWizard.ClickNext(); _test.Log(LogStatus.Info, "Click 'Next'"); // Select 'No' for Aesop if (FeatureFlags.ThirdParty.Aesop.Enabled) { hireWizard.SelectNo(); _test.Log(LogStatus.Info, "Select 'No' for Aesop"); hireWizard.ClickNext(); _test.Log(LogStatus.Info, "Click 'Next'"); } // Select 'No' for HR Files if (FeatureFlags.Employees.UsesEmployees) { hireWizard.SelectNo(); _test.Log(LogStatus.Info, "Select 'No' for HR Files"); hireWizard.ClickNext(); _test.Log(LogStatus.Info, "Click 'Next'"); } // Select 'Yes' for FC hireWizard.SelectYes(); _test.Log(LogStatus.Info, "Select 'Yes' for FC"); hireWizard.ClickNext(); _test.Log(LogStatus.Info, "Click 'Next'"); }