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

Function test_should_round_trip_har_zip

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

Source from the content-addressed store, hash-verified

500
501
502async def test_should_round_trip_har_zip(
503 browser: Browser, server: Server, assetdir: Path, tmp_path: Path
504) -> None:
505 har_path = tmp_path / "har.zip"
506 context_1 = await browser.new_context(
507 record_har_mode="minimal", record_har_path=har_path
508 )
509 page_1 = await context_1.new_page()
510 await page_1.goto(server.PREFIX + "/one-style.html")
511 await context_1.close()
512
513 context_2 = await browser.new_context()
514 await context_2.route_from_har(har=har_path, not_found="abort")
515 page_2 = await context_2.new_page()
516 await page_2.goto(server.PREFIX + "/one-style.html")
517 assert "hello, world!" in await page_2.content()
518 await expect(page_2.locator("body")).to_have_css(
519 "background-color", "rgb(255, 192, 203)"
520 )
521
522
523async def test_should_round_trip_har_with_post_data(

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