(page: Page)
| 436 | |
| 437 | |
| 438 | async def test_expose_binding(page: Page) -> None: |
| 439 | binding_source = [] |
| 440 | |
| 441 | def binding(source: Dict, a: int, b: int) -> int: |
| 442 | binding_source.append(source) |
| 443 | return a + b |
| 444 | |
| 445 | await page.expose_binding("add", lambda source, a, b: binding(source, a, b)) |
| 446 | |
| 447 | result = await page.evaluate("add(5, 6)") |
| 448 | |
| 449 | assert binding_source[0]["context"] == page.context |
| 450 | assert binding_source[0]["page"] == page |
| 451 | assert binding_source[0]["frame"] == page.main_frame |
| 452 | assert result == 11 |
| 453 | |
| 454 | |
| 455 | async def test_expose_function(page: Page, server: Server) -> None: |
nothing calls this directly
no test coverage detected