Beispiel #1
0
        private void PerformXenonAction(Func <BaseXenonTest <T>, BaseXenonTest <T> > xenonAction)
        {
            var html = XenonTestsResourceLookup.GetContent("DoesNotContain");

            using (var browserTest = new BrowserTest(html))
            {
                var browser = browserTest.Start();
                xenonAction(CreateInstance(browser).GoToUrl("/"));
            }
        }
        private void StartTest(string fileName, Func <XenonTest, XenonTest> testFunc)
        {
            var html = XenonTestsResourceLookup.GetContent(fileName);

            using (var bt = new BrowserTest(html))
            {
                var browser   = bt.Start();
                var xenonTest = new XenonTest(browser)
                                .GoToUrl("/");
                testFunc(xenonTest);
            }
        }
Beispiel #3
0
        public void GettingTextOfInput_ReturnsValueOfInput(string inputType, string expectedValue)
        {
            var html = XenonTestsResourceLookup.GetContent("InputTests");

            using (var browserTest = new BrowserTest(html))
            {
                var browser = browserTest.Start();

                new DummyXenonScreen(browser)
                .GoToUrl("/")
                .Assert(x => x.CustomAssertion(y => y.FindElementsByCssSelector(String.Format("input[type='{0}']", inputType)).First().Text == expectedValue));
            }
        }
Beispiel #4
0
        public void GettingTextOfInput_ReturnsValueOfInput(string inputType, string expectedValue)
        {
            var html = XenonTestsResourceLookup.GetContent("InputTests");

            using (var browserTest = new BrowserTest(html))
            {
                var browser = browserTest.Start();

                new DummyXenonScreen(browser)
                .GoToUrl("/")
                .Assert(x => InputHasExpectedValue(inputType, expectedValue, x));
            }
        }
Beispiel #5
0
 public void AssertPageContains_WithElementsOnPage_ChecksInputValues()
 {
     var html = XenonTestsResourceLookup.GetContent( "PageWithInputs" );
     using ( var bt = new BrowserTest( html ) )
     {
         var browser = bt.Start();
         CreateInstance( browser )
             .GoToUrl( "/" )
             .Click( where => where.TextIs( "Fill Form" ) )
             .Assert( a => a.PageContains( "First Name" ) )
             .Assert( a => a.PageContains( "Description Content" ) );
     }
 }
        private void ArrangeActAndAssert(string linkText, string assertResultContainsText)
        {
            var html = XenonTestsResourceLookup.GetContent("PageWithDialogBoxes");

            using (var bt = new BrowserTest(html))
            {
                var browser = bt.Start();
                CreateInstance(browser)
                .GoToUrl("/")
                .Click(where => where.TextIs(linkText))
                .ClickDialogBox()
                .Assert(a => a.ContainsElement(where => where.TextIs(assertResultContainsText)));
            }
        }
        public void CancelDialogBox_DialogBoxIsActive_CancelDialogBox()
        {
            var html = XenonTestsResourceLookup.GetContent("PageWithDialogBoxes");

            using (var bt = new BrowserTest(html))
            {
                var browser = bt.Start();
                CreateInstance(browser)
                .GoToUrl("/")
                .Click(where => where.TextIs("Confirm Box"))
                .CancelDialogBox()
                .Assert(a => a.ContainsElement(where => where.TextIs("Cancelled Confirm Dialog box")));
            }
        }
Beispiel #8
0
        public void ClickDialogBox_AlertDialogBoxIsActive_ClickIt()
        {
            var html = XenonTestsResourceLookup.GetContent("ScrollToElement");

            using (var bt = new BrowserTest(html))
            {
                var browser = bt.Start();
                CreateInstance(browser)
                .GoToUrl("/")
                .Click(where => where.TextIs("Click"));

                Assert.AreEqual("worked", bt.GetPostResult()["temp"]);
            }
        }
        public void MoveToElement_WhenMovingToElement_MovesToElement()
        {
            var html = XenonTestsResourceLookup.GetContent("MoveToElement");

            using (var browserTest = new BrowserTest(html))
            {
                var browser = browserTest.Start();

                CreateInstance(browser)
                .GoToUrl("/")
                .MoveToElement("#element");

                Assert.AreEqual("worked", browserTest.GetPostResult()["temp"]);
            }
        }
        public void CanCloseAndSwitchToAnotherWindow()
        {
            var html = XenonTestsResourceLookup.GetContent("SwitchBetweenMultipleWindows");

            using (var browserTest = new BrowserTest(html))
            {
                var browser = browserTest.Start();
                CreateInstance(browser)
                .GoToUrl("/")
                .Click(where => where.TextIs("Google"))
                .SwitchToWindow(a => a.PageContains("I'm Feeling Lucky"))
                .Assert(a => a.PageContains("I'm Feeling Lucky"))
                .CloseCurrentAndSwitchToWindow(a => a.PageContains("Test Page"))
                .Assert(a => a.PageContains("Test Page"));
            }
        }
        public void EnterTextInDialogBox_PromptDialogBoxIsActive_CanEnterTextInIt()
        {
            const string text = "Test1234";

            var html = XenonTestsResourceLookup.GetContent("PageWithDialogBoxes");

            using (var bt = new BrowserTest(html))
            {
                var browser = bt.Start();
                CreateInstance(browser)
                .GoToUrl("/")
                .Click(where => where.TextIs("Prompt Box Enter Text"))
                .EnterTextInDialogBox(text)
                .ClickDialogBox()
                .Assert(a => a.ContainsElement(where => where.TextIs(text)));
            }
        }
Beispiel #12
0
 private string GetHtml()
 {
     return(XenonTestsResourceLookup.GetContent("DatePicker"));
 }