MCPcopy Create free account
hub / github.com/code-pushup/cli / captureAuthState

Method captureAuthState

packages/plugin-axe/src/lib/runner/run-axe.ts:76–94  ·  view source on GitHub ↗

Runs setup script and captures authentication state for reuse.

(
    setupFn: SetupFunction,
    timeout: number,
  )

Source from the content-addressed store, hash-verified

74
75 /** Runs setup script and captures authentication state for reuse. */
76 async captureAuthState(
77 setupFn: SetupFunction,
78 timeout: number,
79 ): Promise<void> {
80 const browser = await this.launchBrowser();
81 const context = await browser.newContext();
82 const page = await context.newPage();
83
84 try {
85 page.setDefaultTimeout(timeout);
86 await runSetup(setupFn, page);
87 this.storageState = await context.storageState();
88 logger.debug('Captured authentication state from setup script');
89 } finally {
90 await page.close();
91 await context.close();
92 logger.debug('Closed setup context');
93 }
94 }
95
96 /** Closes the browser and clears authentication state. */
97 async close(): Promise<void> {

Callers 1

createRunnerFunctionFunction · 0.95

Calls 4

launchBrowserMethod · 0.95
runSetupFunction · 0.85
debugMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected