Example #1
0
        public void HomePageWithComplexReport()
        {
            string reportPath = Path.Combine(LoggingConfig.GetLogDirectory(), "HomePageWithComplexReport.html");
            string rawResults = Path.Combine(LoggingConfig.GetLogDirectory(), "HomePageWithComplexReport.json");

            // Get to home page
            LoginPageModel page = new LoginPageModel(this.TestObject);

            page.OpenLoginPage();
            page.LoginWithValidCredentials(Config.GetGeneralValue("User"), Config.GetGeneralValue("Pass"));

            // Setup custom rules
            AxeBuilder builder = new AxeBuilder(WebDriver)
                                 .Exclude("#HomePage")
                                 .WithOutputFile(rawResults)
                                 .DisableRules("landmark-one-main", "page-has-heading-one");

            // Reprot
            WebDriver.CreateAxeHtmlReport(builder.Analyze(), reportPath);

            // Check if there were any violations
            if (!File.ReadAllText(reportPath).Contains("Violation: 0"))
            {
                TestObject.AddAssociatedFile(reportPath);
                TestObject.AddAssociatedFile(rawResults);
                Assert.Fail($"Failed violation check see {reportPath} for more details.");
            }
        }
Example #2
0
        public void LoginSubPageSubElementWithReport()
        {
            string reportPath = Path.Combine(LoggingConfig.GetLogDirectory(), "LoginSubPageWithReport.html");

            LoginPageModel page = new LoginPageModel(this.TestObject);

            page.OpenLoginPage();

            var jumbotron = WebDriver.FindElement(By.CssSelector(".jumbotron")) as IWrapsElement;

            WebDriver.CreateAxeHtmlReport(jumbotron.WrappedElement, reportPath);

            if (!File.ReadAllText(reportPath).Contains("Violation: 0"))
            {
                TestObject.AddAssociatedFile(reportPath);
                Assert.Fail($"Failed violation check see {reportPath} for more details.");
            }
        }
Example #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.");
            }
        }