Skip to content

Commit 7df5d3c

Browse files
committed
feat: Add logs for debugging
1 parent 45d0931 commit 7df5d3c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

.github/actions/find/src/findForUrl.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
import { readFile } from 'node:fs/promises';
22
import type { Finding } from './types.d.js';
3+
import { sleep } from './sleep.js';
34
import AxeBuilder from '@axe-core/playwright'
45
import playwright from 'playwright';
56

67
export async function findForUrl(url: string, sessionStatePath?: string): Promise<Finding[]> {
78
const browser = await playwright.chromium.launch({ headless: true, executablePath: process.env.CI ? '/usr/bin/google-chrome' : undefined });
8-
let sessionState;
9-
if (sessionStatePath) {
10-
try {
11-
sessionState = JSON.parse(await readFile(sessionStatePath, 'utf8'));
12-
} catch (error) {
13-
console.error(`Error reading or parsing session state file at path: ${sessionStatePath}`, error);
14-
}
15-
}
16-
const context = await browser.newContext({ storageState: sessionState });
9+
const context = await browser.newContext({ storageState: sessionStatePath });
1710
const page = await context.newPage();
1811
await page.goto(url);
1912

13+
await sleep(5000);
14+
console.log(page.url());
15+
2016
let findings: Finding[] = [];
2117
try {
2218
const rawFindings = await new AxeBuilder({ page }).analyze();

0 commit comments

Comments
 (0)