Example #1
0
        public void Employee_Portal_Login()
        {
            var employeePortalPages = new EmployeePortalPages(Driver);

            var employeeData = new EmployeeData();

            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            try  //Contains Contents of Test
            {
                Driver.SwitchToFrameById("HomeDataPage");

                employeePortalPages.LoginPage.EnterEmailAddress(employeeData.email);
                employeePortalPages.LoginPage.EnterPassword(employeeData.password);
                employeePortalPages.LoginPage.ClickLogin();

                Driver.SwitchToFrameById("EmployeeDataPage");
                Assert.IsTrue(employeePortalPages.IsLoggedIn(), "Employee was not logged in");
                test.Log(LogStatus.Pass, "Log in as employee: " + employeeData.email + "was successful");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
Example #2
0
        [Ignore] // TODO form was changed in the system, figure out whats different
        public void Employee_Portal_Form_Submit()
        {
            var employeePortalPages = new EmployeePortalPages(Driver);

            var employeeData = new EmployeeData();

            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            try  //Contains Contents of Test
            {
                // Login
                Driver.SwitchToFrameById("HomeDataPage");
                employeePortalPages.LoginPage.EnterEmailAddress(employeeData.email);
                employeePortalPages.LoginPage.EnterPassword(employeeData.password);
                employeePortalPages.LoginPage.ClickLogin();
                test.Log(LogStatus.Pass, "Logging in as employee: " + employeeData.email);

                // Click on the 'Forms' tab
                Driver.SwitchToDefaultFrame();
                employeePortalPages.ClickFormsTab();
                test.Log(LogStatus.Pass, "Clicking on the 'Forms' tab");

                // Click the 'New Form' button
                Driver.SwitchToFrameById("FormsDataPage");
                employeePortalPages.FormsTabPage.ClickNewForm();
                test.Log(LogStatus.Pass, "Clicking on the 'New Form' button");

                // Click Start Form
                employeePortalPages.FormsTabPage.ClickStartForm();
                test.Log(LogStatus.Pass, "Click the 'Start Form' link.");

                // Click OK, Continue
                Driver.SwitchToFrameById("IFrameFormSent");
                Assert.IsTrue(employeePortalPages.FormsTabPage.StartFormPageIsLoaded(), "The New Form page did not load");
                test.Log(LogStatus.Pass, "The New Form page loaded");

                employeePortalPages.FormsTabPage.ClickOkContinue();
                test.Log(LogStatus.Pass, "Clicking the 'OK, Continue' button");

                // Enter the required fields on the form
                Driver.SwitchToFrameById("IFrameFormSent");
                employeePortalPages.FormsTabPage.EnterRequiredFields();
                test.Log(LogStatus.Pass, "Required fields populated");

                // Submit the form
                employeePortalPages.FormsTabPage.ClickSubmit();
                test.Log(LogStatus.Pass, "Form submitted");

                // Check to see if the correct screen is displayed
                Assert.IsTrue(employeePortalPages.FormsTabPage.SubmittedSceenDisplayed());
                test.Log(LogStatus.Pass, "The screen indicating the form has been submitted is displayed");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
Example #3
0
        public void ValidateApplicantSubMenu()
        {
            //Override Default BrowserType with DataSource BrowserType
            //BT = Convert.ToString(testContextInstance.DataRow["BrowserType"]);

            Driver = SetUp(BT); //Stand up Driver and Log Test
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            var LoginData  = new Data.LoginData();
            var LogingPage = new Pages.LoginPage(Driver);
            var MainMenu   = new Pages.MainMenu(Driver);
            var AppSubMenu = new Pages.SubMenuApplicants(Driver);

            try  //Contains Contents of Test
            {
                BrowseTo(_baseURL, Driver);
                LogingPage.EnterUsername(LoginData.UserName);
                LogingPage.EnterPwd(LoginData.Password);
                LogingPage.ClickLogin();
                MainMenu.ClickApplicants();
                AppSubMenu.VerifyApplicantsSubMenu();
                Driver.Quit();
            }
            catch (Exception e) //On Error Do
            {
                OnError(e, Driver);
                throw;
            }
        }
        /// <summary>
        /// Delete a form for testing purposes. This will only work if the form to be deleted has not been used.
        /// </summary>
        /// <param name="formId">The ID of the form to be deleted.</param>
        public void DeleteForm(int formId)
        {
            Console.WriteLine("WindowHandle at Start: " + _driver.GetHashCode().ToString());

            var mainMenu  = new MainMenu(_driver);
            var formMenu  = new SubMenuForms(_driver);
            var formPages = new FormPages(_driver);

            Console.WriteLine("Attemping to delete form with ID {0}", formId);

            // navigate to Forms > Design Forms and Packets > Edit Forms
            _driver.SwitchToDefaultFrame();
            mainMenu.ClickMainMenuTab();
            mainMenu.ClickForms();
            formMenu.ClickDesignFormsandPackets();
            formMenu.ClickEditForms();
            _test.Log(LogStatus.Pass, "Navigate to Forms > Design Forms and Packets > Edit Forms");

            // select the form in the list
            _driver.SwitchToFrameById("MainContentsIFrame");
            formPages.EditFormsPage.SelectForm(formId);
            _test.Log(LogStatus.Pass, "Select the form in the list");

            // delete the form
            _driver.SwitchToDefaultFrame();
            formMenu.ClickDeleteForms();
            formPages.EditFormsPage.ConfirmDeletion();
            _test.Log(LogStatus.Pass, "Delete and confirm");
        }
Example #5
0
 private ScreenshotMaker SetDriver(IWebDriver driver)
 {
     if (_driver != null && _driver.GetHashCode() == driver.GetHashCode())
     {
         return(this);
     }
     _driver = driver;
     return(this);
 }
        public void Interview_Create_New()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            var mainMenu       = new MainMenu(Driver);
            var interviewMenu  = new SubMenuInterviews(Driver);
            var interviewPages = new InterviewPages(Driver);

            var interviewData = new InterviewData();

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

                mainMenu.ClickInterviews();
                interviewMenu.ClickCreateInterview();
                test.Log(LogStatus.Pass, "Navigate to Interviews > Create Interview");

                mainMenu.SwitchToWindow("Manage Interview Series");
                interviewPages.CreateInterviewPages.StartTab.SelectCreateNew();
                test.Log(LogStatus.Pass, "Click Add New Interview");

                interviewPages.CreateInterviewPages.StartTab.SelectGeneralRecruiting();
                test.Log(LogStatus.Pass, "Click Add New Interview Type");

                interviewPages.CreateInterviewPages.ClickNext();
                test.Log(LogStatus.Pass, "Click Next");

                interviewPages.CreateInterviewPages.SeriesDetailsTab.EnterTitle(interviewData.InterviewTitle);
                test.Log(LogStatus.Pass, "Entering title: " + interviewData.InterviewTitle);

                interviewPages.CreateInterviewPages.ClickSummaryTab();
                test.Log(LogStatus.Pass, "Click Summary tab");

                interviewPages.CreateInterviewPages.ClickSaveFinish();
                test.Log(LogStatus.Pass, "Click Save and Finish");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
        public void Edit_Position_List()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            // pages
            var mainMenu   = new MainMenu(Driver);
            var setupMenu  = new SubMenuSetup(Driver);
            var setupPages = new SetupPages(Driver);

            try                                              //Contains Contents of Test
            {
                var mainWindow = Driver.CurrentWindowHandle; // the main window

                //test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]);

                // Navigate to Setup > Applicant Settings > Edit Position List
                mainMenu.ClickSetup();
                setupMenu.ClickApplicantSettings();
                setupMenu.ClickEditPositionList();
                test.Log(LogStatus.Pass, "Navigate to Setup > Applicant Settings > Edit Position List");

                Driver.SwitchToFrameById("MainContentsIFrame");

                var positions = setupPages.ApplicantSettingsPages.EditPositionListPages.GetPositionList();

                foreach (var position in positions)
                {
                    // click the edit button for the given position
                    setupPages.ApplicantSettingsPages.EditPositionListPages.EditPosition(position);
                    test.Log(LogStatus.Pass, "Edit position: " + position);

                    // switch to the new window and rename the position
                    Driver.SwitchToPopup();
                    Assert.IsTrue(setupPages.ApplicantSettingsPages.EditPositionListPages.EditPositionWindow.IsDisplayed(),
                                  "The Edit Position window is not displayed correctly");
                    test.Log(LogStatus.Pass, "The Edit Position window is displayed correctly");
                    setupPages.ApplicantSettingsPages.EditPositionListPages.EditPositionWindow.EnterPositionName(" test");

                    // click save and close
                    test.Log(LogStatus.Pass, "Click the Save and Close button");
                    setupPages.ApplicantSettingsPages.EditPositionListPages.EditPositionWindow.ClickSaveAndClose();

                    // switch back to the main window
                    Driver.SwitchTo().Window(mainWindow);
                    Driver.SwitchToDefaultFrame();
                    Driver.SwitchToFrameById("MainContentsIFrame");
                }
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
        public void Permissions_InterviewQuestionnaire_Button_Displayed()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            // pages
            var applicantProfilePage = new ApplicantProfilePages(Driver);
            var applicantMenu        = new ApplicantAdminMenu(Driver);

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

            // applicant data
            const string appNo   = "1";
            const string appName = "Sample Applicant";

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

                loginWorkflows.LoginAsSuperUser();
                test.Log(LogStatus.Pass, "Logging in as a superuser");

                searchWorkflows.OpenApplicantUsingSearch(appNo, appName);
                Driver.SwitchToFrameById("App" + appNo);
                test.Log(LogStatus.Pass, "Search for and open applicant: " + appNo + appName);

                applicantMenu.ClickInterviews();
                test.Log(LogStatus.Pass, "Click Interviews");

                Assert.IsTrue(applicantProfilePage.Interviews.IsFillOutInterviewQuestionnaireVisible());
                test.Log(LogStatus.Pass, "The 'Fill Out Interview Questionnaire' button is visible");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
        [Ignore] // TODO unignore this once employee deletion is working, and/or when the new QA environment is up
        //[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", @"|DataDirectory|\DataFiles\CrossBrowser2.csv", "CrossBrowser2#csv", DataAccessMethod.Sequential)]
        public void Employee_Delete()
        {
            //Override Default BrowserType with DataSource BrowserType
            //BT = Convert.ToString(testContextInstance.DataRow["BrowserType"]);

            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            var mainMenu = new MainMenu(Driver);
            var empPages = new SubMenuEmployees(Driver);

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

                mainMenu.ClickEmployees();
                empPages.ClickEmployeeList();
                test.Log(LogStatus.Pass, "Navigate to Employees > Employee List");

                Driver.SwitchToFrameById("MainContentsIFrame");

                empPages.DeleteEmployeeFromList("Adams,   Andrew");
                test.Log(LogStatus.Pass, "Select the employee");

                Driver.SwitchToDefaultFrame();

                empPages.ClickDelete();
                empPages.ClickDeleteEmployee();
                test.Log(LogStatus.Pass, "Click delete button");

                empPages.ConfirmDeleteEmployee();
                test.Log(LogStatus.Pass, "Confirm deletion");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
        public void LandingPage_Start_As_Internal_Applicant()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            var landingPage    = new DefaultLandingPage(Driver);
            var applicantPages = new ApplicantPages(Driver);

            try  //Contains Contents of Test
            {
                landingPage.ClickInternalLogin();
                test.Log(LogStatus.Pass, "Click Internal Login");

                applicantPages.SwitchWindows();
                Driver.SwitchToFrameById("HomeDataPage");
                applicantPages.ClickStart();
                test.Log(LogStatus.Pass, "Clicking Start");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
Example #11
0
        public void UserSettings_Only_ApplicantProfile_and_EmployeeProfile_Settings_Displayed()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            // pages
            var mainMenu       = new MainMenu(Driver);
            var myAccountMenu  = new SubMenuMyAccount(Driver);
            var myAccountPages = new MyAccountPages(Driver);

            // workflows

            // data
            var expectedPreferences = new StringCollection
            {
                "Applicant Profile",
                "Employee Profile"
            };

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

                // Navigate to My Account > User Preferences
                mainMenu.ClickMyAccount();
                myAccountMenu.ClickUserPreferences();
                test.Log(LogStatus.Pass, "Navigate to My Account > User Preferences");

                // Assert that the only two options available are 'Applicant Profile' and 'Employee Profile'
                Driver.SwitchToFrameById("MainContentsIFrame");
                var actualPreferences = myAccountPages.UserPreferencesPage.GetActualPreferences();
                CollectionAssert.AreEqual(expectedPreferences, actualPreferences,
                                          "The User Preferences do not match: " + expectedPreferences[0] + " and " + expectedPreferences[1]);
                test.Log(LogStatus.Pass, "The User Preferences match: " + expectedPreferences[0] + " and " + expectedPreferences[1]);
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
        public void Form_Create_New_Blank()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            var formData  = new FormData();
            var mainMenu  = new MainMenu(Driver);
            var formMenu  = new SubMenuForms(Driver);
            var formPages = new FormPages(Driver);

            var formWorkflow = new FormWorkflows(Driver, test);

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

                // navigate to Forms > Design Forms and Packets > Create New Form
                mainMenu.ClickForms();
                formMenu.ClickDesignFormsandPackets();
                formMenu.ClickCreateNewForm();
                test.Log(LogStatus.Pass, "Navigate to Forms > Design Forms and Packets > Create New Form");

                // click 'A blank form'
                Driver.SwitchToFrameById("MainContentsIFrame");
                formPages.CreateNewFormPage.ClickBlankForm();
                test.Log(LogStatus.Pass, "Click 'A blank form'");

                // enter form info
                Driver.SwitchToFrameById("tabs_Panel");
                formPages.EditAndCreateFormPage.PropertiesTab.ClickStandardFormRadioButton();
                test.Log(LogStatus.Pass, "Select the 'Standard Form' radio button");

                formPages.EditAndCreateFormPage.PropertiesTab.FillOutFormTitle(formData.FormTitle);
                test.Log(LogStatus.Pass, "Fill out the form title");

                // save
                Driver.SwitchToDefaultFrame();
                Driver.SwitchToFrameById("MainContentsIFrame");
                formPages.EditAndCreateFormPage.ClickSaveButton();
                test.Log(LogStatus.Pass, "Click the save button");
                var formId = formPages.EditAndCreateFormPage.GetFormId();
                Console.WriteLine("Form ID: {0}", formId);

                // verify that the form was created
                Driver.SwitchToDefaultFrame();
                mainMenu.ClickMainMenuTab();
                mainMenu.ClickForms();
                formMenu.ClickDesignFormsandPackets();
                formMenu.ClickEditForms();
                Driver.SwitchToFrameById("MainContentsIFrame");
                Assert.IsTrue(formPages.EditFormsPage.FormExists(formId));
                test.Log(LogStatus.Pass, "Verify the form exists");

                // delete the form
                formWorkflow.DeleteForm(formId);
                test.Log(LogStatus.Pass, "Delete the form");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
Example #13
0
        public void TestMethod1()
        {
            //testTarget = targ;
            //testID = "UI-" + tclass + "-" + tsubclass + "-" + tID;
            //testClass = tclass;
            //testSubClass = tsubclass;
            testRegressionCandidate = false;
            testStatus = states[0];
            testClass = "TIT";
            testSubClass = "IE";
            testTarget = "visitor";
            testUrl = "http://10.141.10.20:8080/Account/Login?ReturnUrl=%2f";

            switch (this.testSubClass)
            {
                case "FF":
                    // Create a new instance of the Firefox driver.
                    //driver = new FirefoxDriver();
                    driver = new FirefoxDriver(new FirefoxProfile(""));
                    break;
                case "IE":
                    // Create a new instance of the Firefox driver.
                    driver = new InternetExplorerDriver();

                    break;
                case "AS":
                    // Create a new instance of the Firefox driver.
                    driver = new SafariDriver();
                    break;
                case "GC":
                    // Create a new instance of the Firefox driver.
                    driver = new ChromeDriver();
                    break;
                default:
                    System.Console.Error.WriteLine("ERROR: Invalid test subclass");
                    Environment.Exit(-1);
                    break;
            }

            switch (this.testClass)
            {
                case ("TIT"):

                    try
                    {

                        //driver.Navigate().GoToUrl("http://www.google.com/");
                        driver.Navigate().GoToUrl(testUrl);

                        // Find the text input element by its name
                        //IWebElement query = driver.FindElement(By.Name("q"));

                        IWebElement loginF = driver.FindElement(By.ClassName("form-hideLabels"));
                        IWebElement uName = driver.FindElement(By.Id("UserName"));
                        IWebElement uPass = driver.FindElement(By.Id("Password"));

                        System.Console.WriteLine(driver.GetType());
                        System.Console.WriteLine(driver.GetHashCode());

                        int wdr = driver.Manage().GetHashCode();

                        // Enter something to search for
                        uName.SendKeys("admin");
                        uPass.SendKeys("1234");

                        // Now submit the form. WebDriver will find the form for us from the element
                        loginF.Submit();
                    }
                    catch (OpenQA.Selenium.NoSuchElementException nsee)
                    {
                        driver.Quit();
                        System.Console.Error.WriteLine("ERROR: Exception trying to reach a page element");
                        System.Console.Error.WriteLine(nsee.Message);
                        Thread.Sleep(5000);

                        response = null;
                        Environment.Exit(-2);

                    }
                    catch (OpenQA.Selenium.NoSuchWindowException nswe) {
                        driver.Quit();
                        System.Console.Error.WriteLine("ERROR: Exception trying to reach a window");
                        System.Console.Error.WriteLine(nswe.Message);
                        Thread.Sleep(5000);

                        response = null;
                        Environment.Exit(-2);

                    }
                    catch
                    {
                        driver.Quit();
                        System.Console.Error.WriteLine("ERROR: Other error");
                        Thread.Sleep(5000);

                        response = null;
                        Environment.Exit(-2);

                    }

                    string theTitle;
                    // Google's search is rendered dynamically with JavaScript.
                    // Wait for the page to load, timeout after 10 seconds
                    WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
                    try
                    {
                        wait.Until((d) => { return d.Title.ToLower().StartsWith(testTarget.Split(' ')[0]); });
                    }
                    catch(Exception e)
                    {
                        theTitle = "PROBLEM!";
                        driver.Quit();
                        System.Console.Error.WriteLine("ERROR: Exception trying to reach the page title");
                        //response = null;
                        //Environment.Exit(-3);
                        response = "problem";
                        result = false;
                    }

                    if (result) {
                        // Should see: "Cheese - Google Search"
                        //System.Console.WriteLine("Page title is: " + driver.Title);
                        theTitle = driver.Title;

                        //Close the browser
                        driver.Quit();

                        response = theTitle;
                    }

                    break;
                case ("PNF"):
                    driver.Navigate().GoToUrl(this.testTarget);
                    //driver.FindElement(By.ClassName,).
                    //wait.Until((d) => { return d.});
                    break;
                default:
                    response = null;
                    break;
            }
            Assert.AreEqual("Visitor Management Kendo UI Demo", response);
            //Assert.AreEqual("Not this page, man!", response);
        }
Example #14
0
        public void Form_SendTo_Applicant_Deny()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            var mainMenu              = new MainMenu(Driver);
            var formMenu              = new SubMenuForms(Driver);
            var formPages             = new FormPages(Driver);
            var applicantProfilePage  = new ApplicantProfilePages(Driver);
            var applicantPage         = new ApplicantPages(Driver);
            var applicantMenu         = new ApplicantAdminMenu(Driver);
            var applicantProfilePages = new ApplicantProfilePages(Driver);

            var searchWorkflows = new SearchWorkflows(Driver);
            var formWorkflows   = new FormWorkflows(Driver, test);

            try //Contains Contents of Test
            {
                const int    formId       = 896;
                const string formName     = "Deny Form Automated Testing";
                const string appNo        = "1";
                const string appName      = "Sample Applicant";
                const string employeeNo   = "484";
                const string employeeName = "Automation Employee";

                //test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]);

                // Navigate to Forms > Send a Form
                mainMenu.ClickForms();
                formMenu.ClickSendForm();
                test.Log(LogStatus.Pass, "Navigate to Forms > Send a Form");

                // Select "Approval and Deny Form for testing"
                Driver.SwitchToFrameById("MainContentsIFrame");
                formPages.SendFormPage.SelectFormToSendById(formId);
                test.Log(LogStatus.Pass, "Select form: " + formId);

                formPages.SendFormPage.ClickContinueWithSelectedForms();
                test.Log(LogStatus.Pass, "Click 'Continue with Selected Forms'");

                // Assign the form to appno1
                formPages.SendFormPage.SelectAssociatedApplicant(appNo);
                test.Log(LogStatus.Pass, "Select Applicant Number: " + appNo);

                // Assign the form to an employee
                formPages.SendFormPage.SelectAssociatedEmployee(employeeNo);
                test.Log(LogStatus.Pass, "Select Employee Number: " + employeeNo);

                formPages.SendFormPage.ClickNext();
                test.Log(LogStatus.Pass, "Click 'Next'");

                // Send the form
                formPages.SendFormPage.ClickFinishAndDeliver();
                test.Log(LogStatus.Pass, "Click 'Finish and Deliver'");

                // Open the applicant page
                searchWorkflows.OpenApplicantUsingSearch(appNo, appName);
                test.Log(LogStatus.Pass, "Opened applicant page for: " + appNo + " " + appName);

                // Login as applicant
                Driver.SwitchToFrameById("App" + appNo);
                applicantProfilePage.Toolbar.LoginAsApplicant();
                test.Log(LogStatus.Pass, "Log in as applicant");

                // Click on the forms tab and select the "Approval and Deny Form for testing"
                applicantPage.ClickFormsTab();
                test.Log(LogStatus.Pass, "Clicking the 'Forms' tab");
                Driver.SwitchToFrameById("FormsDataPage");
                // TODO: refactor formGuid out of the test
                var formGuid = applicantPage.SelectForm(formName);
                test.Log(LogStatus.Pass, "Selecting " + formName);

                // Fill out an answer and click Next
                Driver.SwitchToDefaultFrame();
                applicantPage.ClickNextPage();
                // Click next twice to go to form
                test.Log(LogStatus.Pass, "Click Next Page");
                // the Next Page button must be clicked twice in order to go to the next page
                // TODO work with developers to fix
                applicantPage.ClickNextPage();
                test.Log(LogStatus.Pass, "Click Next Page again");

                // The IFrames are nested so we need to switch to both
                Driver.SwitchToFrameById("FormsDataPage");
                Driver.SwitchToFrameById("IFrameFormSent");

                // Verify the 'Deny' button exists
                Assert.IsTrue(applicantPage.DenyButtonExists(), "The 'Deny' button does not appear on the screen");
                test.Log(LogStatus.Pass, "The 'Deny' button exists");

                // Digitally sign and approve the form
                applicantPage.EnterDigitalSignature(appName);
                test.Log(LogStatus.Pass, "Digitally sign the form");

                applicantPage.ClickDeny();
                test.Log(LogStatus.Pass, "Deny the form");

                // switch back to the main window
                Driver.ClosePopup();

                // Navigate to 'List All Forms'
                Driver.SwitchToFrameById("App" + appNo);
                applicantMenu.ClickListAllForms();
                Driver.SwitchToFrameById("MainContentsIFrame");
                test.Log(LogStatus.Pass, "Navigate to 'List All Forms' from the applicant menu");

                // Verify form has been approved
                Assert.IsTrue(applicantProfilePages.ListAllForms.FormIsDenied(formGuid), "The form was not denied");
                test.Log(LogStatus.Pass, "Form was denied");

                // Cleanup - delete the form
                test.Log(LogStatus.Info, "Beginning cleanup");
                formWorkflows.DeleteSentForm(formGuid);
                test.Log(LogStatus.Pass, "Delete sent form");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
        public void Applicant_Login_Count()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            // page objects
            var mainMenu       = new MainMenu(Driver);
            var applicantMenu  = new SubMenuApplicants(Driver);
            var applicantPages = new ApplicantAdminPages(Driver);
            var toolbar        = ToolbarFactory.Get(Driver);

            var applicantProfilePage = new ApplicantProfilePages(Driver);

            // workflows
            var searchWorkflow = new SearchWorkflows(Driver);
            var loginWorkflow  = new LoginWorkflows(Driver);

            // applicant data
            const string appNo   = "1";
            const string appName = "Sample Applicant";

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

                // Navigate to Applicants > Applicant Dashboard
                mainMenu.ClickApplicants();
                applicantMenu.ClickApplicantDashboard();
                test.Log(LogStatus.Pass, "Navigate to Applicants > Applicant Dashboard");

                // Navigate to 'Overall Statistics' and get the value from 'Applicant Logins in Last 24 Hours'
                applicantPages.Dashboard.ClickOverallStatistics();
                test.Log(LogStatus.Pass, "Click 'Overall Statistics'");
                var actualCount = applicantPages.Dashboard.GetLoginCount();
                test.Log(LogStatus.Info, "Current login count: " + actualCount);

                // Login as an applicant
                searchWorkflow.OpenApplicantUsingSearch(appNo, appName);
                Driver.SwitchToFrameById("App" + appNo);
                applicantProfilePage.Toolbar.LoginAsApplicant();
                test.Log(LogStatus.Pass, "Log in as applicant");
                Driver.SwitchToPopup();
                Driver.ClosePopup();
                test.Log(LogStatus.Pass, "Login as " + appName);

                // The count should incease by 1 after logging in
                var expectedCount = actualCount + 1;

                // Go back to the applicant dashboard to get the new count
                // The count will NOT refresh unless the user logs out and logs back in again.
                toolbar.Logout();
                BrowseTo(BaseUrls["ApplitrackLoginPage"], Driver); // go back to the login page
                loginWorkflow.LoginAsSuperUser();
                mainMenu.ClickApplicants();
                applicantMenu.ClickApplicantDashboard();
                applicantPages.Dashboard.ClickOverallStatistics();
                actualCount = applicantPages.Dashboard.GetLoginCount(); // get the new count
                test.Log(LogStatus.Info, "New login count: " + actualCount);

                // Assert that the count was increased
                Assert.AreEqual(expectedCount, actualCount, "The expected count: " + expectedCount + " does not match the actual count: " + actualCount);
            }
            catch (Exception e)
            {
                HandleException(e, Driver);
                throw;
            }
        }
Example #16
0
        public void Test(string testedUrl)
        {
            visualGridRunner.Logger.Log("entering test {0}", testedUrl);
            Eyes eyes;

            if (visualGridRunner != null)
            {
                eyes = new Eyes(visualGridRunner);
            }
            else
            {
                eyes = new Eyes();
            }
            Configuration testConfig = new Configuration(suiteConfig);

            testConfig.SetTestName("testEKB" + testedUrl);
            eyes.SetConfiguration(testConfig);
            eyes.ForceFullPageScreenshot = true;
            IWebDriver webDriver = null;

            try
            {
                if (webDrivers.TryTake(out webDriver, -1))
                {
                    eyes.Logger.Log("using existing web driver: {0} ({1})", webDriver, webDriver?.GetHashCode());
                }
            }
            catch (Exception e)
            {
                eyes.Logger.Log("Error: " + e);
            }

            try
            {
                IWebDriver driver = eyes.Open(webDriver, appName, testName + "-" + testedUrl, localViewportSize);
                eyes.Logger.Log("navigating to " + testedUrl);

                driver.Url = testedUrl;
                string script = "var d1 = document.querySelector('body > div.navbar-container');"
                                + "if (d1) {d1.style.position='relative'}";
                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript(script);
                eyes.MatchLevel = MatchLevel.Strict;

                eyes.Check("Step1 - " + testedUrl, Target.Window());
                eyes.CloseAsync();
            }
            catch (Exception e)
            {
                eyes.Logger.Log("Error: " + e);
                if (webDriver != null)
                {
                    eyes.Logger.Log("calling webdriver.quit (1)");
                    webDriver.Quit();
                }
            }

            try
            {
                visualGridRunner.Logger.Log("returning webdriver to pool");
                webDrivers.Add(webDriver);
            }
            catch (Exception e)
            {
                eyes.Logger.Log("Error: " + e);
            }

            visualGridRunner.Logger.Log("last line of test");
        }