Example #1
0
        /// <summary>
        /// Insert a bookmark in a document and a paragraph(and replace the displayed bookmark).
        /// </summary>
        public static void InsertBookmarks()
        {
            Console.WriteLine("\tInsertBookmarks()");

            // Create a document
            using (DocX document = DocX.Create(BookmarkSample.BookmarkSampleOutputDirectory + @"InsertBookmarks.docx"))
            {
                // Add a title
                document.InsertParagraph("Insert Bookmarks").FontSize(15d).SpacingAfter(40d).Alignment = Alignment.center;

                // Insert a bookmark in the document.
                document.InsertBookmark("Bookmark1");

                // Add a paragraph
                var p = document.InsertParagraph("This document contains a bookmark named \"");
                p.Append(document.Bookmarks.First().Name);
                p.Append("\" just before this line.");
                p.SpacingAfter(50d);

                var _bookmarkName          = "Bookmark2";
                var _displayedBookmarkName = "special";

                // Add another paragraph.
                var p2 = document.InsertParagraph("This paragraph contains a ");
                // Add a bookmark into the paragraph.
                p2.AppendBookmark(_bookmarkName);
                p2.Append(" bookmark named \"");
                p2.Append(document.Bookmarks.Last().Name);
                p2.Append("\" but displayed as \"" + _displayedBookmarkName + "\".");

                // Set a string to be displayed as the Bookmark in the second paragraph.
                p2.InsertAtBookmark(_displayedBookmarkName, _bookmarkName);

                document.Save();
                Console.WriteLine("\tCreated: InsertBookmarks.docx\n");
            }
        }
Example #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();
                }
            }
        }