Beispiel #1
0
        public void AccessibilityHtmlReportWithViolation()
        {
            WebDriver.Navigate().GoToUrl(TestSiteUrl);
            WebDriver.Wait().ForPageLoad();

            WebDriver.CreateAccessibilityHtmlReport(this.TestObject, true);
        }
Beispiel #2
0
        public void AccessibilityHtmlReportWithElement()
        {
            WebDriver.Navigate().GoToUrl(TestSiteAutomationUrl);
            WebDriver.Wait().ForPageLoad();

            WebDriver.CreateAccessibilityHtmlReport(this.TestObject, WebDriver.FindElement(By.Id("FoodTable")));

            string file = this.TestObject.GetArrayOfAssociatedFiles().Last(x => x.EndsWith(".html"));

            Assert.IsTrue(new FileInfo(file).Length > 0, "Accessibility report is empty");
        }
Beispiel #3
0
        public void AccessibilityHtmlReportWithError()
        {
            WebDriver.Navigate().GoToUrl(TestSiteUrl);
            WebDriver.Wait().ForPageLoad();

            WebDriver.CreateAccessibilityHtmlReport(this.TestObject, () => new AxeResult(JObject.Parse(AxeResultWithError)));

            string file = this.TestObject.GetArrayOfAssociatedFiles().Last(x => x.EndsWith(".html"));

            Assert.IsTrue(new FileInfo(file).Length > 0, "Accessibility report is empty");
        }
Beispiel #4
0
        public void ElementAccessibilityHtmlWithFilter()
        {
            WebDriver.Navigate().GoToUrl(TestSiteUrl);
            WebDriver.Wait().ForPageLoad();

            var report = File.ReadAllText(WebDriver.CreateAccessibilityHtmlReport(this.TestObject, WebDriver.FindElement(By.CssSelector("BODY")), false, ReportTypes.Incomplete));

            Assert.IsFalse(report.Contains("Violation:"), "Expected not to have violation check");
            Assert.IsTrue(report.Contains("Incomplete:"), "Expected to have incomplete check");
            Assert.IsFalse(report.Contains("Pass:"******"Expected not to have pass check");
            Assert.IsFalse(report.Contains("Inapplicable:"), "Expected not to have inapplicable check");
        }
Beispiel #5
0
        public void DriverAccessibilityHtmlWithoutFilter()
        {
            WebDriver.Navigate().GoToUrl(TestSiteUrl);
            WebDriver.Wait().ForPageLoad();

            var report = File.ReadAllText(WebDriver.CreateAccessibilityHtmlReport(this.TestObject));

            Assert.IsTrue(report.Contains("Violation:"), "Expected to have violation check");
            Assert.IsTrue(report.Contains("Incomplete:"), "Expected to have incomplete check");
            Assert.IsTrue(report.Contains("Pass:"******"Expected to have pass check");
            Assert.IsTrue(report.Contains("Inapplicable:"), "Expected to have inapplicable check");
        }
Beispiel #6
0
        public void AccessibilityHtmlLogSuppression()
        {
            // Make sure we are not using verbose logging
            this.Log.SetLoggingLevel(MessageType.INFORMATION);

            WebDriver.Navigate().GoToUrl(TestSiteAutomationUrl);
            WebDriver.Wait().ForPageLoad();

            WebDriver.CreateAccessibilityHtmlReport(this.TestObject);

            // The script executed message should be suppressed when we run the accessablity check
            Assert.IsFalse(File.ReadAllText(((IFileLogger)this.Log).FilePath).Contains("Script executed"), "Logging was not suppressed as expected");
        }
Beispiel #7
0
        public void AccessibilityMultipleHtmlReports()
        {
            WebDriver.Navigate().GoToUrl(TestSiteUrl);
            WebDriver.Wait().ForPageLoad();

            // Create 3 reports
            WebDriver.CreateAccessibilityHtmlReport(this.TestObject);
            WebDriver.CreateAccessibilityHtmlReport(this.TestObject);
            WebDriver.CreateAccessibilityHtmlReport(this.TestObject);

            int count = this.TestObject.GetArrayOfAssociatedFiles().Count(x => x.EndsWith(".html"));

            Assert.IsTrue(count == 3, $"Expected 3 accessibility reports but see {count} instead");
        }