Skip to content

Commit

Permalink
feat: add image without at
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed Sep 7, 2024
1 parent ca90f2a commit 1086452
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion audit/apps/audit/src/checkers/async/http-system-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,22 @@ const getStatistics = async (
};
};

const getImageWithoutAlts = async (url: string, _parsers: any) => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle0' });

const imagesWithoutAlts = await page.evaluate(() =>
document.querySelectorAll('img:not([alt])')
);
console.log(imagesWithoutAlts);

if (imagesWithoutAlts.length > 0) {
return { name: 'imageWithoutAlts', result: imagesWithoutAlts.item };
}
};
export class HttpChecker {
#checkers: Checker[] = [getStatistics];
#checkers: Checker[] = [getStatistics, getImageWithoutAlts];
constructor(private parsers: { name: string; result: any }[]) {}
check(url: string) {
return Promise.all(
Expand Down
2 changes: 1 addition & 1 deletion audit/demo-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
only-parser: true
only-parser: false
urls:
- https://www.emmanueldemey.dev/

0 comments on commit 1086452

Please sign in to comment.