Skip to content

Commit 633b160

Browse files
committed
Alignment fixes
1 parent c475963 commit 633b160

5 files changed

Lines changed: 22 additions & 14 deletions

File tree

playwright/_impl/_browser_context.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def __init__(
120120
self._background_pages: Set[Page] = set()
121121
self._service_workers: Set[Worker] = set()
122122
self._base_url: Optional[str] = self._options.get("baseURL")
123+
self._videos_dir: Optional[str] = self._options.get("recordVideo")
123124
self._tracing = cast(Tracing, from_channel(initializer["tracing"]))
124125
self._har_recorders: Dict[str, HarRecordingMetadata] = {}
125126
self._request: APIRequestContext = from_channel(initializer["requestContext"])
@@ -303,14 +304,6 @@ def pages(self) -> List[Page]:
303304
def browser(self) -> Optional["Browser"]:
304305
return self._browser
305306

306-
@property
307-
def base_url(self) -> Optional[str]:
308-
return self._base_url
309-
310-
@property
311-
def videos_dir(self) -> Optional[str]:
312-
return self._options.get("recordVideo")
313-
314307
async def _initialize_har_from_options(
315308
self,
316309
record_har_path: Optional[Union[Path, str]],

playwright/_impl/_frame.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,18 @@ async def fill(
586586
noWaitAfter: bool = None,
587587
strict: bool = None,
588588
force: bool = None,
589+
) -> None:
590+
await self._fill(**locals())
591+
592+
async def _fill(
593+
self,
594+
selector: str,
595+
value: str,
596+
timeout: float = None,
597+
noWaitAfter: bool = None,
598+
strict: bool = None,
599+
force: bool = None,
600+
title: str = None,
589601
) -> None:
590602
await self._channel.send("fill", self._timeout, locals_to_params(locals()))
591603

playwright/_impl/_locator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ async def clear(
217217
noWaitAfter: bool = None,
218218
force: bool = None,
219219
) -> None:
220-
await self.fill("", timeout=timeout, force=force)
220+
params = locals_to_params(locals())
221+
await self._frame._fill(self._selector, value="", title="Clear", **params)
221222

222223
def locator(
223224
self,

playwright/_impl/_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ def video(
11811181
# Note: we are creating Video object lazily, because we do not know
11821182
# BrowserContextOptions when constructing the page - it is assigned
11831183
# too late during launchPersistentContext.
1184-
if not self._browser_context.videos_dir:
1184+
if not self._browser_context._videos_dir:
11851185
return None
11861186
return self._force_video()
11871187

tests/async/test_chromium_tracing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,18 @@ async def test_should_run_with_custom_categories_if_provided(
5151
output_file = tmp_path / "trace.json"
5252
await browser.start_tracing(
5353
page=page,
54-
screenshots=True,
5554
path=output_file,
56-
categories=["disabled-by-default-v8.cpu_profiler.hires"],
55+
categories=["disabled-by-default-cc.debug"],
5756
)
5857
await browser.stop_tracing()
5958
with open(output_file, mode="r") as of:
6059
trace_json = json.load(of)
60+
trace_config = trace_json["metadata"].get("trace-config")
61+
trace_events = trace_json["traceEvents"]
6162
assert (
62-
"disabled-by-default-v8.cpu_profiler.hires"
63-
in trace_json["metadata"]["trace-config"]
63+
trace_config is not None and "disabled-by-default-cc.debug" in trace_config
64+
) or any(
65+
event.get("cat") == "disabled-by-default-cc.debug" for event in trace_events
6466
)
6567

6668

0 commit comments

Comments
 (0)