Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions zktest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.deque</groupId>
<artifactId>axe-selenium</artifactId>
<version>3.0</version>
<groupId>com.deque.html.axe-core</groupId>
<artifactId>selenium</artifactId>
<version>4.2.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.easymock/easymock -->
Expand Down
12 changes: 0 additions & 12 deletions zktest/src/archive/wcag/axe.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion zktest/src/archive/wcag/calendar.zul
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Copyright (C) 2020 Potix Corporation. All Rights Reserved.
<hlayout>
<vlayout width="300px">
Selected date: <label id="d1"/>
<calendar tooltiptext="Start date"
<calendar ca:aria-label="Start date"
weekOfYear="true" showTodayLink="true"
todayLinkLabel=""
onChange="d1.value=self.valueInLocalDate.toString()" />
Expand Down
32 changes: 0 additions & 32 deletions zktest/src/archive/wcag/jasperreport.zul

This file was deleted.

2 changes: 0 additions & 2 deletions zktest/test/java/org/zkoss/zktest/zats/wcag/CalendarTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
*/
package org.zkoss.zktest.zats.wcag;

import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.Keys;

/**
* @author rudyhuang
*/
@Ignore("Needs aXe >= 3.5.6, https://github.com/dequelabs/axe-core/pull/2304")
public class CalendarTest extends WcagTestCase {
@Test
public void test() {
Expand Down
2 changes: 0 additions & 2 deletions zktest/test/java/org/zkoss/zktest/zats/wcag/ColorboxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
*/
package org.zkoss.zktest.zats.wcag;

import org.junit.Ignore;
import org.junit.Test;

/**
* @author jameschu
*/
@Ignore("Needs aXe >= 3.5.6, https://github.com/dequelabs/axe-core/pull/2304")
public class ColorboxTest extends WcagTestCase {
@Test
public void test() {
Expand Down
3 changes: 0 additions & 3 deletions zktest/test/java/org/zkoss/zktest/zats/wcag/DateboxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package org.zkoss.zktest.zats.wcag;

import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.interactions.Actions;
Expand All @@ -24,7 +23,6 @@
*/
public class DateboxTest extends WcagTestCase {
@Test
@Ignore("Needs aXe >= 3.5.6, https://github.com/dequelabs/axe-core/pull/2304")
public void testDate() {
connect();

Expand All @@ -46,7 +44,6 @@ public void testDate() {
}

@Test
@Ignore("Needs aXe >= 3.5.6, https://github.com/dequelabs/axe-core/pull/2304")
public void testDateTime() {
connect();

Expand Down
25 changes: 0 additions & 25 deletions zktest/test/java/org/zkoss/zktest/zats/wcag/JasperreportTest.java

This file was deleted.

37 changes: 12 additions & 25 deletions zktest/test/java/org/zkoss/zktest/zats/wcag/WcagTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
*/
package org.zkoss.zktest.zats.wcag;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;

import com.deque.axe.AXE;
import org.json.JSONArray;
import org.json.JSONObject;
import com.deque.html.axecore.results.Results;
import com.deque.html.axecore.selenium.AxeBuilder;
import com.deque.html.axecore.selenium.AxeReporter;
import org.junit.Assert;

import org.zkoss.zktest.zats.WebDriverTestCase;
Expand All @@ -28,17 +25,6 @@
* @author rudyhuang
*/
public abstract class WcagTestCase extends WebDriverTestCase {
private static final URL AXE_SCRIPT_URL = getAxeScriptUrl();

private static URL getAxeScriptUrl() {
URI uri = new File("src/archive/wcag/axe.min.js").toURI();
try {
return uri.toURL();
} catch (MalformedURLException e) {
return null;
}
}

@Override
protected String getFileLocation() {
String simple = getClass().getSimpleName();
Expand All @@ -53,13 +39,14 @@ protected String getFileLocation() {
*/
protected void verifyA11y() {
// FIXME: Temporary disabled color-contrast
AXE.Builder builder = new AXE.Builder(driver, AXE_SCRIPT_URL)
.options("{ runOnly: ['wcag2a', 'wcag2aa'], rules: { 'color-contrast': { enabled: false } } }");
JSONObject responseJSON = builder.analyze();
JSONArray violations = responseJSON.getJSONArray("violations");

if (violations.length() != 0) {
Assert.fail(AXE.report(violations));
AxeBuilder builder = new AxeBuilder()
.withTags(Arrays.asList("wcag2a", "wcag2aa"))
.disableRules(Arrays.asList("color-contrast"));
Results results = builder.analyze(driver);
if (!results.violationFree()) {
Assert.fail(AxeReporter.getReadableAxeResults("WCAG", driver, results.getViolations())
? AxeReporter.getAxeResultString()
: null);
}
}
}