Esempio n. 1
0
        public void HIPPSubmissionPend(string stat, int age, bool renewalStatus)
        {
            ScreenCaputres caputres = new ScreenCaputres();
            //caputres.TakeVideo(@"C:\\Users\\bryar.h.cole\Desktop\\TestResults\\");
            string userName = "******";

            #region Start up
            ExtentTest    test    = null;
            ChromeOptions options = new ChromeOptions();
            //options.AddArgument("--headless");
            context = new ChromeDriver(options);
            context.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);

            Utility                     utility     = new Utility(context);
            APHPHomePage                loginPage   = new APHPHomePage(context);
            WorkerPortalLandingPage     landingPage = new WorkerPortalLandingPage(context);
            HIPPSearchPage              hIPPSearch  = new HIPPSearchPage(context);
            InitiateTest                startUp     = new InitiateTest(context);
            CreateHIPPApplicationWorker app         = new CreateHIPPApplicationWorker();
            HIPPWorkFlow                workFlow    = new HIPPWorkFlow();
            WordDocGen                  genWordDoc  = new WordDocGen();
            context.Url = startUp.AWSINTWoker;
            context.Manage().Window.Maximize();
            DateTime now = DateTime.Now;

            #endregion
            StringBuilder stringBuilder      = new StringBuilder();
            string        screenshotLocation = @"C:\Users\bryar.h.cole\Desktop\TestResults\";


            try
            {
                loginPage.LoginPage("bryar.h.wrkr", "user@123A", startUp.AWSINTWoker);
                //loginPage.LoginPage("harish.ne.wrkr", "user@1234");

                landingPage.HippApplicationSearch();

                while (context.Title == "HIPP Application Search")
                {
                    hIPPSearch.ClickBeginNewApp();
                }
                if (context.Title == "HIPP Application")
                {
                    try
                    {
                        app.SubmitHIPPCaseSubmissionWorker(context, renewalStatus, age);
                    }
                    catch (WebDriverTimeoutException e)
                    {
                        stringBuilder.AppendLine("Seems like a timeout exception occured. For this test. Status was " + stat + ", age: " + age);
                        ScreenCaputres.TakeSreenShot(context, screenshotLocation + stat + age + "error.png");
                    }
                }
                else
                {
                    hIPPSearch.ClickBeginNewApp();
                }
                try
                {
                    string appNumber = workFlow.HippWorkFlow(stat, context);
                    stringBuilder.AppendLine("Appnumber is " + appNumber + " for candidate who is age: " + age + "\n" + "Time of test: " + now + "\n" + "***********");
                }
                catch (WebDriverTimeoutException e)
                {
                    WorkItemComponent workItemComponent = new WorkItemComponent(context);

                    string appNumber = workItemComponent.GatherAppNumber();

                    stringBuilder.AppendLine("Appnumber is " + appNumber + " for candidate who is age: " + age + "\n" + "Time of test: " + now + "\n" + "***********");
                }
            }


            catch (NoSuchElementException e)
            {
                //caputres.StopVideo();
                throw;
            }
            catch (Exception e)
            {
                //caputres.StopVideo();

                throw;
            }

            finally
            {
                try
                {
                    Thread.Sleep(3000);
                    //Generic.signoutBtn.Click();
                    //context.Close();
                    System.IO.File.AppendAllText(@"C:\Users\bryar.h.cole\Desktop\testResults.txt", stringBuilder.ToString());
                }
                catch
                {
                    //context.Close();
                }
            }
        }
Esempio n. 2
0
        public void TC_IT03_HIPP_Workflow(string stat, int testCaseID, bool renewalStatus)
        {
            ScreenCaputres caputres = new ScreenCaputres();
            //caputres.TakeVideo(@"C:\\Users\\bryar.h.cole\Desktop\\TestResults\\");
            string userName = "******";

            #region Start up
            ExtentTest test = null;
            context = new ChromeDriver();
            context.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);

            Utility                     utility     = new Utility(context);
            APHPHomePage                loginPage   = new APHPHomePage(context);
            WorkerPortalLandingPage     landingPage = new WorkerPortalLandingPage(context);
            HIPPSearchPage              hIPPSearch  = new HIPPSearchPage(context);
            InitiateTest                startUp     = new InitiateTest(context);
            CreateHIPPApplicationWorker app         = new CreateHIPPApplicationWorker();
            HIPPWorkFlow                workFlow    = new HIPPWorkFlow();
            WordDocGen                  genWordDoc  = new WordDocGen();
            context.Url = startUp.AWSINTWoker;
            context.Manage().Window.Maximize();
            DateTime now = DateTime.Now;

            #endregion

            System.IO.Directory.CreateDirectory(screenshotLocation);

            DocX     doc      = genWordDoc.CreateWordDoc(testCaseID, 152045);
            TestCase testCase = utility.GetTestCase(testCaseID, 152045);
            string   testName = testCase.TestCaseId.ToString() + "_" + testCase.TestCaseName.Replace(" ", "_") + ".docx";
            string   scenario = testCase.TestCaseName;


            try
            {
                doc.InsertBookmark("Pass 1");
                doc.InsertBookmark("Pass 2");
                loginPage.LoginPage("bryar.h.wrkr", "user@123A", startUp.AWSINTWoker);
                //loginPage.LoginPage("harish.ne.wrkr", "user@1234");

                utility.RecordStepStatusMAIN("Login APHP success", screenshotLocation, "LoginSuccess", doc);
                landingPage.HippApplicationSearch();
                hIPPSearch.ClickBeginNewApp();
                //hIPPSearch.ClickBeginNewApp();

                app.SubmitHIPPCaseSubmissionWorker(context, renewalStatus, screenshotLocation, doc);
                string appNumber = workFlow.HippWorkFlow(stat, context, screenshotLocation, doc);
            }


            catch (NoSuchElementException e)
            {
                utility.RecordStepStatusMAIN("Element you are looking for does not exist, error mssage is as follows: " + e.Message, screenshotLocation, "NoSuchElement", doc);
                //caputres.StopVideo();
                throw;
            }
            catch (Exception e)
            {
                utility.RecordStepStatusMAIN("An exception occurred within the code, please see error message: " + e.Message, screenshotLocation, "Error", doc);
                //caputres.StopVideo();

                throw;
            }

            finally
            {
                try
                {
                    Thread.Sleep(3000);
                    doc.SaveAs("C:\\Users\\" + userName + "\\Desktop\\TestResults\\" + testName);
                    Process.Start("WINWORD.EXE", "C:\\Users\\" + userName + "\\Desktop\\TestResults\\" + testName);
                    //Generic.signoutBtn.Click();
                    //context.Close();
                }
                catch
                {
                    //context.Close();
                }
            }
        }