Beispiel #1
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;
            }
        }
Beispiel #2
0
        public void Employee_Portal_Form_Delete()
        {
            var employeePortalPages = new EmployeePortalPages(Driver);
            var mainMenu            = new MainMenu(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();

                Driver.SwitchToFrameById("EmployeeDataPage");
                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");
                test.Log(LogStatus.Pass, "Form key is: " + employeePortalPages.FormsTabPage.FormKey);

                // Save as Draft
                Driver.SwitchToFrameById("IFrameFormSent");
                employeePortalPages.FormsTabPage.ClickSaveAsDraft();
                test.Log(LogStatus.Pass, "Saving as draft");

                // Cleanup
                Driver.SwitchToDefaultFrame();
                Driver.SwitchToFrameById("FormsDataPage");
                employeePortalPages.FormsTabPage.ClickDelete();
                // An alert opens after clicking delete
                AlertAccept(Driver);
                test.Log(LogStatus.Pass, "Click delete and accept the alert");

                // Refresh the page after deletion - the page does not reload after deleting
                Driver.Refresh();
                Driver.SwitchToDefaultFrame();
                employeePortalPages.ClickFormsTab();

                Driver.SwitchToFrameById("FormsDataPage");
                Assert.IsFalse(employeePortalPages.FormsTabPage.FormExistsInList(), "Form was not deleted properly");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }