-
Notifications
You must be signed in to change notification settings - Fork 765
/
unlighthouse.config.ts
36 lines (34 loc) · 1.02 KB
/
unlighthouse.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
interface Page {
goto: (arg0: string, arg1: { waitUntil: string }) => unknown
$: (arg0: string) => Promise<{
type: (arg0: string) => unknown
click: () => unknown
}>
$eval: (
arg0: string,
arg1: (form: { submit: () => unknown }) => unknown
) => unknown
waitForNavigation: (arg0: { waitUntil: string }) => Promise<unknown>
}
const config = {
hooks: {
async authenticate(page: Page) {
// login to the page
await page.goto("https://skateshop.sadmn.com/signin", {
waitUntil: "networkidle0",
})
const emailInput = await page.$('input[type="text"]')
await emailInput?.type("[email protected]")
const passwordInput = await page.$('input[type="password"]')
await passwordInput?.type("unlighT/18!House")
const submitButton = await page.$('button[type="submit"]')
await Promise.all([
await submitButton?.click(),
await page.waitForNavigation({
waitUntil: "networkidle0",
}),
])
},
},
}
export default config