Beispiel #1
0
        public void HtmlParagraph_InObjectRepository_Succeeds()
        {
            TestHtmlPage testpage = WebPage.Launch <TestHtmlPage>(CurrentDirectory + "\\TestHtmlPage.html");
            string       content  = testpage.p.InnerText;

            Assert.IsTrue(content.Contains("EnhancedHtmlParagraph"));
            testpage.Close();
        }
Beispiel #2
0
        public void Launch_GetWindowTitle_Succeeds()
        {
            // Arrange
            string url         = this.currentDirectory + "/TestHtmlPage.html";
            string windowTitle = "A Test";

            // Act
            TestHtmlPage window = BrowserWindowUnderTest.Launch <TestHtmlPage>(url);

            // Assert
            Assert.IsTrue(window.Title.Contains(windowTitle), window.Title);

            window.Close();
        }
        public void Launch_GetWindowTitle_Succeeds()
        {
            //Arrange
            string url             = CurrentDirectory + "/TestHtmlPage.html";
            string windowTitle     = "A Test";
            string fullWindowTitle = string.Format("{0} - Windows Internet Explorer", windowTitle);

            //Act
            TestHtmlPage window = WebPage.Launch <TestHtmlPage>(url);

            //Assert
            Assert.AreEqual(fullWindowTitle, window.Title);

            window.Close();
        }
Beispiel #4
0
        public void HtmlUnorderedListInObjectRepository_WithListItems_CanAssertOnListItems()
        {
            TestHtmlPage bWin = WebPage.Launch <TestHtmlPage>(CurrentDirectory + "/TestHtmlPage.html");

            List <EnhancedHtmlListItem> children = (from i in bWin.list.GetChildren()
                                                    select i as EnhancedHtmlListItem).ToList();

            Assert.AreEqual(3, children.Count());

            Assert.AreEqual(1, children.Count(x => x.InnerText == "List Item 1"));
            Assert.AreEqual(1, children.Count(x => x.InnerText == "List Item 2"));
            Assert.AreEqual(1, children.Count(x => x.InnerText == "List Item 3"));

            bWin.Close();
        }
Beispiel #5
0
        public void GetHtmlDocument_FromBrowserWindow_CanGetOuterHtmlProperty()
        {
            //Arrange
            TestHtmlPage window = BrowserWindowUnderTest.Launch <TestHtmlPage>(currentDirectory + "/TestHtmlPage.html");

            //Act
            var doc = window.Get <HtmlDocument>();

            //Assert
            const string expected = "<body>";

            Assert.AreEqual(expected, doc.UnWrap().GetProperty("OuterHtml").ToString().Substring(0, expected.Length), true);

            window.Close();
        }
        public void GetHtmlDocument_FromBrowserWindow_CanGetOuterHtmlProperty()
        {
            //Arrange
            TestHtmlPage window = WebPage.Launch <TestHtmlPage>(CurrentDirectory + "/TestHtmlPage.html");

            //Act
            EnhancedHtmlDocument doc = window.Get <EnhancedHtmlDocument>();

            //Assert
            string expected = "<BODY>";

            Assert.AreEqual(expected, doc.UnWrap().GetProperty("OuterHtml").ToString().Substring(0, expected.Length),
                            true);

            window.Close();
        }
        public void ShouldFindVisible()
        {
            //Arrange
            string url             = CurrentDirectory + "/TestHtmlPage.html";
            string windowTitle     = "A Test";
            string fullWindowTitle = string.Format("{0} - Windows Internet Explorer", windowTitle);

            //Act
            TestHtmlPage window = WebPage.Launch <TestHtmlPage>(url);

            //Assert
            Assert.IsFalse(window.hidden.IsVisible());
            Assert.IsFalse(window.displayNone.IsVisible());


            window.Close();
        }
Beispiel #8
0
        public void GetHtmlDocument_FromBrowserWindow_CanGetOuterHtmlProperty()
        {
            // Arrange
            TestHtmlPage window = BrowserWindowUnderTest.Launch <TestHtmlPage>(currentDirectory + "/TestHtmlPage.html");

            // Act
            var doc = window.Find <HtmlDocument>();

            // Assert
            // if Visual Studio Team System for Testers is installed, the vsttFireTimer attribute is automatically injected within the body element for some unknown reason
            // so just check for <body
            const string expected = "<body";

            string outerHtml = doc.SourceControl.GetProperty("OuterHtml").ToString();

            Assert.AreEqual(expected, outerHtml.Substring(0, expected.Length), true, outerHtml);

            window.Close();
        }
        public void CloseBrowserWindow_UsingLaunchedBrowserWindow_Succeeds()
        {
            TestHtmlPage window = WebPage.Launch <TestHtmlPage>(CurrentDirectory + "/TestHtmlPage.html");

            window.Close();
        }