예제 #1
0
        public void CanSelectTabs()
        {
            var paragraph = Browser.FindElement(By.Id("basic-tabs"));
            var links     = paragraph.FindElements(By.TagName("a"));
            var content   = paragraph.FindElement(By.ClassName("tab-content"));
            var panels    = content.FindElements(By.TagName("div"));

            Assert.NotEmpty(links);
            Assert.NotEmpty(panels);

            WaitAssert.False(() => links[0].GetAttribute("class").Contains("show"));
            WaitAssert.True(() => links[1].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => links[2].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => panels[0].GetAttribute("class").Contains("show"));
            WaitAssert.True(() => panels[1].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => panels[2].GetAttribute("class").Contains("show"));

            links[0].Click();
            WaitAssert.True(() => links[0].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => links[1].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => links[2].GetAttribute("class").Contains("show"));
            WaitAssert.True(() => panels[0].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => panels[1].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => panels[2].GetAttribute("class").Contains("show"));

            links[2].Click();
            WaitAssert.False(() => links[0].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => links[1].GetAttribute("class").Contains("show"));
            WaitAssert.True(() => links[2].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => panels[0].GetAttribute("class").Contains("show"));
            WaitAssert.False(() => panels[1].GetAttribute("class").Contains("show"));
            WaitAssert.True(() => panels[2].GetAttribute("class").Contains("show"));
        }
예제 #2
0
        public void BenchmarksRunWithoutError()
        {
            // In CI, we only verify that the benchmarks run without throwing any
            // errors. To get actual perf numbers, you must run the E2EPerformance
            // site manually.
            var verifyOnlyLabel = Browser.FindElement(By.XPath("//label[contains(text(), 'Verify only')]/input"));

            verifyOnlyLabel.Click();

            var runAllButton = Browser.FindElement(By.CssSelector("button.btn-success.run-button"));

            runAllButton.Click();

            // The "run" button goes away while the benchmarks execute, then it comes back
            WaitAssert.False(() => runAllButton.Displayed);
            WaitAssert.True(
                () => runAllButton.Displayed || Browser.FindElements(By.CssSelector(".benchmark-error")).Any(),
                TimeSpan.FromSeconds(60));

            var finishedBenchmarks = Browser.FindElements(By.CssSelector(".benchmark-idle"));
            var failedBenchmarks   = Browser.FindElements(By.CssSelector(".benchmark-error"));

            Assert.NotEmpty(finishedBenchmarks);
            Assert.Empty(failedBenchmarks);
        }
예제 #3
0
        public void CanValidateStringWithEvent_InitiallySelected()
        {
            var paragraph = Browser.FindElement(By.Id("validate-string-with-event-initially-selected"));
            var select    = new SelectElement(paragraph.FindElement(By.TagName("select")));

            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.SelectByIndex(1);
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.SelectByIndex(0);
            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));
        }
예제 #4
0
        public void CanValidateEnumWithBind_InitiallyBlank()
        {
            var paragraph = Browser.FindElement(By.Id("validate-enum-with-bind-initially-blank"));
            var select    = new SelectElement(paragraph.FindElement(By.TagName("select")));

            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.SelectByIndex(1);
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.SelectByIndex(0);
            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));
        }
예제 #5
0
        public void CanValidateTextWithEvent_InitiallyPopulated()
        {
            var paragraph = Browser.FindElement(By.Id("validate-text-with-event-initially-populated"));
            var edit      = paragraph.FindElement(By.TagName("input"));

            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            edit.SendKeys(Keys.Backspace);
            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            edit.SendKeys("b");
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));
        }
예제 #6
0
        public void CanValidateTextWithBind_InitiallyBlank()
        {
            var paragraph = Browser.FindElement(By.Id("validate-text-with-bind-initially-blank"));
            var edit      = paragraph.FindElement(By.TagName("input"));

            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            edit.SendKeys("a");
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            edit.SendKeys(Keys.Backspace);
            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));
        }
        public void CanValidateNumericWithEvent_InitiallyBlank()
        {
            var paragraph = Browser.FindElement(By.Id("validate-numeric-with-event-initially-blank"));
            var edit      = paragraph.FindElement(By.TagName("input"));

            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            edit.SendKeys("1");
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            edit.SendKeys(Keys.Backspace);
            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));
        }
예제 #8
0
        public void CanValidateText_InitiallyPopulated()
        {
            var paragraph = Browser.FindElement(By.Id("validate-text-initially-populated"));
            var edit      = paragraph.FindElement(By.TagName("input"));

            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            // although input should be cleared it will be reset to the default value
            edit.SendKeys(Keys.Backspace);
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            edit.SendKeys("b");
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));
        }
예제 #9
0
        public void CanBindCheckbox_InitiallyChecked()
        {
            var target       = Browser.FindElement(By.Id("checkbox-initially-checked"));
            var boundValue   = Browser.FindElement(By.Id("checkbox-initially-checked-value"));
            var invertButton = Browser.FindElement(By.Id("checkbox-initially-checked-invert"));

            Assert.True(target.Selected);
            Assert.Equal("True", boundValue.Text);

            // Modify target; verify value is updated
            target.Click();
            WaitAssert.False(() => target.Selected);
            WaitAssert.Equal("False", () => boundValue.Text);

            // Modify data; verify checkbox is updated
            invertButton.Click();
            WaitAssert.True(() => target.Selected);
            WaitAssert.Equal("True", () => boundValue.Text);
        }
예제 #10
0
        public void CanValidateMultiString_InitiallyBlank()
        {
            var paragraph = Browser.FindElement(By.Id("validate-multi-string-initially-blank"));
            var select    = new SelectElement(paragraph.FindElement(By.TagName("select")));

            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.SelectByIndex(1);
            select.SelectByIndex(2);
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.DeselectByIndex(1);
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.DeselectByIndex(2);
            WaitAssert.True(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));

            select.SelectByIndex(0);
            WaitAssert.False(() => paragraph.ElementIsPresent(By.ClassName("invalid-feedback")));
        }