Пример #1
0
        public ActionResult ShowDocument()
        {
            string            uniqueId = this.RouteData.Values["uniqueId"].ToString();
            DocumentPageModel model    = new DocumentPageModel(uniqueId);

            return(View(model));
        }
        public void TheAddEditDeleteDocumentTest()
        {
            DocumentPageModel document = new DocumentPageModel(driver);

            TestName = MethodBase.GetCurrentMethod().Name.Replace("The", "").Replace("Test", "");

            navigation.Configuration.Click();
            navigation.Documents.Click();

            for (int second = 0; ; second++)
            {
                if (second >= 60) Assert.Fail("timeout");
                try
                {
                    if (document.DocumentFrame.Displayed) break;
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            driver.SwitchTo().Frame(document.DocumentFrame);
            document.AddButton.Click();
            document.Name.Clear();
            document.Name.SendKeys("Penguins");
            document.Image.Clear();
            document.Image.SendKeys("H:\\PMO\\Test Services\\Automation\\UploadFiles\\Penguins.jpg");
            document.SaveButton.Click();

            Thread.Sleep(2000);

            shared.TakeScreenShot(driver, "NewDocument" + DateTime.Now.ToString("ddMMyyyyHHmmss"));

            document.SearchText.Clear();
            document.SearchText.SendKeys("penguins");
            document.SearchButton.Click();

            document.EditButton.Click();
            document.Name.Clear();
            document.Name.SendKeys("3 Penguins");
            document.SaveButton.Click();

            Thread.Sleep(2000);

            shared.TakeScreenShot(driver, "EditedDocument" + DateTime.Now.ToString("ddMMyyyyHHmmss"));

            document.ResetSearch.Click();
            document.SearchText.Clear();
            document.SearchText.SendKeys("penguins");
            document.SearchButton.Click();

            document.DeleteButton.Click();
            navigation.ConfirmPopup.Click();

            shared.TakeScreenShot(driver, "DeletedDocument" + DateTime.Now.ToString("ddMMyyyyHHmmss"));

            driver.SwitchTo().DefaultContent();

            Logout();
        }