(
browser: Browser, server: Server, tmp_path: Path
)
| 597 | |
| 598 | |
| 599 | async def test_should_produce_extracted_zip( |
| 600 | browser: Browser, server: Server, tmp_path: Path |
| 601 | ) -> None: |
| 602 | har_path = tmp_path / "har.har" |
| 603 | context = await browser.new_context( |
| 604 | record_har_mode="minimal", record_har_path=har_path, record_har_content="attach" |
| 605 | ) |
| 606 | page_1 = await context.new_page() |
| 607 | await page_1.goto(server.PREFIX + "/one-style.html") |
| 608 | await context.close() |
| 609 | |
| 610 | assert har_path.exists() |
| 611 | with har_path.open() as r: |
| 612 | content = r.read() |
| 613 | assert "log" in content |
| 614 | assert "background-color" not in r.read() |
| 615 | |
| 616 | context_2 = await browser.new_context() |
| 617 | await context_2.route_from_har(har_path, not_found="abort") |
| 618 | page_2 = await context_2.new_page() |
| 619 | await page_2.goto(server.PREFIX + "/one-style.html") |
| 620 | assert "hello, world!" in await page_2.content() |
| 621 | await expect(page_2.locator("body")).to_have_css( |
| 622 | "background-color", "rgb(255, 192, 203)" |
| 623 | ) |
| 624 | |
| 625 | |
| 626 | async def test_should_update_har_zip_for_context( |
nothing calls this directly
no test coverage detected