-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose Playwright runtime context to scratchpad.config.js (#43)
* feat: expose playwright runtime in config * chore: added changelog * chore: update changeset * chore: add changeset * core: update readme
- Loading branch information
Showing
7 changed files
with
79 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
"@heymp/scratchpad": minor | ||
--- | ||
|
||
Expose Playwright runtime context to scratchpad.config.js [#40](https://github.com/heyMP/scratchpad/issues/40) | ||
|
||
`scratchpad.config.js` | ||
```js | ||
export default /** @type {import('@heymp/scratchpad/config').Config} */ ({ | ||
devtools: true, | ||
playwright: async (args) => { | ||
const { context, page } = args; | ||
// block esmodule shims | ||
await context.route(/es-module-shims\.js/, async route => { | ||
await route.abort(); | ||
}); | ||
await page.goto('https://ux.redhat.com'); | ||
} | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
"@heymp/scratchpad": patch | ||
--- | ||
|
||
Add typings for scratchpad.config.js [#37](https://github.com/heyMP/scratchpad/issues/37) | ||
|
||
```js | ||
export default /** @type {import('@heymp/scratchpad/config').Config} */ ({ | ||
devtools: true, | ||
headless: true, | ||
url: 'https://google.com', | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Page, BrowserContext, Browser } from 'playwright'; | ||
|
||
export type PlaywrightConfig = { | ||
page: Page, | ||
context: BrowserContext, | ||
browser: Browser, | ||
} | ||
|
||
export type Config = { | ||
headless?: boolean; | ||
devtools?: boolean; | ||
tsWrite?: boolean; | ||
url?: string; | ||
playwright?: (page: PlaywrightConfig) => Promise<void> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"files": [ | ||
"bin/cli.js", | ||
"src/**", | ||
"config.d.ts", | ||
"types.d.ts" | ||
], | ||
"dependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters