( options?: GoToOptions, )
| 795 | * (they were always no-ops for `setContent`, which fires no network). |
| 796 | */ |
| 797 | export const toSetContentOptions = ( |
| 798 | options?: GoToOptions, |
| 799 | ): SetContentWaitForOptions | undefined => { |
| 800 | if (!options) return options; |
| 801 | const { waitUntil, ...rest } = options; |
| 802 | if (waitUntil === undefined) return rest; |
| 803 | const events = Array.isArray(waitUntil) ? waitUntil : [waitUntil]; |
| 804 | const supported = events.filter( |
| 805 | ( |
| 806 | e, |
| 807 | ): e is Exclude<PuppeteerLifeCycleEvent, 'networkidle0' | 'networkidle2'> => |
| 808 | e !== 'networkidle0' && e !== 'networkidle2', |
| 809 | ); |
| 810 | if (supported.length === 0) return rest; |
| 811 | return { |
| 812 | ...rest, |
| 813 | waitUntil: Array.isArray(waitUntil) ? supported : supported[0], |
| 814 | }; |
| 815 | }; |
| 816 | |
| 817 | export const parseBooleanParam = ( |
| 818 | params: URLSearchParams, |
no outgoing calls
no test coverage detected