@@ -34,11 +34,16 @@ export type AxeUrlResult = {
3434 auditOutputs : AuditOutputs ;
3535} ;
3636
37+ /**
38+ * Manages Playwright browser lifecycle and runs Axe accessibility audits.
39+ * Handles browser installation, authentication state, and URL analysis.
40+ */
3741export class AxeRunner {
3842 private browser : Browser | undefined ;
3943 private browserInstalled = false ;
4044 private storageState : BrowserContextOptions [ 'storageState' ] ;
4145
46+ /** Analyzes a URL for accessibility issues using Axe. */
4247 async analyzeUrl ( args : AxeUrlArgs ) : Promise < AxeUrlResult > {
4348 const browser = await this . launchBrowser ( ) ;
4449 const { url, urlIndex, urlsCount } = args ;
@@ -67,6 +72,7 @@ export class AxeRunner {
6772 } ) ;
6873 }
6974
75+ /** Runs setup script and captures authentication state for reuse. */
7076 async captureAuthState (
7177 setupFn : SetupFunction ,
7278 timeout : number ,
@@ -87,6 +93,7 @@ export class AxeRunner {
8793 }
8894 }
8995
96+ /** Closes the browser and clears authentication state. */
9097 async close ( ) : Promise < void > {
9198 this . storageState = undefined ;
9299 this . browserInstalled = false ;
@@ -127,6 +134,7 @@ export class AxeRunner {
127134 this . browserInstalled = true ;
128135 }
129136
137+ /** Lazily launches or returns existing Chromium browser instance. */
130138 private async launchBrowser ( ) : Promise < Browser > {
131139 if ( this . browser ) {
132140 return this . browser ;
0 commit comments