Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

Commit

Permalink
updates for accessibility module
Browse files Browse the repository at this point in the history
  • Loading branch information
jonreding2010 committed Jun 7, 2021
1 parent 7a98283 commit c82d423
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public void testAccessibilityHtmlReport() throws IOException, ParseException {
String filePath = Arrays.stream(this.getTestObject().getArrayOfAssociatedFiles())
.filter(x -> x.contains(".html")).findFirst().map(Object::toString).orElse("");
Assert.assertTrue(filePath.length() > 0, "Accessibility report is empty");
deleteFiles(Arrays.asList(this.getTestObject().getArrayOfAssociatedFiles()));
}

/**
Expand All @@ -92,7 +91,6 @@ public void accessibilityMultipleHtmlReports() throws IOException, ParseExceptio
.filter(x -> x.contains(".html")).count();
Assert.assertEquals(count, 3,
"Expected 3 accessibility reports but see " + count + " instead");
deleteFiles(Arrays.asList(this.getTestObject().getArrayOfAssociatedFiles()));
}

/**
Expand Down Expand Up @@ -129,10 +127,9 @@ public void accessibilityHtmlReportWithErrorFromLazyElement() throws IOException
* Verify we throw an exception if there are violations and we choose the throw exception option.
* @throws IOException if an exception is thrown
*/
@Test(groups = TestCategories.ACCESSIBILITY, expectedExceptions = AxeRuntimeException.class)
@Test(groups = TestCategories.ACCESSIBILITY, expectedExceptions = RuntimeException.class)
public void accessibilityHtmlReportWithViolation() throws IOException, ParseException {
AccessibilityUtilities.createAccessibilityHtmlReport(this.getTestObject(), true);
deleteFiles(Arrays.asList(this.getTestObject().getArrayOfAssociatedFiles()));
}

/**
Expand All @@ -153,7 +150,6 @@ public void accessibilityHtmlReportWithLazyElement() throws IOException, ParseEx
String filePath = Arrays.stream(this.getTestObject().getArrayOfAssociatedFiles())
.filter(x -> x.contains(".html")).findFirst().map(Object::toString).orElse("");
Assert.assertFalse(filePath.isEmpty(), "Accessibility report is empty");
deleteFiles(Arrays.asList(this.getTestObject().getArrayOfAssociatedFiles()));
}

/**
Expand Down Expand Up @@ -196,7 +192,6 @@ public void accessibilityHtmlLogSuppression() throws IOException, ParseException
String file = IOUtils.toString(fis, StandardCharsets.UTF_8);

Assert.assertFalse(file.contains("Script executed"), "Logging was not suppressed as expected.");
deleteFiles(Arrays.asList(this.getTestObject().getArrayOfAssociatedFiles()));
}

/**
Expand All @@ -218,7 +213,6 @@ public void accessibilityHtmlReportViolationsOnly() throws IOException, ParseExc
Assert.assertFalse(fileString.contains("Passes "), "Passes were still in the report");
Assert.assertFalse(fileString.contains("Inapplicable "), "Inapplicable were still in the report");
Assert.assertFalse(fileString.contains("Incomplete "), "Incomplete were still in the report");
deleteFiles(Arrays.asList(this.getTestObject().getArrayOfAssociatedFiles()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void testAccessibilityViolationsCheckRespectsMessageLevel() {
/**
* Verify accessibility exception will be thrown.
*/
@Test(groups = TestCategories.ACCESSIBILITY, expectedExceptions = AxeRuntimeException.class)
@Test(groups = TestCategories.ACCESSIBILITY, expectedExceptions = RuntimeException.class)
public void testAccessibilityCheckThrows() {
AccessibilityUtilities.checkAccessibility(getTestObject(), true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void reportSampleResults() throws IOException, ParseException {
Document doc = Jsoup.parse(text);

String errorMessage = doc.selectFirst("#ErrorMessage").text();
Assert.assertEquals(errorMessage, "java.lang.Exception: AutomationError");
Assert.assertEquals(errorMessage, "AutomationError");

String reportContext = doc.selectFirst("#reportContext").text();
Assert.assertTrue(reportContext.contains("Url: https://www.google.com/"), "URL is not in the document");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,51 @@
* Test category type.
*/
public class TestCategories {


private TestCategories() {
}

/**
* String for database unit test category.
* String for Accessibility unit test category.
*/
public static final String DATABASE = "Database Unit Tests";
public static final String ACCESSIBILITY = "Accessibility Unit Tests";

/**
* String for email unit test category.
* String for Appium unit test category.
*/
public static final String EMAIL = "Email Unit Tests";
public static final String APPIUM = "Appium Unit Tests";

/**
* String for Selenium unit test category.
* String for Cucumber unit test category.
*/
public static final String SELENIUM = "Selenium Unit Tests";
public static final String CUCUMBER = "Cucumber Unit Tests";

/**
* String for utilities unit test category.
* String for database unit test category.
*/
public static final String UTILITIES = "Utilities Unit Tests";
public static final String DATABASE = "Database Unit Tests";

/**
* String for web service unit test category.
* String for email unit test category.
*/
public static final String WEB_SERVICE = "Web Service Unit Tests";
public static final String EMAIL = "Email Unit Tests";

/**
* String for base framework unit test category.
*/
public static final String FRAMEWORK = "Base Framework Unit Tests";

/**
* String for Appium unit test category.
* String for Selenium unit test category.
*/
public static final String APPIUM = "Appium Unit Tests";
public static final String SELENIUM = "Selenium Unit Tests";

/**
* String for Cucumber unit test category.
* String for utilities unit test category.
*/
public static final String CUCUMBER = "Cucumber Unit Tests";
public static final String UTILITIES = "Utilities Unit Tests";

/**
* String for web service unit test category.
*/
public static final String WEB_SERVICE = "Web Service Unit Tests";
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ protected Logger(MessageType level) {
this.logLevel = level;
}

/**
* Gets the logging level.
* @return the Message Type
*/
public MessageType getLoggingLevel() {
return this.logLevel;
}

/**
* Set the logging level.
*
Expand Down

0 comments on commit c82d423

Please sign in to comment.