diff --git a/playwright/_impl/_assertions.py b/playwright/_impl/_assertions.py index 73dc76000..ce8d63816 100644 --- a/playwright/_impl/_assertions.py +++ b/playwright/_impl/_assertions.py @@ -89,45 +89,45 @@ def _not(self) -> "PageAssertions": ) async def to_have_title( - self, title_or_reg_exp: Union[Pattern[str], str], timeout: float = None + self, titleOrRegExp: Union[Pattern[str], str], timeout: float = None ) -> None: expected_values = to_expected_text_values( - [title_or_reg_exp], normalize_white_space=True + [titleOrRegExp], normalize_white_space=True ) __tracebackhide__ = True await self._expect_impl( "to.have.title", FrameExpectOptions(expectedText=expected_values, timeout=timeout), - title_or_reg_exp, + titleOrRegExp, "Page title expected to be", ) async def not_to_have_title( - self, title_or_reg_exp: Union[Pattern[str], str], timeout: float = None + self, titleOrRegExp: Union[Pattern[str], str], timeout: float = None ) -> None: __tracebackhide__ = True - await self._not.to_have_title(title_or_reg_exp, timeout) + await self._not.to_have_title(titleOrRegExp, timeout) async def to_have_url( - self, url_or_reg_exp: Union[str, Pattern[str]], timeout: float = None + self, urlOrRegExp: Union[str, Pattern[str]], timeout: float = None ) -> None: __tracebackhide__ = True base_url = self._actual_page.context._options.get("baseURL") - if isinstance(url_or_reg_exp, str) and base_url: - url_or_reg_exp = urljoin(base_url, url_or_reg_exp) - expected_text = to_expected_text_values([url_or_reg_exp]) + if isinstance(urlOrRegExp, str) and base_url: + urlOrRegExp = urljoin(base_url, urlOrRegExp) + expected_text = to_expected_text_values([urlOrRegExp]) await self._expect_impl( "to.have.url", FrameExpectOptions(expectedText=expected_text, timeout=timeout), - url_or_reg_exp, + urlOrRegExp, "Page URL expected to be", ) async def not_to_have_url( - self, url_or_reg_exp: Union[Pattern[str], str], timeout: float = None + self, urlOrRegExp: Union[Pattern[str], str], timeout: float = None ) -> None: __tracebackhide__ = True - await self._not.to_have_url(url_or_reg_exp, timeout) + await self._not.to_have_url(urlOrRegExp, timeout) class LocatorAssertions(AssertionsBase): @@ -156,9 +156,9 @@ async def to_contain_text( Pattern[str], str, ], - use_inner_text: bool = None, + useInnerText: bool = None, timeout: float = None, - ignore_case: bool = None, + ignoreCase: bool = None, ) -> None: __tracebackhide__ = True if isinstance(expected, collections.abc.Sequence) and not isinstance( @@ -168,13 +168,13 @@ async def to_contain_text( expected, match_substring=True, normalize_white_space=True, - ignore_case=ignore_case, + ignoreCase=ignoreCase, ) await self._expect_impl( "to.contain.text.array", FrameExpectOptions( expectedText=expected_text, - useInnerText=use_inner_text, + useInnerText=useInnerText, timeout=timeout, ), expected, @@ -185,13 +185,13 @@ async def to_contain_text( [expected], match_substring=True, normalize_white_space=True, - ignore_case=ignore_case, + ignoreCase=ignoreCase, ) await self._expect_impl( "to.have.text", FrameExpectOptions( expectedText=expected_text, - useInnerText=use_inner_text, + useInnerText=useInnerText, timeout=timeout, ), expected, @@ -207,22 +207,22 @@ async def not_to_contain_text( Pattern[str], str, ], - use_inner_text: bool = None, + useInnerText: bool = None, timeout: float = None, - ignore_case: bool = None, + ignoreCase: bool = None, ) -> None: __tracebackhide__ = True - await self._not.to_contain_text(expected, use_inner_text, timeout, ignore_case) + await self._not.to_contain_text(expected, useInnerText, timeout, ignoreCase) async def to_have_attribute( self, name: str, value: Union[str, Pattern[str]], - ignore_case: bool = None, + ignoreCase: bool = None, timeout: float = None, ) -> None: __tracebackhide__ = True - expected_text = to_expected_text_values([value], ignore_case=ignore_case) + expected_text = to_expected_text_values([value], ignoreCase=ignoreCase) await self._expect_impl( "to.have.attribute.value", FrameExpectOptions( @@ -236,12 +236,12 @@ async def not_to_have_attribute( self, name: str, value: Union[str, Pattern[str]], - ignore_case: bool = None, + ignoreCase: bool = None, timeout: float = None, ) -> None: __tracebackhide__ = True await self._not.to_have_attribute( - name, value, ignore_case=ignore_case, timeout=timeout + name, value, ignoreCase=ignoreCase, timeout=timeout ) async def to_have_class( @@ -440,9 +440,9 @@ async def to_have_text( Pattern[str], str, ], - use_inner_text: bool = None, + useInnerText: bool = None, timeout: float = None, - ignore_case: bool = None, + ignoreCase: bool = None, ) -> None: __tracebackhide__ = True if isinstance(expected, collections.abc.Sequence) and not isinstance( @@ -451,13 +451,13 @@ async def to_have_text( expected_text = to_expected_text_values( expected, normalize_white_space=True, - ignore_case=ignore_case, + ignoreCase=ignoreCase, ) await self._expect_impl( "to.have.text.array", FrameExpectOptions( expectedText=expected_text, - useInnerText=use_inner_text, + useInnerText=useInnerText, timeout=timeout, ), expected, @@ -465,13 +465,13 @@ async def to_have_text( ) else: expected_text = to_expected_text_values( - [expected], normalize_white_space=True, ignore_case=ignore_case + [expected], normalize_white_space=True, ignoreCase=ignoreCase ) await self._expect_impl( "to.have.text", FrameExpectOptions( expectedText=expected_text, - useInnerText=use_inner_text, + useInnerText=useInnerText, timeout=timeout, ), expected, @@ -487,12 +487,12 @@ async def not_to_have_text( Pattern[str], str, ], - use_inner_text: bool = None, + useInnerText: bool = None, timeout: float = None, - ignore_case: bool = None, + ignoreCase: bool = None, ) -> None: __tracebackhide__ = True - await self._not.to_have_text(expected, use_inner_text, timeout, ignore_case) + await self._not.to_have_text(expected, useInnerText, timeout, ignoreCase) async def to_be_attached( self, @@ -754,14 +754,14 @@ def expected_regex( pattern: Pattern[str], match_substring: bool, normalize_white_space: bool, - ignore_case: Optional[bool] = None, + ignoreCase: Optional[bool] = None, ) -> ExpectedTextValue: expected = ExpectedTextValue( regexSource=pattern.pattern, regexFlags=escape_regex_flags(pattern), matchSubstring=match_substring, normalizeWhiteSpace=normalize_white_space, - ignoreCase=ignore_case, + ignoreCase=ignoreCase, ) if expected["ignoreCase"] is None: del expected["ignoreCase"] @@ -774,7 +774,7 @@ def to_expected_text_values( ], match_substring: bool = False, normalize_white_space: bool = False, - ignore_case: Optional[bool] = None, + ignoreCase: Optional[bool] = None, ) -> Sequence[ExpectedTextValue]: out: List[ExpectedTextValue] = [] assert isinstance(items, list) @@ -784,15 +784,13 @@ def to_expected_text_values( string=item, matchSubstring=match_substring, normalizeWhiteSpace=normalize_white_space, - ignoreCase=ignore_case, + ignoreCase=ignoreCase, ) if o["ignoreCase"] is None: del o["ignoreCase"] out.append(o) elif isinstance(item, Pattern): out.append( - expected_regex( - item, match_substring, normalize_white_space, ignore_case - ) + expected_regex(item, match_substring, normalize_white_space, ignoreCase) ) return out diff --git a/playwright/_impl/_browser_context.py b/playwright/_impl/_browser_context.py index 74ceac9a1..e7e6f19a8 100644 --- a/playwright/_impl/_browser_context.py +++ b/playwright/_impl/_browser_context.py @@ -399,24 +399,24 @@ async def route_from_har( self, har: Union[Path, str], url: Union[Pattern[str], str] = None, - not_found: RouteFromHarNotFoundPolicy = None, + notFound: RouteFromHarNotFoundPolicy = None, update: bool = None, - update_content: Literal["attach", "embed"] = None, - update_mode: HarMode = None, + updateContent: Literal["attach", "embed"] = None, + updateMode: HarMode = None, ) -> None: if update: await self._record_into_har( har=har, page=None, url=url, - update_content=update_content, - update_mode=update_mode, + update_content=updateContent, + update_mode=updateMode, ) return router = await HarRouter.create( local_utils=self._connection.local_utils, file=str(har), - not_found_action=not_found or "abort", + not_found_action=notFound or "abort", url_matcher=url, ) await router.add_context_route(self) diff --git a/playwright/_impl/_browser_type.py b/playwright/_impl/_browser_type.py index 65e3982c7..8393d69ee 100644 --- a/playwright/_impl/_browser_type.py +++ b/playwright/_impl/_browser_type.py @@ -183,16 +183,16 @@ async def connect_over_cdp( async def connect( self, - ws_endpoint: str, + wsEndpoint: str, timeout: float = None, - slow_mo: float = None, + slowMo: float = None, headers: Dict[str, str] = None, - expose_network: str = None, + exposeNetwork: str = None, ) -> Browser: if timeout is None: timeout = 30000 - if slow_mo is None: - slow_mo = 0 + if slowMo is None: + slowMo = 0 headers = {**(headers if headers else {}), "x-playwright-browser": self.name} local_utils = self._connection.local_utils @@ -200,11 +200,11 @@ async def connect( await local_utils._channel.send_return_as_dict( "connect", { - "wsEndpoint": ws_endpoint, + "wsEndpoint": wsEndpoint, "headers": headers, - "slowMo": slow_mo, + "slowMo": slowMo, "timeout": timeout, - "exposeNetwork": expose_network, + "exposeNetwork": exposeNetwork, }, ) )["pipe"] diff --git a/playwright/_impl/_frame.py b/playwright/_impl/_frame.py index 2ce4372b6..75047ff79 100644 --- a/playwright/_impl/_frame.py +++ b/playwright/_impl/_frame.py @@ -175,12 +175,12 @@ def _setup_navigation_waiter(self, wait_name: str, timeout: float = None) -> Wai def expect_navigation( self, url: URLMatch = None, - wait_until: DocumentLoadState = None, + waitUntil: DocumentLoadState = None, timeout: float = None, ) -> EventContextManagerImpl[Response]: assert self._page - if not wait_until: - wait_until = "load" + if not waitUntil: + waitUntil = "load" if timeout is None: timeout = self._page._timeout_settings.navigation_timeout() @@ -188,7 +188,7 @@ def expect_navigation( waiter = self._setup_navigation_waiter("expect_navigation", timeout) to_url = f' to "{url}"' if url else "" - waiter.log(f"waiting for navigation{to_url} until '{wait_until}'") + waiter.log(f"waiting for navigation{to_url} until '{waitUntil}'") matcher = ( URLMatcher(self._page._browser_context._options.get("baseURL"), url) if url @@ -212,10 +212,10 @@ async def continuation() -> Optional[Response]: event = await waiter.result() if "error" in event: raise Error(event["error"]) - if wait_until not in self._load_states: + if waitUntil not in self._load_states: t = deadline - monotonic_time() if t > 0: - await self._wait_for_load_state_impl(state=wait_until, timeout=t) + await self._wait_for_load_state_impl(state=waitUntil, timeout=t) if "newDocument" in event and "request" in event["newDocument"]: request = from_channel(event["newDocument"]["request"]) return await request.response() @@ -226,16 +226,16 @@ async def continuation() -> Optional[Response]: async def wait_for_url( self, url: URLMatch, - wait_until: DocumentLoadState = None, + waitUntil: DocumentLoadState = None, timeout: float = None, ) -> None: assert self._page matcher = URLMatcher(self._page._browser_context._options.get("baseURL"), url) if matcher.matches(self.url): - await self._wait_for_load_state_impl(state=wait_until, timeout=timeout) + await self._wait_for_load_state_impl(state=waitUntil, timeout=timeout) return async with self.expect_navigation( - url=url, wait_until=wait_until, timeout=timeout + url=url, waitUntil=waitUntil, timeout=timeout ): pass @@ -535,18 +535,18 @@ async def fill( def locator( self, selector: str, - has_text: Union[str, Pattern[str]] = None, - has_not_text: Union[str, Pattern[str]] = None, + hasText: Union[str, Pattern[str]] = None, + hasNotText: Union[str, Pattern[str]] = None, has: Locator = None, - has_not: Locator = None, + hasNot: Locator = None, ) -> Locator: return Locator( self, selector, - has_text=has_text, - has_not_text=has_not_text, + has_text=hasText, + has_not_text=hasNotText, has=has, - has_not=has_not, + has_not=hasNot, ) def get_by_alt_text( diff --git a/playwright/_impl/_locator.py b/playwright/_impl/_locator.py index 4f4799183..55955d089 100644 --- a/playwright/_impl/_locator.py +++ b/playwright/_impl/_locator.py @@ -219,30 +219,30 @@ async def clear( def locator( self, - selector_or_locator: Union[str, "Locator"], - has_text: Union[str, Pattern[str]] = None, - has_not_text: Union[str, Pattern[str]] = None, + selectorOrLocator: Union[str, "Locator"], + hasText: Union[str, Pattern[str]] = None, + hasNotText: Union[str, Pattern[str]] = None, has: "Locator" = None, - has_not: "Locator" = None, + hasNot: "Locator" = None, ) -> "Locator": - if isinstance(selector_or_locator, str): + if isinstance(selectorOrLocator, str): return Locator( self._frame, - f"{self._selector} >> {selector_or_locator}", - has_text=has_text, - has_not_text=has_not_text, - has_not=has_not, + f"{self._selector} >> {selectorOrLocator}", + has_text=hasText, + has_not_text=hasNotText, + has_not=hasNot, has=has, ) - selector_or_locator = to_impl(selector_or_locator) - if selector_or_locator._frame != self._frame: + selectorOrLocator = to_impl(selectorOrLocator) + if selectorOrLocator._frame != self._frame: raise Error("Locators must belong to the same frame.") return Locator( self._frame, - f"{self._selector} >> internal:chain={json.dumps(selector_or_locator._selector)}", - has_text=has_text, - has_not_text=has_not_text, - has_not=has_not, + f"{self._selector} >> internal:chain={json.dumps(selectorOrLocator._selector)}", + has_text=hasText, + has_not_text=hasNotText, + has_not=hasNot, has=has, ) @@ -332,18 +332,18 @@ def nth(self, index: int) -> "Locator": def filter( self, - has_text: Union[str, Pattern[str]] = None, - has_not_text: Union[str, Pattern[str]] = None, + hasText: Union[str, Pattern[str]] = None, + hasNotText: Union[str, Pattern[str]] = None, has: "Locator" = None, - has_not: "Locator" = None, + hasNot: "Locator" = None, ) -> "Locator": return Locator( self._frame, self._selector, - has_text=has_text, - has_not_text=has_not_text, + has_text=hasText, + has_not_text=hasNotText, has=has, - has_not=has_not, + has_not=hasNot, ) def or_(self, locator: "Locator") -> "Locator": @@ -724,31 +724,31 @@ def __init__(self, frame: "Frame", frame_selector: str) -> None: def locator( self, - selector_or_locator: Union["Locator", str], - has_text: Union[str, Pattern[str]] = None, - has_not_text: Union[str, Pattern[str]] = None, - has: "Locator" = None, - has_not: "Locator" = None, + selectorOrLocator: Union["Locator", str], + hasText: Union[str, Pattern[str]] = None, + hasNotText: Union[str, Pattern[str]] = None, + has: Locator = None, + hasNot: Locator = None, ) -> Locator: - if isinstance(selector_or_locator, str): + if isinstance(selectorOrLocator, str): return Locator( self._frame, - f"{self._frame_selector} >> internal:control=enter-frame >> {selector_or_locator}", - has_text=has_text, - has_not_text=has_not_text, + f"{self._frame_selector} >> internal:control=enter-frame >> {selectorOrLocator}", + has_text=hasText, + has_not_text=hasNotText, has=has, - has_not=has_not, + has_not=hasNot, ) - selector_or_locator = to_impl(selector_or_locator) - if selector_or_locator._frame != self._frame: + selectorOrLocator = to_impl(selectorOrLocator) + if selectorOrLocator._frame != self._frame: raise ValueError("Locators must belong to the same frame.") return Locator( self._frame, - f"{self._frame_selector} >> internal:control=enter-frame >> {selector_or_locator._selector}", - has_text=has_text, - has_not_text=has_not_text, + f"{self._frame_selector} >> internal:control=enter-frame >> {selectorOrLocator._selector}", + has_text=hasText, + has_not_text=hasNotText, has=has, - has_not=has_not, + has_not=hasNot, ) def get_by_alt_text( diff --git a/playwright/_impl/_page.py b/playwright/_impl/_page.py index 8d143172f..cfa571f74 100644 --- a/playwright/_impl/_page.py +++ b/playwright/_impl/_page.py @@ -494,7 +494,7 @@ async def wait_for_load_state( async def wait_for_url( self, url: URLMatch, - wait_until: DocumentLoadState = None, + waitUntil: DocumentLoadState = None, timeout: float = None, ) -> None: return await self._main_frame.wait_for_url(**locals_to_params(locals())) @@ -597,24 +597,24 @@ async def route_from_har( self, har: Union[Path, str], url: Union[Pattern[str], str] = None, - not_found: RouteFromHarNotFoundPolicy = None, + notFound: RouteFromHarNotFoundPolicy = None, update: bool = None, - update_content: Literal["attach", "embed"] = None, - update_mode: HarMode = None, + updateContent: Literal["attach", "embed"] = None, + updateMode: HarMode = None, ) -> None: if update: await self._browser_context._record_into_har( har=har, page=self, url=url, - update_content=update_content, - update_mode=update_mode, + update_content=updateContent, + update_mode=updateMode, ) return router = await HarRouter.create( local_utils=self._connection.local_utils, file=str(har), - not_found_action=not_found or "abort", + not_found_action=notFound or "abort", url_matcher=url, ) await router.add_page_route(self) @@ -736,17 +736,17 @@ async def fill( def locator( self, selector: str, - has_text: Union[str, Pattern[str]] = None, - has_not_text: Union[str, Pattern[str]] = None, + hasText: Union[str, Pattern[str]] = None, + hasNotText: Union[str, Pattern[str]] = None, has: "Locator" = None, - has_not: "Locator" = None, + hasNot: "Locator" = None, ) -> "Locator": return self._main_frame.locator( selector, - has_text=has_text, - has_not_text=has_not_text, + hasText=hasText, + hasNotText=hasNotText, has=has, - has_not=has_not, + hasNot=hasNot, ) def get_by_alt_text( @@ -1075,10 +1075,10 @@ def expect_file_chooser( def expect_navigation( self, url: URLMatch = None, - wait_until: DocumentLoadState = None, + waitUntil: DocumentLoadState = None, timeout: float = None, ) -> EventContextManagerImpl[Response]: - return self.main_frame.expect_navigation(url, wait_until, timeout) + return self.main_frame.expect_navigation(url, waitUntil, timeout) def expect_popup( self, @@ -1089,17 +1089,17 @@ def expect_popup( def expect_request( self, - url_or_predicate: URLMatchRequest, + urlOrPredicate: URLMatchRequest, timeout: float = None, ) -> EventContextManagerImpl[Request]: matcher = ( None - if callable(url_or_predicate) + if callable(urlOrPredicate) else URLMatcher( - self._browser_context._options.get("baseURL"), url_or_predicate + self._browser_context._options.get("baseURL"), urlOrPredicate ) ) - predicate = url_or_predicate if callable(url_or_predicate) else None + predicate = urlOrPredicate if callable(urlOrPredicate) else None def my_predicate(request: Request) -> bool: if matcher: @@ -1108,7 +1108,7 @@ def my_predicate(request: Request) -> bool: return predicate(request) return True - trimmed_url = trim_url(url_or_predicate) + trimmed_url = trim_url(urlOrPredicate) log_line = f"waiting for request {trimmed_url}" if trimmed_url else None return self._expect_event( Page.Events.Request, @@ -1128,17 +1128,17 @@ def expect_request_finished( def expect_response( self, - url_or_predicate: URLMatchResponse, + urlOrPredicate: URLMatchResponse, timeout: float = None, ) -> EventContextManagerImpl[Response]: matcher = ( None - if callable(url_or_predicate) + if callable(urlOrPredicate) else URLMatcher( - self._browser_context._options.get("baseURL"), url_or_predicate + self._browser_context._options.get("baseURL"), urlOrPredicate ) ) - predicate = url_or_predicate if callable(url_or_predicate) else None + predicate = urlOrPredicate if callable(urlOrPredicate) else None def my_predicate(response: Response) -> bool: if matcher: @@ -1147,7 +1147,7 @@ def my_predicate(response: Response) -> bool: return predicate(response) return True - trimmed_url = trim_url(url_or_predicate) + trimmed_url = trim_url(urlOrPredicate) log_line = f"waiting for response {trimmed_url}" if trimmed_url else None return self._expect_event( Page.Events.Response, diff --git a/playwright/_impl/_selectors.py b/playwright/_impl/_selectors.py index 729e17254..cf8af8c06 100644 --- a/playwright/_impl/_selectors.py +++ b/playwright/_impl/_selectors.py @@ -47,11 +47,11 @@ async def register( await channel._channel.send("register", params) self._registrations.append(params) - def set_test_id_attribute(self, attribute_name: str) -> None: - set_test_id_attribute_name(attribute_name) + def set_test_id_attribute(self, attributeName: str) -> None: + set_test_id_attribute_name(attributeName) for channel in self._channels: channel._channel.send_no_reply( - "setTestIdAttributeName", {"testIdAttributeName": attribute_name} + "setTestIdAttributeName", {"testIdAttributeName": attributeName} ) def _add_channel(self, channel: "SelectorsOwner") -> None: diff --git a/playwright/async_api/_generated.py b/playwright/async_api/_generated.py index 4dcd4da23..d8276a125 100644 --- a/playwright/async_api/_generated.py +++ b/playwright/async_api/_generated.py @@ -3448,7 +3448,7 @@ def expect_navigation( return AsyncEventContextManager( self._impl_obj.expect_navigation( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ).future ) @@ -3500,7 +3500,7 @@ async def wait_for_url( return mapping.from_maybe_impl( await self._impl_obj.wait_for_url( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ) ) @@ -4727,10 +4727,10 @@ def locator( return mapping.from_impl( self._impl_obj.locator( selector=selector, - has_text=has_text, - has_not_text=has_not_text, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -6262,11 +6262,11 @@ def locator( return mapping.from_impl( self._impl_obj.locator( - selector_or_locator=selector_or_locator, - has_text=has_text, - has_not_text=has_not_text, + selectorOrLocator=selector_or_locator, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -7039,7 +7039,7 @@ def set_test_id_attribute(self, attribute_name: str) -> None: """ return mapping.from_maybe_impl( - self._impl_obj.set_test_id_attribute(attribute_name=attribute_name) + self._impl_obj.set_test_id_attribute(attributeName=attribute_name) ) @@ -9415,7 +9415,7 @@ async def wait_for_url( return mapping.from_maybe_impl( await self._impl_obj.wait_for_url( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ) ) @@ -9903,10 +9903,10 @@ async def route_from_har( await self._impl_obj.route_from_har( har=har, url=url, - not_found=not_found, + notFound=not_found, update=update, - update_content=update_content, - update_mode=update_mode, + updateContent=update_content, + updateMode=update_mode, ) ) @@ -10380,10 +10380,10 @@ def locator( return mapping.from_impl( self._impl_obj.locator( selector=selector, - has_text=has_text, - has_not_text=has_not_text, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -12185,7 +12185,7 @@ def expect_navigation( return AsyncEventContextManager( self._impl_obj.expect_navigation( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ).future ) @@ -12274,7 +12274,7 @@ def expect_request( return AsyncEventContextManager( self._impl_obj.expect_request( - url_or_predicate=self._wrap_handler(url_or_predicate), timeout=timeout + urlOrPredicate=self._wrap_handler(url_or_predicate), timeout=timeout ).future ) @@ -12367,7 +12367,7 @@ def expect_response( return AsyncEventContextManager( self._impl_obj.expect_response( - url_or_predicate=self._wrap_handler(url_or_predicate), timeout=timeout + urlOrPredicate=self._wrap_handler(url_or_predicate), timeout=timeout ).future ) @@ -13688,10 +13688,10 @@ async def route_from_har( await self._impl_obj.route_from_har( har=har, url=url, - not_found=not_found, + notFound=not_found, update=update, - update_content=update_content, - update_mode=update_mode, + updateContent=update_content, + updateMode=update_mode, ) ) @@ -15153,11 +15153,11 @@ async def connect( return mapping.from_impl( await self._impl_obj.connect( - ws_endpoint=ws_endpoint, + wsEndpoint=ws_endpoint, timeout=timeout, - slow_mo=slow_mo, + slowMo=slow_mo, headers=mapping.to_impl(headers), - expose_network=expose_network, + exposeNetwork=expose_network, ) ) @@ -16161,11 +16161,11 @@ def locator( return mapping.from_impl( self._impl_obj.locator( - selector_or_locator=selector_or_locator, - has_text=has_text, - has_not_text=has_not_text, + selectorOrLocator=selector_or_locator, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -16823,10 +16823,10 @@ def filter( return mapping.from_impl( self._impl_obj.filter( - has_text=has_text, - has_not_text=has_not_text, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -19175,7 +19175,7 @@ async def to_have_title( return mapping.from_maybe_impl( await self._impl_obj.to_have_title( - title_or_reg_exp=title_or_reg_exp, timeout=timeout + titleOrRegExp=title_or_reg_exp, timeout=timeout ) ) @@ -19200,7 +19200,7 @@ async def not_to_have_title( return mapping.from_maybe_impl( await self._impl_obj.not_to_have_title( - title_or_reg_exp=title_or_reg_exp, timeout=timeout + titleOrRegExp=title_or_reg_exp, timeout=timeout ) ) @@ -19243,7 +19243,7 @@ async def to_have_url( return mapping.from_maybe_impl( await self._impl_obj.to_have_url( - url_or_reg_exp=url_or_reg_exp, timeout=timeout + urlOrRegExp=url_or_reg_exp, timeout=timeout ) ) @@ -19268,7 +19268,7 @@ async def not_to_have_url( return mapping.from_maybe_impl( await self._impl_obj.not_to_have_url( - url_or_reg_exp=url_or_reg_exp, timeout=timeout + urlOrRegExp=url_or_reg_exp, timeout=timeout ) ) @@ -19388,9 +19388,9 @@ async def to_contain_text( return mapping.from_maybe_impl( await self._impl_obj.to_contain_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) @@ -19429,9 +19429,9 @@ async def not_to_contain_text( return mapping.from_maybe_impl( await self._impl_obj.not_to_contain_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) @@ -19479,7 +19479,7 @@ async def to_have_attribute( return mapping.from_maybe_impl( await self._impl_obj.to_have_attribute( - name=name, value=value, ignore_case=ignore_case, timeout=timeout + name=name, value=value, ignoreCase=ignore_case, timeout=timeout ) ) @@ -19511,7 +19511,7 @@ async def not_to_have_attribute( return mapping.from_maybe_impl( await self._impl_obj.not_to_have_attribute( - name=name, value=value, ignore_case=ignore_case, timeout=timeout + name=name, value=value, ignoreCase=ignore_case, timeout=timeout ) ) @@ -20133,9 +20133,9 @@ async def to_have_text( return mapping.from_maybe_impl( await self._impl_obj.to_have_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) @@ -20174,9 +20174,9 @@ async def not_to_have_text( return mapping.from_maybe_impl( await self._impl_obj.not_to_have_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) diff --git a/playwright/sync_api/_generated.py b/playwright/sync_api/_generated.py index e4383917b..09a308c2c 100644 --- a/playwright/sync_api/_generated.py +++ b/playwright/sync_api/_generated.py @@ -3500,7 +3500,7 @@ def expect_navigation( return EventContextManager( self, self._impl_obj.expect_navigation( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ).future, ) @@ -3553,7 +3553,7 @@ def wait_for_url( return mapping.from_maybe_impl( self._sync( self._impl_obj.wait_for_url( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ) ) ) @@ -4817,10 +4817,10 @@ def locator( return mapping.from_impl( self._impl_obj.locator( selector=selector, - has_text=has_text, - has_not_text=has_not_text, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -6382,11 +6382,11 @@ def locator( return mapping.from_impl( self._impl_obj.locator( - selector_or_locator=selector_or_locator, - has_text=has_text, - has_not_text=has_not_text, + selectorOrLocator=selector_or_locator, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -7159,7 +7159,7 @@ def set_test_id_attribute(self, attribute_name: str) -> None: """ return mapping.from_maybe_impl( - self._impl_obj.set_test_id_attribute(attribute_name=attribute_name) + self._impl_obj.set_test_id_attribute(attributeName=attribute_name) ) @@ -9470,7 +9470,7 @@ def wait_for_url( return mapping.from_maybe_impl( self._sync( self._impl_obj.wait_for_url( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ) ) ) @@ -9970,10 +9970,10 @@ def route_from_har( self._impl_obj.route_from_har( har=har, url=url, - not_found=not_found, + notFound=not_found, update=update, - update_content=update_content, - update_mode=update_mode, + updateContent=update_content, + updateMode=update_mode, ) ) ) @@ -10460,10 +10460,10 @@ def locator( return mapping.from_impl( self._impl_obj.locator( selector=selector, - has_text=has_text, - has_not_text=has_not_text, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -12295,7 +12295,7 @@ def expect_navigation( return EventContextManager( self, self._impl_obj.expect_navigation( - url=self._wrap_handler(url), wait_until=wait_until, timeout=timeout + url=self._wrap_handler(url), waitUntil=wait_until, timeout=timeout ).future, ) @@ -12384,7 +12384,7 @@ def expect_request( return EventContextManager( self, self._impl_obj.expect_request( - url_or_predicate=self._wrap_handler(url_or_predicate), timeout=timeout + urlOrPredicate=self._wrap_handler(url_or_predicate), timeout=timeout ).future, ) @@ -12477,7 +12477,7 @@ def expect_response( return EventContextManager( self, self._impl_obj.expect_response( - url_or_predicate=self._wrap_handler(url_or_predicate), timeout=timeout + urlOrPredicate=self._wrap_handler(url_or_predicate), timeout=timeout ).future, ) @@ -13747,10 +13747,10 @@ def route_from_har( self._impl_obj.route_from_har( har=har, url=url, - not_found=not_found, + notFound=not_found, update=update, - update_content=update_content, - update_mode=update_mode, + updateContent=update_content, + updateMode=update_mode, ) ) ) @@ -15226,11 +15226,11 @@ def connect( return mapping.from_impl( self._sync( self._impl_obj.connect( - ws_endpoint=ws_endpoint, + wsEndpoint=ws_endpoint, timeout=timeout, - slow_mo=slow_mo, + slowMo=slow_mo, headers=mapping.to_impl(headers), - expose_network=expose_network, + exposeNetwork=expose_network, ) ) ) @@ -16255,11 +16255,11 @@ def locator( return mapping.from_impl( self._impl_obj.locator( - selector_or_locator=selector_or_locator, - has_text=has_text, - has_not_text=has_not_text, + selectorOrLocator=selector_or_locator, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -16919,10 +16919,10 @@ def filter( return mapping.from_impl( self._impl_obj.filter( - has_text=has_text, - has_not_text=has_not_text, + hasText=has_text, + hasNotText=has_not_text, has=has._impl_obj if has else None, - has_not=has_not._impl_obj if has_not else None, + hasNot=has_not._impl_obj if has_not else None, ) ) @@ -19326,7 +19326,7 @@ def to_have_title( return mapping.from_maybe_impl( self._sync( self._impl_obj.to_have_title( - title_or_reg_exp=title_or_reg_exp, timeout=timeout + titleOrRegExp=title_or_reg_exp, timeout=timeout ) ) ) @@ -19353,7 +19353,7 @@ def not_to_have_title( return mapping.from_maybe_impl( self._sync( self._impl_obj.not_to_have_title( - title_or_reg_exp=title_or_reg_exp, timeout=timeout + titleOrRegExp=title_or_reg_exp, timeout=timeout ) ) ) @@ -19397,9 +19397,7 @@ def to_have_url( return mapping.from_maybe_impl( self._sync( - self._impl_obj.to_have_url( - url_or_reg_exp=url_or_reg_exp, timeout=timeout - ) + self._impl_obj.to_have_url(urlOrRegExp=url_or_reg_exp, timeout=timeout) ) ) @@ -19425,7 +19423,7 @@ def not_to_have_url( return mapping.from_maybe_impl( self._sync( self._impl_obj.not_to_have_url( - url_or_reg_exp=url_or_reg_exp, timeout=timeout + urlOrRegExp=url_or_reg_exp, timeout=timeout ) ) ) @@ -19547,9 +19545,9 @@ def to_contain_text( self._sync( self._impl_obj.to_contain_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) ) @@ -19590,9 +19588,9 @@ def not_to_contain_text( self._sync( self._impl_obj.not_to_contain_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) ) @@ -19642,7 +19640,7 @@ def to_have_attribute( return mapping.from_maybe_impl( self._sync( self._impl_obj.to_have_attribute( - name=name, value=value, ignore_case=ignore_case, timeout=timeout + name=name, value=value, ignoreCase=ignore_case, timeout=timeout ) ) ) @@ -19676,7 +19674,7 @@ def not_to_have_attribute( return mapping.from_maybe_impl( self._sync( self._impl_obj.not_to_have_attribute( - name=name, value=value, ignore_case=ignore_case, timeout=timeout + name=name, value=value, ignoreCase=ignore_case, timeout=timeout ) ) ) @@ -20314,9 +20312,9 @@ def to_have_text( self._sync( self._impl_obj.to_have_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) ) @@ -20357,9 +20355,9 @@ def not_to_have_text( self._sync( self._impl_obj.not_to_have_text( expected=mapping.to_impl(expected), - use_inner_text=use_inner_text, + useInnerText=use_inner_text, timeout=timeout, - ignore_case=ignore_case, + ignoreCase=ignore_case, ) ) ) diff --git a/scripts/generate_api.py b/scripts/generate_api.py index 274740bda..4228a92a7 100644 --- a/scripts/generate_api.py +++ b/scripts/generate_api.py @@ -133,6 +133,9 @@ def arguments(func: FunctionType, indent: int) -> str: value_str = str(value) if name == "return": continue + assert ( + "_" not in name + ), f"Underscore in impl classes is not allowed, use camel case, func={func}, name={name}" if "Callable" in value_str: tokens.append(f"{name}=self._wrap_handler({to_snake_case(name)})") elif (