Search in sources :

Example 11 with ElementChecker

use of org.asqatasun.rules.elementchecker.ElementChecker in project Asqatasun by Asqatasun.

the class Rgaa40Rule081002 method check.

@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
    if (dirAttributeWithAllowedValue.isEmpty() && dirAttributeWithNotAllowedValue.isEmpty()) {
        testSolutionHandler.addTestSolution(TestSolution.NOT_APPLICABLE);
        totalNumberOfElements = 0;
        return;
    }
    // Tags with dir attribute (with not allowed value)
    ElementChecker dirAttributeWithNotAllowedValueChecker = new ElementPresenceChecker(new ImmutablePair(TestSolution.FAILED, DIR_ATTRIBUTE_WITH_NOT_ALLOWED_VALUE_MSG), new ImmutablePair(TestSolution.PASSED, ""), DIR_ATTR, TEXT_ELEMENT2);
    dirAttributeWithNotAllowedValueChecker.check(sspHandler, dirAttributeWithNotAllowedValue, testSolutionHandler);
    // Tags with dir attribute (with allowed value)
    ElementChecker dirAttributeWithAllowedValueChecker = new ElementPresenceChecker(new ImmutablePair(TestSolution.NEED_MORE_INFO, DIR_ATTRIBUTE_WITH_ALLOWED_VALUE_MSG), new ImmutablePair(TestSolution.PASSED, ""), DIR_ATTR, TEXT_ELEMENT2);
    dirAttributeWithAllowedValueChecker.check(sspHandler, dirAttributeWithAllowedValue, testSolutionHandler);
}
Also used : ElementPresenceChecker(org.asqatasun.rules.elementchecker.element.ElementPresenceChecker) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Example 12 with ElementChecker

use of org.asqatasun.rules.elementchecker.ElementChecker in project Asqatasun by Asqatasun.

the class Rgaa40Rule010202 method check.

@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
    ElementChecker passedOnPresenceChecker = new ElementPresenceChecker(new ImmutablePair<>(PASSED, ""), new ImmutablePair<>(NOT_APPLICABLE, ""), eeList);
    passedOnPresenceChecker.check(sspHandler, areaAriaHiddenWithMarkerHandler, testSolutionHandler);
    ElementChecker areaWithNotEmptyAlternativeWithMarkerChecker = new ElementPresenceChecker(new ImmutablePair<>(FAILED, DECORATIVE_ELEMENT_WITH_NOT_EMPTY_TEXTUAL_ALTERNATIVE_MSG), new ImmutablePair<>(NOT_APPLICABLE, ""), eeList);
    areaWithNotEmptyAlternativeWithMarkerChecker.check(sspHandler, areaWithNotEmptyAlternativeWithMarkerHandler, testSolutionHandler);
    passedOnPresenceChecker.check(sspHandler, areaWithEmptyAlternativeWithMarkerHandler, testSolutionHandler);
    ElementChecker areaWithNotEmptyAlternativeWithoutMarkerChecker = new ElementPresenceChecker(new ImmutablePair<>(NEED_MORE_INFO, CHECK_NATURE_OF_IMAGE_WITH_TEXTUAL_ALTERNATIVE_MSG), new ImmutablePair<>(NOT_APPLICABLE, ""), eeList);
    areaWithNotEmptyAlternativeWithoutMarkerChecker.check(sspHandler, areaWithNotEmptyAlternativeWithoutMarkerHandler, testSolutionHandler);
    ElementChecker areaAriaHiddenWithoutMarkerChecker = new ElementPresenceChecker(new ImmutablePair<>(NEED_MORE_INFO, CHECK_NATURE_OF_IMAGE_HIDDEN_WITH_ARIA_MSG), new ImmutablePair<>(NOT_APPLICABLE, ""), eeList);
    areaAriaHiddenWithoutMarkerChecker.check(sspHandler, areaAriaHiddenWithoutMarkerHandler, testSolutionHandler);
    ElementChecker areaWithEmptyAlternativeWithoutMarkerChecker = new ElementPresenceChecker(new ImmutablePair<>(NEED_MORE_INFO, CHECK_NATURE_OF_IMAGE_WITHOUT_TEXTUAL_ALTERNATIVE_MSG), new ImmutablePair<>(NOT_APPLICABLE, ""), eeList);
    areaWithEmptyAlternativeWithoutMarkerChecker.check(sspHandler, areaWithEmptyAlternativeWithoutMarkerHandler, testSolutionHandler);
}
Also used : ElementPresenceChecker(org.asqatasun.rules.elementchecker.element.ElementPresenceChecker) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Example 13 with ElementChecker

use of org.asqatasun.rules.elementchecker.ElementChecker in project Asqatasun by Asqatasun.

the class Aw22Rule05081 method check.

@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
    super.check(sspHandler, testSolutionHandler);
    ElementChecker ec;
    if (!notIdentifiedTableWithoutDataTableMarkup.isEmpty()) {
        ec = new ElementPresenceChecker(// nmi when element is found
        TestSolution.NEED_MORE_INFO, // na when element is not found
        TestSolution.NOT_APPLICABLE, // message associated when element is found
        CHECK_TABLE_IS_PRESENTATION_TABLE_MSG, // no message created when child element is not found
        null);
        ec.check(sspHandler, notIdentifiedTableWithoutDataTableMarkup, testSolutionHandler);
    }
    if (!presentationTableWithoutDataTableMarkup.isEmpty()) {
        ec = new ElementPresenceChecker(TestSolution.PASSED, // na when element is not found
        TestSolution.NOT_APPLICABLE, // message associated when element is found
        null, // no message created when child element is not found
        null);
        ec.check(sspHandler, presentationTableWithoutDataTableMarkup, testSolutionHandler);
    }
}
Also used : ElementPresenceChecker(org.asqatasun.rules.elementchecker.element.ElementPresenceChecker) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Example 14 with ElementChecker

use of org.asqatasun.rules.elementchecker.ElementChecker in project Asqatasun by Asqatasun.

the class Rgaa22Rule06141 method checkButtonSelection.

@Override
protected void checkButtonSelection(SSPHandler sspHandler, ElementHandler formButtonHandler, TestSolutionHandler testSolutionHandler) {
    if (formButtonHandler.isEmpty()) {
        return;
    }
    // checker used to create remark on form elements
    ElementChecker ec = new ElementPresenceChecker(// nmi when element is found
    TestSolution.NEED_MORE_INFO, // na when element is not found
    TestSolution.NOT_APPLICABLE, // message associated with each found form element
    CHECK_BUTTON_TITLE_PERTINENCE_MSG, null, TEXT_ELEMENT2, VALUE_ATTR);
    ec.check(sspHandler, formButtonHandler, testSolutionHandler);
}
Also used : ElementPresenceChecker(org.asqatasun.rules.elementchecker.element.ElementPresenceChecker) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Example 15 with ElementChecker

use of org.asqatasun.rules.elementchecker.ElementChecker in project Asqatasun by Asqatasun.

the class Rgaa22Rule06161 method check.

@Override
protected void check(SSPHandler sspHandler, TestSolutionHandler testSolutionHandler) {
    if (getElements().isEmpty()) {
        testSolutionHandler.addTestSolution(TestSolution.NOT_APPLICABLE);
        return;
    }
    if (emptyLinksHandler.isEmpty()) {
        testSolutionHandler.addTestSolution(TestSolution.PASSED);
        return;
    }
    ElementChecker ec = new ElementPresenceChecker(TestSolution.FAILED, TestSolution.PASSED, EMPTY_LINK_MSG, null, HREF_ATTR);
    ec.check(sspHandler, emptyLinksHandler, testSolutionHandler);
}
Also used : ElementPresenceChecker(org.asqatasun.rules.elementchecker.element.ElementPresenceChecker) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Aggregations

ElementChecker (org.asqatasun.rules.elementchecker.ElementChecker)39 ElementPresenceChecker (org.asqatasun.rules.elementchecker.element.ElementPresenceChecker)30 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)21 HashMap (java.util.HashMap)8 Map (java.util.Map)8 ElementHandler (org.asqatasun.ruleimplementation.ElementHandler)8 ElementWithAttributePresenceChecker (org.asqatasun.rules.elementchecker.element.ElementWithAttributePresenceChecker)5 TextEmptinessChecker (org.asqatasun.rules.elementchecker.text.TextEmptinessChecker)5 TextAttributeOfElementBuilder (org.asqatasun.rules.textbuilder.TextAttributeOfElementBuilder)5 Element (org.jsoup.nodes.Element)5 ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)4 AttributePresenceChecker (org.asqatasun.rules.elementchecker.attribute.AttributePresenceChecker)4 IdUnicityChecker (org.asqatasun.rules.elementchecker.attribute.IdUnicityChecker)3 TextLengthChecker (org.asqatasun.rules.elementchecker.text.TextLengthChecker)2 TestSolution (org.asqatasun.entity.audit.TestSolution)1 TextBelongsToBlackListChecker (org.asqatasun.rules.elementchecker.text.TextBelongsToBlackListChecker)1 TextNotIdenticalToAttributeChecker (org.asqatasun.rules.elementchecker.text.TextNotIdenticalToAttributeChecker)1 TextOnlyContainsNonAlphanumericalCharactersChecker (org.asqatasun.rules.elementchecker.text.TextOnlyContainsNonAlphanumericalCharactersChecker)1 SimpleTextElementBuilder (org.asqatasun.rules.textbuilder.SimpleTextElementBuilder)1