mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
test: throw element not found error (#12665)
This commit is contained in:
parent
363fa31e9b
commit
1f011d8e02
@ -71,7 +71,11 @@ const timeout = (n: number) => new Promise((r) => setTimeout(r, n))
|
||||
|
||||
async function toEl(el: string | ElementHandle): Promise<ElementHandle> {
|
||||
if (typeof el === 'string') {
|
||||
return await page.$(el)
|
||||
const realEl = await page.$(el)
|
||||
if (realEl == null) {
|
||||
throw new Error(`Cannot find element: "${el}"`)
|
||||
}
|
||||
return realEl
|
||||
}
|
||||
return el
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user