Exemple #1
0
        public void CoautherWithoutConflict()
        {
            // Upload a document
            SharepointClient.UploadFile(Word);
            // Refresh web address
            Browser.Goto(Browser.BaseAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".docx']"));

            // Open document by office word
            Browser.RClick(document);
            var elementOpenInWord = Browser.webDriver.FindElement(By.XPath("//div[@id='ID_EditIn_Word']"));

            Browser.Click(elementOpenInWord);
            // Close Microsoft office dialog and access using expected account
            Utility.CloseMicrosoftOfficeDialog();
            string username = ConfigurationManager.AppSettings["UserName"];
            string password = ConfigurationManager.AppSettings["Password"];

            Utility.OfficeSignIn(username, password);
            // Wait for document is opened
            Utility.WaitForDocumentOpenning(filename);
            // Get the opened word process, and edit it
            Word.Application wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            Word.Document    oDocument  = (Word.Document)wordToOpen.ActiveDocument;
            oDocument.Content.InsertAfter("HelloWord");

            // Double click the document in root site
            Browser.Click(document);
            // Find and click "Edit Document" tab
            var editWord = Browser.FindElement(By.XPath("//a[@id='flyoutWordViewerEdit-Medium20']"), false);

            editWord.SendKeys(OpenQA.Selenium.Keys.Enter);
            SendKeys.SendWait("Enter");
            // Find and click "Edit in Browser" tab
            var editInbrowser = Browser.webDriver.FindElement(By.XPath("//a[@id ='btnFlyoutEditOnWeb-Menu32']"));

            editInbrowser.SendKeys(OpenQA.Selenium.Keys.Enter);
            SendKeys.SendWait("Enter");
            // Wait for document is opened
            var saved = Browser.FindElement(By.XPath("//span[@id='BreadcrumbSaveStatus'][text()='Saved']"), false);

            oDocument.Save();
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            Marshal.ReleaseComObject(oDocument);
            Marshal.ReleaseComObject(wordToOpen);
            // Refresh web address
            Browser.Goto(Browser.BaseAddress);
            // Delete the new upload document
            SharepointClient.DeleteFile(filename + ".docx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
Exemple #2
0
        public void Exclusivelock()
        {
            // Upload a document
            SharepointClient.UploadFile(Word);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + wordFilename + ".docx']"));

            // Checkout the document
            SharepointClient.LockItem(wordFilename + ".docx");
            // Open it in office word
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Word"));
            var elementOpenInWord = Browser.webDriver.FindElement(By.LinkText("Open in Word"));

            Browser.Click(elementOpenInWord);

            // Sign in Word App.
            Utility.WaitForDocumentOpenning(wordFilename, false, true);
            string username             = ConfigurationManager.AppSettings["UserName"];
            string password             = ConfigurationManager.AppSettings["Password"];
            bool   isWindowsSecurityPop = Utility.WaitForDocumentOpenning(wordFilename, false, true);

            if (isWindowsSecurityPop)
            {
                Utility.OfficeSignIn(username, password);
                Thread.Sleep(2000);
                Utility.OfficeSignIn(username, password);
            }

            // Wait for document is opened
            Utility.WaitForDocumentOpenning(wordFilename);
            // Update the document content
            Word.Application wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            Word.Document    oDocument  = (Word.Document)wordToOpen.ActiveDocument;
            oDocument.Content.InsertBefore("Exclusivelock");
            // Save and close and release word process
            oDocument.Save();
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            Marshal.ReleaseComObject(oDocument);
            Marshal.ReleaseComObject(wordToOpen);
            SharepointClient.UnLockItem(wordFilename + ".docx");
            // Delete the new upload document
            SharepointClient.DeleteFile(wordFilename + ".docx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
        public void CoauthorWithConflict()
        {
            string oneWithFileData    = ConfigurationManager.AppSettings["OneWithFileData"];
            string oneWithoutFileData = ConfigurationManager.AppSettings["OneWithoutFileData"];

            Utility.OneNoteCoauthorWithConflict(oneWithFileData);
            Utility.OneNoteCoauthorWithConflict(oneWithoutFileData);
            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
Exemple #4
0
        public void SchemalockCheck()
        {
            // Upload a document
            SharepointClient.UploadFile(Word);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".docx']"));

            // Checked out it
            SharepointClient.LockItem(filename + ".docx");
            // Open it by word
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Word"));
            var elementOpenInWord = Browser.webDriver.FindElement(By.LinkText("Open in Word"));

            Browser.Click(elementOpenInWord);
            Utility.CloseMicrosoftOfficeDialog();
            Utility.WaitForDocumentOpenning(filename);
            // Sign in office word with another account and wait for it opening in readonly mode
            string username = ConfigurationManager.AppSettings["OtherUserName"];
            string password = ConfigurationManager.AppSettings["OtherPassword"];

            Utility.OfficeSignIn(username, password);
            Utility.OfficeSignIn(username, password);
            Utility.CloseFileInUsePane(filename);
            Utility.WaitForDocumentOpenning(filename, true);
            Word.Application wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            Word.Document    oDocument  = (Word.Document)wordToOpen.ActiveDocument;
            // Wait for CheckLockAvailability
            Thread.Sleep(60000);
            Utility.CloseFileNowAvailable(filename);
            // Close and release word process
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            Marshal.ReleaseComObject(oDocument);
            Marshal.ReleaseComObject(wordToOpen);
            SharepointClient.UnLockItem(filename + ".docx");
            // Delete the new upload document
            SharepointClient.DeleteFile(filename + ".docx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
Exemple #5
0
        public void SchemalockToExclusivelock()
        {
            // Upload a document
            SharepointClient.UploadFile(Word);
            // Refresh web address
            Browser.Goto(Browser.BaseAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".docx']"));

            // Open it in office word
            Browser.RClick(document);
            var elementOpenInWord = Browser.webDriver.FindElement(By.XPath("//div[@id='ID_EditIn_Word']"));

            Browser.Click(elementOpenInWord);
            Utility.CloseMicrosoftOfficeDialog();
            // Sign in office word and wait for it opening
            string username = ConfigurationManager.AppSettings["UserName"];
            string password = ConfigurationManager.AppSettings["Password"];

            Utility.OfficeSignIn(username, password);
            Utility.WaitForDocumentOpenning(filename);
            // Update the document content
            Word.Application wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            Word.Document    oDocument  = (Word.Document)wordToOpen.ActiveDocument;
            oDocument.Content.InsertBefore("SchemalockToExclusivelock");
            // Save and close and release word process
            oDocument.Save();
            Utility.CheckOutOnOpeningWord(filename);
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            Marshal.ReleaseComObject(oDocument);
            Marshal.ReleaseComObject(wordToOpen);
            SharepointClient.UnLockItem(filename + ".docx");
            // Delete the new upload document
            SharepointClient.DeleteFile(filename + ".docx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
        public void AuthorEncryption()
        {
            string oneEncryption = ConfigurationManager.AppSettings["OneEncryption"];
            string filename      = oneEncryption.Split('\\').Last().Split('.').First();

            // Upload a document
            SharepointClient.UploadFile(oneEncryption);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find onenote document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".one']"));

            // Click the document in root site
            Browser.Click(document);
            // Open Encryption onenote file online in Browser.
            Browser.Wait(By.Id("WebApplicationFrame"));
            Browser.webDriver.SwitchTo().Frame("WebApplicationFrame");
            Thread.Sleep(10000);
            SendKeys.SendWait("{Enter}");
            Thread.Sleep(3000);
            SendKeys.SendWait("{Enter}");
            Thread.Sleep(5000);
            SendKeys.SendWait("Password01!");
            Thread.Sleep(5000);
            SendKeys.SendWait("{Enter}");
            Thread.Sleep(5000);
            SendKeys.SendWait("Insert by onenote App~");
            Thread.Sleep(3000);
            // Close Onenote App
            SendKeys.SendWait("%{f4}");
            // Delete the new upload document
            SharepointClient.DeleteFile(filename + ".one");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
Exemple #7
0
        public void CoautherWithConflict()
        {
            // Upload a document
            SharepointClient.UploadFile(Word);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + wordFilename + ".docx']"));

            // Open document by office word
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Word"));
            var elementOpenInWord = Browser.webDriver.FindElement(By.LinkText("Open in Word"));

            Browser.Click(elementOpenInWord);

            // Close Microsoft office dialog and access using expected account
            Utility.WaitForDocumentOpenning(wordFilename, false, true);
            string username             = ConfigurationManager.AppSettings["UserName"];
            string password             = ConfigurationManager.AppSettings["Password"];
            bool   isWindowsSecurityPop = Utility.WaitForDocumentOpenning(wordFilename, false, true);

            if (isWindowsSecurityPop)
            {
                Utility.OfficeSignIn(username, password);
                Thread.Sleep(1000);
                Utility.OfficeSignIn(username, password);
            }

            // Wait for document is opened
            Utility.WaitForDocumentOpenning(wordFilename);
            // Get the opened word process, and edit it
            Word.Application wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            Thread.Sleep(1000);
            Word.Document oDocument = (Word.Document)wordToOpen.ActiveDocument;
            oDocument.Content.InsertBefore("HelloWordConfilict");
            // Click the document in root site
            Browser.Click(document);
            Browser.Wait(By.Id("WebApplicationFrame"));
            Browser.webDriver.SwitchTo().Frame("WebApplicationFrame");
            Thread.Sleep(2000);
            // Find and click "Edit Document" tab
            Browser.Wait(By.Id("flyoutWordViewerEdit-Medium20"));
            var editWord = Browser.FindElement(By.XPath("//a[@id='flyoutWordViewerEdit-Medium20']"), false);

            editWord.Click();
            // Find and click "Edit in Browser" tab
            var editInbrowser = Browser.webDriver.FindElement(By.XPath("//a[@id ='btnFlyoutEditOnWeb-Menu32']"));

            editInbrowser.Click();
            // Wait for document is opened
            Thread.Sleep(4000);
            Browser.Wait(By.XPath("//span[@id='BreadcrumbSaveStatus'][text()='Saved']"));
            Thread.Sleep(2000);
            // Edit it in online
            SendKeys.SendWait("HelloOfficeOnlineConflict");
            // Wait for online edit saved
            Thread.Sleep(3000);
            Browser.Wait(By.XPath("//span[@id='BreadcrumbSaveStatus'][text()='Saved']"));
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            Thread.Sleep(2000);
            // Save it in office word and close and release word process
            Utility.WordEditSave(wordFilename);
            Thread.Sleep(3000);
            Utility.CloseMicrosoftWordDialog(wordFilename, "OK");
            // Reslove conflict
            Utility.WordConflictMerge(wordFilename);
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            Marshal.ReleaseComObject(oDocument);
            Marshal.ReleaseComObject(wordToOpen);
            // Delete the new upload document
            SharepointClient.DeleteFile(wordFilename + ".docx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
Exemple #8
0
        public void VersioningHistroy()
        {
            // Upload a excel document.
            SharepointClient.UploadFile(excel);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + excelFilename + ".xlsx']"));

            // Open it by desktop Excel.
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Excel"));
            var elementOpenInExcel = Browser.webDriver.FindElement(By.LinkText("Open in Excel"));

            Browser.Click(elementOpenInExcel);

            // Sign in Excel Desktop App.
            Utility.WaitForExcelDocumentOpenning(excelFilename, true);
            string username             = ConfigurationManager.AppSettings["UserName"];
            string password             = ConfigurationManager.AppSettings["Password"];
            bool   isWindowsSecurityPop = Utility.WaitForExcelDocumentOpenning(excelFilename, true);

            if (isWindowsSecurityPop)
            {
                Utility.OfficeSignIn(username, password);
                Thread.Sleep(1500);
            }
            //Waiting for WindowsSecurity Pop up
            //Thread.Sleep(1000);
            isWindowsSecurityPop = Utility.WaitForExcelDocumentOpenning(excelFilename, true);
            if (isWindowsSecurityPop)
            {
                Utility.OfficeSignIn(username, password);
                Thread.Sleep(1500);
            }

            // Wait for excel is opened
            Utility.WaitForExcelDocumentOpenning(excelFilename, true);

            Excel.Application excelToOpen    = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
            Excel.Workbook    excelWorkbook  = (Excel.Workbook)excelToOpen.ActiveWorkbook;
            Excel.Worksheet   excelWorkSheet = (Excel.Worksheet)excelWorkbook.ActiveSheet;

            // Discard check out on opening excel if a newer version of this file is available on the server.
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "A newer version of this file is available on the server."))
            {
                Utility.DiscardCheckOutOnOpeningExcel(DocType.EXCEl, excelFilename);
            }

            // Click 'Edit Workbook' button if we opened this workbook read-only from the server.
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "We opened this workbook read-only from the server."))
            {
                Utility.EditExcelWorkbook(excelFilename);
            }

            Thread.Sleep(3000);

            // Edit Excel Cell Content.
            for (int i = 1; i < 2; i++)
            {
                excelWorkSheet.Cells[i, 1] = DateTime.Now.ToString();
            }

            // Close excel file.
            excelWorkbook.Save();
            excelWorkbook.Close();
            excelToOpen.Quit();

            // Open Excel File on Sharepoint Server again. Open it by Desktop Excel.

            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Excel"));
            elementOpenInExcel = Browser.webDriver.FindElement(By.LinkText("Open in Excel"));
            Browser.Click(elementOpenInExcel);

            Thread.Sleep(6000);
            excelToOpen    = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
            excelWorkbook  = (Excel.Workbook)excelToOpen.ActiveWorkbook;
            excelWorkSheet = (Excel.Worksheet)excelWorkbook.ActiveSheet;

            Thread.Sleep(6000);
            // Resolve 'UPLOAD FAILED'
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "We're sorry, someone updated the server copy and it's not possible to upload your changes now."))
            {
                Utility.ResloveUploadFailed(excelFilename, false);
            }

            //Version History Restore
            Utility.VersionHistroyRestore(excelFilename);

            // Click 'Edit Workbook' button if we opened this workbook read-only from the server.
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "We opened this workbook read-only from the server."))
            {
                Utility.EditExcelWorkbook(excelFilename);
            }

            // Close and release excel process
            excelToOpen   = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
            excelWorkbook = (Excel.Workbook)excelToOpen.ActiveWorkbook;
            Utility.DeleteDefaultExcelFormat();
            excelWorkbook.Close();
            excelToOpen.Quit();
            Marshal.ReleaseComObject(excelWorkbook);
            Marshal.ReleaseComObject(excelToOpen);

            // Delete the new upload document
            SharepointClient.DeleteFile(excelFilename + ".xlsx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
Exemple #9
0
        public void ExclusivelockCheck()
        {
            // Upload a document
            SharepointClient.UploadFile(excel);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + excelFilename + ".xlsx']"));

            // Open it by word
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Excel"));
            var elementOpenInExcel = Browser.webDriver.FindElement(By.LinkText("Open in Excel"));

            Browser.Click(elementOpenInExcel);

            // Sign in Excel Desktop App.
            Utility.WaitForExcelDocumentOpenning(excelFilename, true);
            string username             = ConfigurationManager.AppSettings["UserName"];
            string password             = ConfigurationManager.AppSettings["Password"];
            bool   isWindowsSecurityPop = Utility.WaitForExcelDocumentOpenning(excelFilename, true);

            if (isWindowsSecurityPop)
            {
                Utility.OfficeSignIn(username, password);
                Thread.Sleep(1500);
            }
            //Waiting for WindowsSecurity Pop up
            isWindowsSecurityPop = Utility.WaitForExcelDocumentOpenning(excelFilename, true);
            if (isWindowsSecurityPop)
            {
                Utility.OfficeSignIn(username, password);
                Thread.Sleep(1500);
            }

            // Wait for excel is opened
            // Sign in Excel Desktop App.
            Utility.WaitForExcelDocumentOpenning(excelFilename, false);

            // Discard check out on opening excel if a newer version of this file is available on the server.
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "A newer version of this file is available on the server."))
            {
                Utility.DiscardCheckOutOnOpeningExcel(DocType.EXCEl, excelFilename);
            }

            Thread.Sleep(1000);
            // Resolve 'UPLOAD FAILED'
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "We're sorry, someone updated the server copy and it's not possible to upload your changes now."))
            {
                Utility.ResloveUploadFailed(excelFilename, false);
            }

            // Go back to base address
            Browser.Goto(Browser.DocumentAddress);
            // Reopen the document in word
            document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + excelFilename + ".xlsx']"));
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Excel Online"));
            var elementOpenOnline = Browser.webDriver.FindElement(By.LinkText("Open in Excel Online"));

            Browser.Click(elementOpenOnline);
            // Sign in Excel Desktop App use UserName.
            Thread.Sleep(1000);
            Excel.Application excelToOpen   = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
            Excel.Workbook    excelWorkbook = (Excel.Workbook)excelToOpen.ActiveWorkbook;
            // Click 'Edit Workbook' button if we opened this workbook read-only from the server.
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "We opened this workbook read-only from the server."))
            {
                Utility.EditExcelWorkbook(excelFilename);
            }
            //Close FileInUsePane in Desktop Excel
            Utility.CloseExcelFileInUsePane(excelFilename);
            // Wait for CheckLockAvailability reqest show up.
            Thread.Sleep(100000);

            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "File Now Available"))
            {
                Utility.CloseExcelFileNowAvailable(excelFilename);
            }

            // Find 'READ-ONLY' close button.
            if (Utility.FindCondition(DocType.EXCEl, excelFilename, "This workbook is locked for editing by another user."))
            {
                Utility.CloseThisMessage();
            }

            // Close and release word process
            excelWorkbook.Close();
            excelToOpen.Quit();
            Marshal.ReleaseComObject(excelWorkbook);
            Marshal.ReleaseComObject(excelToOpen);

            // Delete the new upload document
            SharepointClient.DeleteFile(excelFilename + ".xlsx");
            Browser.Goto(Browser.DocumentAddress);

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
        public void CoauthorTableOfContents()
        {
            string oneWithFileData = ConfigurationManager.AppSettings["NotebookTableOfContents"];
            string filename        = oneWithFileData.Split('\\').Last().Split('.').First();

            // Upload a document
            SharepointClient.UploadFile(oneWithFileData);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement onetoc2           = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".onetoc2']"));
            string      DocumentWinHandle = Browser.webDriver.CurrentWindowHandle;

            // Open onetoc2 file in local Onenote App.
            Browser.RClick(onetoc2);
            Browser.Wait(By.LinkText("Open in OneNote"));
            var elementOpenInOneNote = Browser.webDriver.FindElement(By.LinkText("Open in OneNote"));

            Browser.Click(elementOpenInOneNote);
            Utility.WaitForOneNoteDocumentOpenning(filename, false, true);
            // Create a new section in local Onenote App.
            SendKeys.SendWait("^t");
            Thread.Sleep(8000);

            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find new create onenote section document on site
            IWebElement onenote = Browser.webDriver.FindElement(By.CssSelector("a[href*='New Section 1.one']"));

            Browser.Click(onenote);
            Thread.Sleep(4000);
            SendKeys.SendWait("New Page");
            //Thread.Sleep(10000);
            Thread.Sleep(3000);
            Browser.Wait(By.Id("WebApplicationFrame"));
            Browser.webDriver.SwitchTo().Frame("WebApplicationFrame");
            // Wait for online edit saved
            Thread.Sleep(3000);
            Browser.Wait(By.XPath("//a[@id='lblSyncStatus-Medium']/span[2][text()='Saving...']"));
            Thread.Sleep(10000);
            Browser.Wait(By.XPath("//a[@id='lblSyncStatus-Medium']/span[2][text()='Saved']"));
            Thread.Sleep(2000);

            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            Thread.Sleep(3000);
            onenote = Browser.webDriver.FindElement(By.CssSelector("a[href*='New Section 1.one']"));
            // Open OneNote document in local Onenote App
            Browser.RClick(onenote);
            Thread.Sleep(1000);
            Browser.Wait(By.LinkText("Open in OneNote"));
            elementOpenInOneNote = Browser.webDriver.FindElement(By.LinkText("Open in OneNote"));
            Browser.Click(elementOpenInOneNote);

            // Get the opened OneNote process, and read the page title.
            OneNote.Application oneNoteApp = new OneNote.Application();
            string oneNoteXml;
            var    oneNoteWindow = oneNoteApp.Windows.CurrentWindow;

            oneNoteApp.GetPageContent(oneNoteWindow.CurrentPageId, out oneNoteXml);
            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(oneNoteXml);
            var nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);

            nsmgr.AddNamespace("one", "http://schemas.microsoft.com/office/onenote/2013/onenote");
            string titleXpath = "//one:Page/one:Title/one:OE/one:T";

            System.Xml.XmlCDataSection titleNode = xmlDoc.SelectSingleNode(titleXpath, nsmgr).FirstChild as System.Xml.XmlCDataSection;
            // If its title in local Onenote App is not updated and wait.
            while (!titleNode.Value.Contains("New Page"))
            {
                Thread.Sleep(5000);
                oneNoteWindow = oneNoteApp.Windows.CurrentWindow;
                oneNoteApp.GetPageContent(oneNoteWindow.CurrentPageId, out oneNoteXml);
                xmlDoc.LoadXml(oneNoteXml);
                titleNode = xmlDoc.SelectSingleNode(titleXpath, nsmgr).FirstChild as System.Xml.XmlCDataSection;
            }

            // Closed OneNote App.
            oneNoteApp.Windows.CurrentWindow.Active = true;
            SendKeys.SendWait("%{F4}");
            // Delete the new created section document
            SharepointClient.DeleteFile("New Section 1" + ".one");
            // Delete the new upload document
            SharepointClient.DeleteFile(filename + ".onetoc2");
            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }