Skip to content

Commit

Permalink
[plugin-accessibility] Ensure attachment published when fail-fast ena…
Browse files Browse the repository at this point in the history
…bled
  • Loading branch information
ikalinin1 committed May 4, 2021
1 parent 18589b2 commit a5ca01b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public void checkAccessibility(List<AccessibilityCheckOptions> checkOptions)
.forEach(options -> {
List<AccessibilityViolation> violations = accessibilityTestEngine.analyze(options);
ViolationLevel level = options.getLevel();
publishAttachment(currentUrl, violations);
softAssert.assertThat(String.format(MESSAGE, level, currentUrl),
violations.stream().filter(v -> v.getTypeCode() <= level.getCode()).count(), equalTo(0L));
publishAttachment(currentUrl, violations);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ void shouldExecuteAccessibilityTest()
when(accessibilityTestEngine.analyze(second)).thenReturn(List.of());
accessibilitySteps.checkAccessibility(checkOptions);
InOrder ordered = Mockito.inOrder(softAssert, attachmentPublisher);
ordered.verify(softAssert).assertThat(
eq(ASSERTION_MESSAGE),
eq(2L),
argThat(m -> MATCHER.equals(m.toString())));
ordered.verify(attachmentPublisher).publishAttachment(TEMPLATE_NAME,
Map.of(WARNING2, Map.of(CODE, List.of(warning)),
NOTICE2, Map.of(CODE, List.of(notice)),
ERROR2, Map.of(CODE, List.of(error))), TITLE);
ordered.verify(softAssert).assertThat(
eq(ASSERTION_MESSAGE),
eq(0L),
eq(2L),
argThat(m -> MATCHER.equals(m.toString())));
ordered.verify(attachmentPublisher).publishAttachment(TEMPLATE_NAME,
Map.of(WARNING2, Map.of(),
ERROR2, Map.of(),
NOTICE2, Map.of()), TITLE);
ordered.verify(softAssert).assertThat(
eq(ASSERTION_MESSAGE),
eq(0L),
argThat(m -> MATCHER.equals(m.toString())));
}

private AccessibilityCheckOptions createOptions(AccessibilityStandard standard, ViolationLevel level,
Expand Down

0 comments on commit a5ca01b

Please sign in to comment.