コード例 #1
0
        public void RunScanOnGivenElement(string browser)
        {
            InitDriver(browser);
            LoadSimpleTestPage();

            var mainElement = Wait.Until(drv => drv.FindElement(By.TagName(mainElementSelector)));

            AxeResult results = WebDriver.Analyze(mainElement);

            results.Violations.Should().HaveCount(3);
        }
コード例 #2
0
        public void LoginPageBasic()
        {
            LoginPageModel page = new LoginPageModel(this.TestObject);

            page.OpenLoginPage();

            AxeResult result = WebDriver.Analyze();

            var resultJson = JsonConvert.SerializeObject(result, Formatting.Indented);

            Assert.IsTrue(string.IsNullOrEmpty(result.Error) && result.Violations.Length == 0, "Failures:" + resultJson);
        }
コード例 #3
0
        public void LoginPageWithReport()
        {
            string reportPath = Path.Combine(LoggingConfig.GetLogDirectory(), "LoginPageWithReport.html");

            LoginPageModel page = new LoginPageModel(this.TestObject);

            page.OpenLoginPage();

            AxeResult result = WebDriver.Analyze();

            WebDriver.CreateAxeHtmlReport(result, reportPath);

            if (!string.IsNullOrEmpty(result.Error) || result.Violations.Length != 0)
            {
                TestObject.AddAssociatedFile(reportPath);
                Assert.Fail($"Failed error and/or violation check see {reportPath} for more details.");
            }
        }