Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/code-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
node-version: [24]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,30 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
node-version: [22, 24]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}

- name: Disable AppArmor on ubuntu
# Security on Ubuntu ⩾ 23 causes problem with Chrome, this is copied from
# https://github.com/puppeteer/puppeteer/blob/main/.github/workflows/ci.yml
# where they probably know what they do.
# if: ${{ matrix.os == 'ubuntu-latest' }}
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns

- uses: actions/cache@v4
with:
path: .yarn/cache
key: yarn-${{ hashFiles('yarn.lock') }}

- run: yarn install --immutable
- name: Install Playwright browsers
# https://playwright.dev/docs/ci-intro
run: yarn playwright install

- run: yarn dedupe --check
- run: yarn build
- run: yarn test
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/puppeteer.yml

This file was deleted.

2 changes: 1 addition & 1 deletion accessibility-code-checker/demo-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^9.0.0",
"typescript": "^5.2.2",
"vite": "^6.4.1"
"vite": "^7.2.7"
}
}
7 changes: 4 additions & 3 deletions accessibility-code-checker/puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"test": "node test/puppeteer.spec.js"
"test": "vitest run"
},
"devDependencies": {
"@siteimprove/alfa-test-deprecated": "^0.108.1",
"@siteimprove/alfa-test-utils": "^0.80.5"
"@siteimprove/alfa-test": "^0.108.1",
"@siteimprove/alfa-test-utils": "^0.80.5",
"vitest": "^4.0.15"
},
"dependencies": {
"@siteimprove/alfa-puppeteer": "^0.80.5",
Expand Down
164 changes: 84 additions & 80 deletions accessibility-code-checker/puppeteer/test/puppeteer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,87 +6,91 @@ import {
SIP,
} from "@siteimprove/alfa-test-utils";

import { test } from "@siteimprove/alfa-test-deprecated";
import { test } from "@siteimprove/alfa-test";
import { getCommitInformation } from "@siteimprove/alfa-test-utils/git";

import puppeteer from "puppeteer";

test("Page should be accessible", async (t) => {
// Create a browser instance
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox", "--disable-dev-shm-usage"],
});

// Navigate to the local web page
// This supposes that the server is already running. See the demo-site folder.
// TODO: Replace with your own page
const page = await browser.newPage();
await page.goto("http://localhost:5173");

// Get the document handle from the page
const document = await page.evaluateHandle(() => window.document);

/*
* Usual Puppeteer instructions can live here.
* For example, navigating through the page, opening menus or modals, etc.
*/

// Scrape the page
const alfaPage = await Puppeteer.toPage(document);

// Close the browser
await browser.close();

// Run the audit
const alfaResult = await Audit.run(alfaPage);

// (mandatory) Setup credentials (e.g., from environment variables).
const userName = process.env.SI_USER_EMAIL;
const apiKey = process.env.SI_API_KEY;

// (mandatory) Setup site ID; TODO: replace with your own.
const siteID = 16788956729;

// (recommended) Fetch information about the latest commit
const gitInformation = await getCommitInformation();

// (optional) Name the test, this can be built from the commit information.
const testName = (commit: CommitInformation) =>
`On branch ${commit.BranchName} – Puppeteer integration`;

// (optional) Provide a page title, this defaults to the first <title> element.
// const pageTitle = "My page title";

// (optional) Provide a page URL, this defaults to the page URL upon scraping.
// This is useful to overwrite localhost URLs.
const pageURL = "https://demo.siteimprovedemo.com/";

// Upload the result to Siteimprove Intelligence Platform, if credentials are provided
const url = await SIP.upload(alfaResult, {
// mandatory options
userName,
apiKey,
siteID,
// optional options
commitInformation: gitInformation,
testName,
// pageTitle,
pageURL,
});

// Log the result to the console
Logging.fromAudit(alfaResult, url).print();

// Check if some rule was failing.
const failingRules = alfaResult.resultAggregates.filter(
(aggregate) => aggregate.failed > 0,
);

// Fail the test if any rule failed.
t.equal(
failingRules.size,
0,
`The page has ${failingRules.size} failing rules`,
);
});
test(
"Page should be accessible",
async (t) => {
// Create a browser instance
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox", "--disable-dev-shm-usage"],
});

// Navigate to the local web page
// This supposes that the server is already running. See the demo-site folder.
// TODO: Replace with your own page
const page = await browser.newPage();
await page.goto("http://localhost:5173");

// Get the document handle from the page
const document = await page.evaluateHandle(() => window.document);

/*
* Usual Puppeteer instructions can live here.
* For example, navigating through the page, opening menus or modals, etc.
*/

// Scrape the page
const alfaPage = await Puppeteer.toPage(document);

// Close the browser
await browser.close();

// Run the audit
const alfaResult = await Audit.run(alfaPage);

// (mandatory) Setup credentials (e.g., from environment variables).
const userName = process.env.SI_USER_EMAIL;
const apiKey = process.env.SI_API_KEY;

// (mandatory) Setup site ID; TODO: replace with your own.
const siteID = 16788956729;

// (recommended) Fetch information about the latest commit
const gitInformation = await getCommitInformation();

// (optional) Name the test, this can be built from the commit information.
const testName = (commit: CommitInformation) =>
`On branch ${commit.BranchName} – Puppeteer integration`;

// (optional) Provide a page title, this defaults to the first <title> element.
// const pageTitle = "My page title";

// (optional) Provide a page URL, this defaults to the page URL upon scraping.
// This is useful to overwrite localhost URLs.
const pageURL = "https://demo.siteimprovedemo.com/";

// Upload the result to Siteimprove Intelligence Platform, if credentials are provided
const url = await SIP.upload(alfaResult, {
// mandatory options
userName,
apiKey,
siteID,
// optional options
commitInformation: gitInformation,
testName,
// pageTitle,
pageURL,
});

// Log the result to the console
Logging.fromAudit(alfaResult, url).print();

// Check if some rule was failing.
const failingRules = alfaResult.resultAggregates.filter(
(aggregate) => aggregate.failed > 0,
);

// Fail the test if any rule failed.
t.equal(
failingRules.size,
0,
`The page has ${failingRules.size} failing rules`,
);
},
{ timeout: 60_000 /* ms */ },
);
1 change: 1 addition & 0 deletions accessibility-code-checker/puppeteer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "../tsconfig.json",
"compilerOptions": { "noEmit": true },
"files": ["test/puppeteer.spec.ts"]
}
7 changes: 4 additions & 3 deletions accessibility-code-checker/selenium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"test": "node test/selenium.spec.js"
"test": "vitest run"
},
"devDependencies": {
"@siteimprove/alfa-selenium": "^0.80.5",
"@siteimprove/alfa-test-deprecated": "^0.108.1",
"@siteimprove/alfa-test": "^0.108.1",
"@siteimprove/alfa-test-utils": "^0.80.5",
"@types/selenium-webdriver": "^4",
"selenium-webdriver": "^4.25.0"
"selenium-webdriver": "^4.25.0",
"vitest": "^4.0.15"
}
}
Loading