MCPcopy Create free account
hub / github.com/microsoft/playwright-python / test_should_produce_extracted_zip

Function test_should_produce_extracted_zip

tests/async/test_har.py:599–623  ·  view source on GitHub ↗
(
    browser: Browser, server: Server, tmp_path: Path
)

Source from the content-addressed store, hash-verified

597
598
599async 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
626async def test_should_update_har_zip_for_context(

Callers

nothing calls this directly

Calls 8

new_contextMethod · 0.45
new_pageMethod · 0.45
gotoMethod · 0.45
closeMethod · 0.45
route_from_harMethod · 0.45
contentMethod · 0.45
to_have_cssMethod · 0.45
locatorMethod · 0.45

Tested by

no test coverage detected