(page: Page, action: Function)
| 188 | } |
| 189 | |
| 190 | export function waitUntilNavigatedTo(page: Page, action: Function) { |
| 191 | let completed = false; |
| 192 | function navigatedTo(args) { |
| 193 | args.object.page.off('navigatedTo', navigatedTo); |
| 194 | completed = true; |
| 195 | } |
| 196 | |
| 197 | page.on('navigatedTo', navigatedTo); |
| 198 | action(); |
| 199 | TKUnit.waitUntilReady(() => completed, 5); |
| 200 | } |
| 201 | |
| 202 | export function waitUntilNavigatedFrom(action: Function, topFrame?: Frame) { |
| 203 | const currentPage = topFrame ? topFrame.currentPage : Frame.topmost().currentPage; |