[Ignore] // TODO fix failure when IDM is turned off
        public void Employee_Send_Email()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            // pages
            // the Applicant Profile page shares some of the same buttons as the employee page
            // TODO create a new page object for employees
            var applicantProfilePage = new ApplicantProfilePages(Driver);
            var email = new EmailPage(Driver);

            // workflows
            var searchWorkflows = new SearchWorkflows(Driver);

            // test data
            const string empNo    = "484";
            const string empName  = "Automation Employee";
            const string empEmail = "*****@*****.**";

            // randomly generate an email subject in order to verify the email was sent correctly
            var rand      = new Random();
            var emailBody = rand.Next().ToString();

            try  //Contains Contents of Test
            {
                //test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]);

                // Open the employee page
                searchWorkflows.OpenEmployeeUsingSearch(empNo, empName);

                // Click the Email button
                Driver.SwitchToFrameById("Emp" + empNo);
                applicantProfilePage.Toolbar.ClickEmailButton();

                // 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(empEmail), "Expected email: " + empEmail + " is not on the screen");
                test.Log(LogStatus.Pass, "The email address: " + empEmail + " appears on the page");
                Driver.ClosePopup();

                // TODO figure out why this is failing on teamcity - error message -Could not find part of the path
                // Check to see if the email was sent
                //Assert.IsTrue(GmailApi.FindEmail(emailBody), "The email was not found in the gmail inbox");
                //test.Log(LogStatus.Pass, "Email found in gmail inbox");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
Beispiel #2
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;
            }
        }