Skip to content

Commit

Permalink
Use opts.userDataDir if launchPersistentContext calls with empty args
Browse files Browse the repository at this point in the history
  • Loading branch information
Ponchik501 committed Apr 3, 2024
1 parent 39248f1 commit 923f9b2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/playwright-extra/src/extra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface AugmentedLauncherAPIs
extends Pick<
PlaywrightBrowserLauncher,
'launch' | 'launchPersistentContext' | 'connect' | 'connectOverCDP'
> {}
> { }

/**
* Modular plugin framework to teach `playwright` new tricks.
Expand Down Expand Up @@ -119,6 +119,14 @@ export class PlaywrightExtraClass implements AugmentedLauncherAPIs {
options =
(await this.plugins.dispatchBlocking('beforeLaunch', options)) || options

if ('userDataDir' in options && !userDataDir) {
userDataDir = (options as any).userDataDir
debug(
"A plugin defined userDataDir during .launchPersistentContext", userDataDir
)
delete (options as any).userDataDir
}

const context = await this.launcher['launchPersistentContext'](
userDataDir,
options
Expand Down

0 comments on commit 923f9b2

Please sign in to comment.