-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add accessibility tests workflow (#12082)
* Add skeleton for axe tests * Add testcases * Add remaining axe tests * Add remaining axe tests to workflow * FIx TestNgXmlTest * Add user-friendliness branch to workflow
- Loading branch information
1 parent
376ef12
commit f737a0e
Showing
41 changed files
with
1,313 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Accessibility Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- release | ||
- user-friendliness | ||
pull_request: | ||
branches: | ||
- master | ||
- release | ||
- user-friendliness | ||
jobs: | ||
axe-testing: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
browser: [firefox] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Update Property File | ||
run: mv src/e2e/resources/test.ci-${{ matrix.browser }}.properties src/e2e/resources/test.properties | ||
- name: Run Solr search service + local Datastore emulator | ||
run: docker-compose up -d | ||
- name: Create Config Files | ||
run: ./gradlew createConfigs testClasses generateTypes | ||
- name: Install Frontend Dependencies | ||
run: npm ci | ||
- name: Build Frontend Bundle | ||
run: npm run build | ||
- name: Start Server | ||
run: | | ||
./gradlew serverRun & | ||
./wait-for-server.sh | ||
- name: Start Tests | ||
run: xvfb-run --server-args="-screen 0 1024x768x24" ./gradlew axeTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/e2e/java/teammates/e2e/cases/axe/AdminAccountsPageAxeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package teammates.e2e.cases.axe; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import com.deque.html.axecore.results.Results; | ||
|
||
import teammates.common.util.AppUrl; | ||
import teammates.common.util.Const; | ||
import teammates.e2e.cases.BaseE2ETestCase; | ||
import teammates.e2e.pageobjects.AdminAccountsPage; | ||
import teammates.e2e.util.AxeUtil; | ||
|
||
/** | ||
* SUT: {@link Const.WebPageURIs#ADMIN_ACCOUNTS_PAGE}. | ||
*/ | ||
public class AdminAccountsPageAxeTest extends BaseE2ETestCase { | ||
|
||
@Override | ||
protected void prepareTestData() { | ||
testData = loadDataBundle("/AdminAccountsPageE2ETest.json"); | ||
removeAndRestoreDataBundle(testData); | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testAll() { | ||
AppUrl accountsPageUrl = createFrontendUrl(Const.WebPageURIs.ADMIN_ACCOUNTS_PAGE) | ||
.withParam(Const.ParamsNames.INSTRUCTOR_ID, "tm.e2e.AAccounts.instr2"); | ||
AdminAccountsPage accountsPage = loginAdminToPage(accountsPageUrl, AdminAccountsPage.class); | ||
|
||
Results results = AxeUtil.AXE_BUILDER.analyze(accountsPage.getBrowser().getDriver()); | ||
assertTrue(AxeUtil.formatViolations(results), results.violationFree()); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/e2e/java/teammates/e2e/cases/axe/AdminHomePageAxeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package teammates.e2e.cases.axe; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import com.deque.html.axecore.results.Results; | ||
|
||
import teammates.common.util.AppUrl; | ||
import teammates.common.util.Const; | ||
import teammates.e2e.cases.BaseE2ETestCase; | ||
import teammates.e2e.pageobjects.AdminHomePage; | ||
import teammates.e2e.util.AxeUtil; | ||
|
||
/** | ||
* SUT: {@link Const.WebPageURIs#ADMIN_HOME_PAGE}. | ||
*/ | ||
public class AdminHomePageAxeTest extends BaseE2ETestCase { | ||
|
||
@Override | ||
protected void prepareTestData() { | ||
testData = loadDataBundle("/AdminHomePageE2ETest.json"); | ||
removeAndRestoreDataBundle(testData); | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testAll() { | ||
AppUrl url = createFrontendUrl(Const.WebPageURIs.ADMIN_HOME_PAGE); | ||
AdminHomePage homePage = loginAdminToPage(url, AdminHomePage.class); | ||
|
||
Results results = AxeUtil.AXE_BUILDER.analyze(homePage.getBrowser().getDriver()); | ||
assertTrue(AxeUtil.formatViolations(results), results.violationFree()); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/e2e/java/teammates/e2e/cases/axe/AdminNotificationsPageAxeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package teammates.e2e.cases.axe; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import com.deque.html.axecore.results.Results; | ||
|
||
import teammates.common.util.AppUrl; | ||
import teammates.common.util.Const; | ||
import teammates.e2e.cases.BaseE2ETestCase; | ||
import teammates.e2e.pageobjects.AdminNotificationsPage; | ||
import teammates.e2e.util.AxeUtil; | ||
|
||
/** | ||
* SUT: {@link Const.WebPageURIs#ADMIN_NOTIFICATIONS_PAGE}. | ||
*/ | ||
public class AdminNotificationsPageAxeTest extends BaseE2ETestCase { | ||
|
||
@Override | ||
protected void prepareTestData() { | ||
testData = loadDataBundle("/AdminNotificationsPageE2ETest.json"); | ||
removeAndRestoreDataBundle(testData); | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testAll() { | ||
AppUrl url = createFrontendUrl(Const.WebPageURIs.ADMIN_NOTIFICATIONS_PAGE); | ||
AdminNotificationsPage notificationsPage = loginAdminToPage(url, AdminNotificationsPage.class); | ||
|
||
Results results = AxeUtil.AXE_BUILDER.analyze(notificationsPage.getBrowser().getDriver()); | ||
assertTrue(AxeUtil.formatViolations(results), results.violationFree()); | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
src/e2e/java/teammates/e2e/cases/axe/AdminSearchPageAxeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package teammates.e2e.cases.axe; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import com.deque.html.axecore.results.Results; | ||
|
||
import teammates.common.util.AppUrl; | ||
import teammates.common.util.Const; | ||
import teammates.e2e.cases.BaseE2ETestCase; | ||
import teammates.e2e.pageobjects.AdminSearchPage; | ||
import teammates.e2e.util.AxeUtil; | ||
import teammates.e2e.util.TestProperties; | ||
|
||
/** | ||
* SUT: {@link Const.WebPageURIs#ADMIN_SEARCH_PAGE}. | ||
*/ | ||
public class AdminSearchPageAxeTest extends BaseE2ETestCase { | ||
|
||
@Override | ||
protected void prepareTestData() { | ||
if (!TestProperties.INCLUDE_SEARCH_TESTS) { | ||
return; | ||
} | ||
|
||
testData = loadDataBundle("/AdminSearchPageE2ETest.json"); | ||
removeAndRestoreDataBundle(testData); | ||
putDocuments(testData); | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testAll() { | ||
if (!TestProperties.INCLUDE_SEARCH_TESTS) { | ||
return; | ||
} | ||
|
||
AppUrl url = createFrontendUrl(Const.WebPageURIs.ADMIN_SEARCH_PAGE); | ||
AdminSearchPage searchPage = loginAdminToPage(url, AdminSearchPage.class); | ||
|
||
searchPage.inputSearchContent(testData.students.get("student1InCourse1").getEmail()); | ||
searchPage.clickSearchButton(); | ||
|
||
Results results = AxeUtil.AXE_BUILDER.analyze(searchPage.getBrowser().getDriver()); | ||
assertTrue(AxeUtil.formatViolations(results), results.violationFree()); | ||
} | ||
|
||
} |
Oops, something went wrong.