Skip to content

Commit ad69d24

Browse files
committed
feat: expose wait method
1 parent 75de197 commit ad69d24

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {readFileSync} from 'fs'
22
import * as path from 'path'
33
import {ElementHandle, EvaluateFn, JSHandle, Page} from 'puppeteer'
4+
import waitForExpect from 'wait-for-expect'
45
import {ITestUtils} from './typedefs'
56

67
const domLibraryAsString = readFileSync(
@@ -75,6 +76,10 @@ function createDelegateFor(
7576
}
7677
}
7778

79+
export function wait(callback = () => {}, {timeout = 4500, interval = 50} = {}): Promise<{}> {
80+
return waitForExpect(callback, timeout, interval)
81+
}
82+
7883
export async function getDocument(_page?: Page): Promise<ElementHandle> {
7984
// @ts-ignore
8085
const page: Page = _page || this

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
}
4343
},
4444
"dependencies": {
45-
"dom-testing-library": "^2.6.1"
45+
"dom-testing-library": "^2.6.1",
46+
"wait-for-expect": "^0.4.0"
4647
},
4748
"devDependencies": {
4849
"@patrickhulce/lint": "^2.1.3",

0 commit comments

Comments
 (0)