Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(all): Promote 4.x to main #1460

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
388882e
Update for Puppeteer 19
tombrunet May 16, 2023
63c63d4
Update imports for ESM
tombrunet May 17, 2023
8d01685
Fix object verification
tombrunet May 17, 2023
361d4e0
Fix ACT runs
tombrunet May 17, 2023
c11f78b
Throw out bounds differences within 2
tombrunet May 17, 2023
310bbc4
Update cypress package-lock
tombrunet May 17, 2023
7f83adc
Split cypress test
tombrunet May 17, 2023
3b607ec
Convert to absolute url for Windows
tombrunet May 17, 2023
ffdcbc8
Merge branch 'master' into update-puppeteer-19
tombrunet May 17, 2023
f42ce6b
Update gulpfile
tombrunet May 17, 2023
555009c
Merge branch 'update-puppeteer-19' of https://github.com/IBMa/equal-a…
tombrunet May 17, 2023
f6caad4
Split into cjs and mjs
tombrunet May 19, 2023
1007d08
Use modules for testing
tombrunet May 19, 2023
ff8b3fb
Tests to mjs
tombrunet May 19, 2023
d3b9f20
Fix extension
tombrunet May 19, 2023
f02faaf
More file extension changes
tombrunet May 19, 2023
10c4f58
Fix require check
tombrunet May 19, 2023
bdb466c
Fix file extension
tombrunet May 19, 2023
d88354d
Update file extensions
tombrunet May 19, 2023
c49740e
Fix testcase to work on Windows
tombrunet May 19, 2023
7c51a88
Update meta hack for ACT test
tombrunet May 19, 2023
919c0a2
chore(node,karma): Update selenium-webdriver (4.9.2) and add more err…
shunguoy May 19, 2023
1001cf3
chore(cypress): Update to latest Cypress (12.12.0) (#1451)
tombrunet May 19, 2023
6091cbe
Merge branch '4.x-rc' into update-puppeteer-19
tombrunet May 19, 2023
a57604f
Selenium refix
tombrunet May 19, 2023
8abedea
Wrong order
tombrunet May 19, 2023
2b1fcb2
Merge pull request #1454 from IBMa/update-puppeteer-19
ErickRenteria May 19, 2023
9743df7
Add jest boilerplate, fix terser typeof issue (#1461)
tombrunet May 22, 2023
fe3af6d
Merge branch 'master' into 4.x-rc
tombrunet May 23, 2023
a914d7e
Merge branch 'master' into 4.x-rc
tombrunet May 24, 2023
89bd219
Merge branch 'master' into 4.x-rc
tombrunet Jun 5, 2023
9f318ff
Merge branch 'master' into 4.x-rc
tombrunet Jun 9, 2023
9282a0d
Merge branch 'master' into 4.x-rc
tombrunet Jun 14, 2023
bda7132
Merge branch 'master' into 4.x-rc
tombrunet Jun 16, 2023
5f5e5e6
Build failure
tombrunet Jun 16, 2023
0b3d549
import problems
tombrunet Jun 16, 2023
9717bac
Merge branch 'master' into 4.x-rc
tombrunet Jul 6, 2023
795b34a
merge
tombrunet Jul 6, 2023
9c3637d
Merge branch 'master' into 4.x-rc
tombrunet Jul 14, 2023
6b186cc
Issues with imports
tombrunet Jul 19, 2023
5c68957
Merge branch 'master' into 4.x-rc
tombrunet Jul 19, 2023
cf4a56c
Import problems
tombrunet Jul 19, 2023
8b1b26f
Fix module imports
tombrunet Jul 19, 2023
68d16af
import problems
tombrunet Jul 19, 2023
6715f5b
Deal with cjs vs mjs for __dirname
tombrunet Jul 19, 2023
fdcda33
Fix filename
tombrunet Jul 19, 2023
3028db9
Don't support 14.x with the 4.x branch
tombrunet Jul 19, 2023
dfc8e6c
Fix merge conflicts
tombrunet Jul 19, 2023
0b9e718
Merge branch 'master' into 4.x-rc
tombrunet Aug 2, 2023
fae2f51
Merge branch 'master' into 4.x-rc
tombrunet Aug 23, 2023
6cede14
Merge branch 'master' into 4.x-rc
tombrunet Aug 24, 2023
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
30 changes: 15 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ jobs:
- run: npm run build
working-directory: accessibility-checker

- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Baselines/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Baselines/*.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Functions.Defined/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Functions.Defined/*.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.ObjectStructure/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.ObjectStructure/*.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.assertionCompliance.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.assertionCompliance.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.Content.Puppeteer.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.Content.Puppeteer.test.mjs
working-directory: accessibility-checker

###############################################################################
Expand All @@ -142,7 +142,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 18.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -171,15 +171,15 @@ jobs:
- run: npm run build
working-directory: accessibility-checker

- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Baselines/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Baselines/*.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Functions.Defined/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Functions.Defined/*.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.ObjectStructure/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.ObjectStructure/*.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.assertionCompliance.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.assertionCompliance.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.Content.Puppeteer.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.Content.Puppeteer.test.mjs
working-directory: accessibility-checker

###############################################################################
Expand Down Expand Up @@ -219,9 +219,9 @@ jobs:
- run: npm run build
working-directory: accessibility-checker

- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.Content.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.Content.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.URL.test.js
- run: npx mocha -R dot test/mocha/aChecker.Fast/aChecker.Scans/aChecker.URL.test.mjs
working-directory: accessibility-checker

###############################################################################
Expand Down Expand Up @@ -261,9 +261,9 @@ jobs:
- run: npm run build
working-directory: accessibility-checker

- run: npx mocha -R dot test/mocha/aChecker.Slow1/aChecker.Scans/**/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Slow1/aChecker.Scans/**/*.test.mjs
working-directory: accessibility-checker
- run: npx mocha -R dot test/mocha/aChecker.Slow1/aChecker.ObjectStructure/**/*.test.js
- run: npx mocha -R dot test/mocha/aChecker.Slow1/aChecker.ObjectStructure/**/*.test.mjs
working-directory: accessibility-checker


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

<body>

<button>My button!</button>
<!-- Specify the background style because Windows default colors are #f0f0f0
instead of #efefef used by Mac / Linux
-->
<button style="background-color: #efefef;">My button!</button>

<script type="text/javascript">
UnitTest = {
Expand Down
3 changes: 2 additions & 1 deletion accessibility-checker/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ results
package-lock.json
src/**/*.js
src/**/*.map
src/**/*.d.ts
src/**/*.d.ts
!src/bin/achecker.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Feature: Cucumber Demo
Demonstrate a basic usage of AAT

Scenario: Check pages and fail when issues found
Given I am at URL "http://www.altoromutual.com/"
Then Page is accessible with label "DEMO1"
When I click on ID "CatLink1"
Then Page is accessible with label "DEMO1_Personal"
# Scenario: Check pages and fail when issues found
# Given I am at URL "https://altoromutual.12mc9fdq8fib.us-south.codeengine.appdomain.cloud/#"
# Then Page is accessible with label "DEMO1"
# When I click on ID "feedbackButton"
# Then Page is accessible with label "DEMO1_Personal"

Scenario: Check pages, but just record results when issues found
Given I am at URL "http://www.altoromutual.com/"
Given I am at URL "https://altoromutual.12mc9fdq8fib.us-south.codeengine.appdomain.cloud/#"
Then Scan page for accessibility with label "DEMO2"
When I click on ID "CatLink1"
When I click on ID "feedbackButton"
Then Scan page for accessibility with label "DEMO2_Personal"

Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ When(/^I click on XPath "([^"]*)"$/, function(selector) {
});
});

When(/^I click on ID "([^"]*)"$/, function(selector) {
When(/^I click on ID "([^"]*)"$/, async function(selector) {
const myThis = this;
const condition = until.elementLocated(By.id(selector));
return myThis.driver.wait(condition, 8000).then(function() {
return myThis.driver.findElement(By.id(selector)).click();
return myThis.driver.wait(condition, 8000).then(async function() {
let elem = await myThis.driver.findElement(By.id(selector));
let rect = await elem.getRect();
await myThis.driver.executeScript(`window.scrollTo(${rect.x+rect.width}, ${rect.y+rect.height});`);
await myThis.driver.sleep(2000);
await elem.click();
await myThis.driver.sleep(2000);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function getBrowserChrome() {

const options = new chrome.Options();
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--headless");
options.addArguments("--headless=new");
options.addArguments('--ignore-certificate-errors')

let service = new chrome.ServiceBuilder(spath).build();
chrome.setDefaultService(service);
chrome.Driver.createSession(options, service);

return new webdriver.Builder()
.withCapabilities(webdriver.Capabilities.chrome())
Expand Down Expand Up @@ -59,7 +59,6 @@ const {BeforeAll, AfterAll, Before} = require("cucumber");

BeforeAll(function() {
driver = getBrowser();

/*
return new Promise(function(resolve, reject) {
aChecker.onRunComplete(resolve);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"eslint": "^7.0.0",
"html-escape": "^2.0.0",
"line-reader": "^0.4.0",
"selenium-webdriver": "4.3.0"
"selenium-webdriver": "4.9.2"
},
"dependencies": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
results
52 changes: 52 additions & 0 deletions accessibility-checker/boilerplates/jest-puppeteer-ts/achecker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module.exports = {
// optional - Specify the rule archive
// Default: latest
// Run `npx aat archives` for a list of valid ruleArchive ids and policy ids
ruleArchive: 'latest',

// optional - Specify one or many policies to scan.
// Run `npx aat archives` for a list of valid ruleArchive ids and policy ids
policies: [ "IBM_Accessibility"],

// optional - Specify one or many violation levels on which to fail the test
// i.e. If specified violation then the testcase will only fail if
// a violation is found during the scan.
// i.e. failLevels: ["violation"]
// i.e. failLevels: ["violation","potential violation"] or refer to below as a list
// Default: ["violation","potential violation"]
failLevels: [ "violation" ],

// optional - Specify one or many violation levels which should be reported
// i.e. If specified violation then in the report it would only contain
// results which are level of violation.
// i.e. reportLevels: ["violation"]
// Valid values: violation, potentialviolation, recommendation, potentialrecommendation, manual
// Default: ["violation","potential violation"]
reportLevels: [
"violation",
"potentialviolation",
"recommendation",
"potentialrecommendation",
"manual"
],

// Optional - Which type should the results be outputted to
// Valid values: json, csv
// Default: json
outputFormat: [ "json" ],

// Optional - Specify labels that you would like associated to your scan
//
// i.e.
// label: ["Firefox","master","V12","Linux"]
// Default: N/A
label: [],

// optional - Where the scan results should be saved.
// Default: results
outputFolder: "results",

// optional - Where the baseline results should be loaded from
// Default: baselines
baselineFolder: "baselines",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright IBM Corp. 2019
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

import { assertCompliance, getCompliance, stringifyResults } from "accessibility-checker";
import { Page } from "puppeteer";

async function toBeAccessible(node: Page) {
let results = await getCompliance(node, this.currentTestName.replace(/[ \\/]/g, "_"));
if (assertCompliance(results.report) === 0) {
return {
pass: true
}
} else {
return {
pass:false,
message: () => stringifyResults(results.report)
}
}
}
module.exports = toBeAccessible;
29 changes: 29 additions & 0 deletions accessibility-checker/boilerplates/jest-puppeteer-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@ibma/eac-jest-boilerplate",
"version": "3.0.0",
"description": "Example usage of IBM Equal Access Checker with Jest, Puppeteer, and Typescript",
"scripts": {
"test": "jest test-ts/*.test.ts"
},
"engines": {
"node": ">=18"
},
"jest": {
"preset": "ts-jest",
"setupFilesAfterEnv": [
"./setupAfterEnv.ts"
],
"transformIgnorePatterns": [
"ace-node\\.js"
]
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@types/jest": "^29.5.1",
"accessibility-checker": "*",
"jest": "^29.5.0",
"puppeteer": "^20.2.1",
"ts-jest": "^29.1.0",
"typescript": "^4.1.5"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html ng-app="helloApp" ng-controller="helloCtrl" lang='{{locale}}'>

<head>
<title>Sample App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-animate.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-aria.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script>
<script type="text/javascript" src="Hello.js"></script>
</head>

<body ng-cloak layout="column">
<md-toolbar layout="row" class="md-toolbar-tools" role="banner">
<h1>Sample App</h1>
</md-toolbar>

<div flex layout="row">

<md-sidenav md-is-locked-open="true" class="md-whiteframe-4dp" role="navigation">
Sidenav
</md-sidenav>

<md-content flex id="content" role="main">
<a id="clickMe" ng-click="showCard = !showCard">Click Me</a>
<md-card ng-if="showCard">
<md-card-content>
<h2>Card headline</h2>
<p>Card content</p>
<img src="hello.png" />
</md-card-content>
<md-card-footer>
Card footer
</md-card-footer>
</md-card>
</md-content>


</div>
<div>

</div>

</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var app = angular.module("helloApp", ["ngMaterial","ngAria"], function config($ariaProvider) {
$ariaProvider.config({
bindRoleForClick: false
});
});

app.controller("helloCtrl", function ($scope) {
$scope.locale = "en-US";
$scope.test = 1+2;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const toBeAccessible = require('./matchers/toBeAccessible');
expect.extend({ toBeAccessible });
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var React = require("react");

var HelloWidget = React.createClass({
render: function () {
return "<div>Hello {this.props.name}</div>";
}
});

module.exports = HelloWidget;
Loading
Loading