コード例 #1
0
 async def to_have_text(
     self,
     expected: Union[List[Union[Pattern, str]], Pattern, str],
     use_inner_text: bool = None,
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     if isinstance(expected, list):
         expected_text = to_expected_text_values(expected,
                                                 normalize_white_space=True)
         await self._expect_impl(
             "to.have.text.array",
             FrameExpectOptions(
                 expectedText=expected_text,
                 useInnerText=use_inner_text,
                 timeout=timeout,
             ),
             expected,
             "Locator expected to have text",
         )
     else:
         expected_text = to_expected_text_values([expected],
                                                 normalize_white_space=True)
         await self._expect_impl(
             "to.have.text",
             FrameExpectOptions(
                 expectedText=expected_text,
                 useInnerText=use_inner_text,
                 timeout=timeout,
             ),
             expected,
             "Locator expected to have text",
         )
コード例 #2
0
 async def to_be_focused(
     self,
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     await self._expect_impl(
         "to.be.focused",
         FrameExpectOptions(timeout=timeout),
         None,
         "Locator expected to be focused",
     )
コード例 #3
0
 async def to_have_count(
     self,
     count: int,
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     await self._expect_impl(
         "to.have.count",
         FrameExpectOptions(expectedNumber=count, timeout=timeout),
         count,
         "Locator expected to have count",
     )
コード例 #4
0
 async def to_have_title(self,
                         title_or_reg_exp: Union[Pattern, str],
                         timeout: float = None) -> None:
     expected_values = to_expected_text_values([title_or_reg_exp],
                                               normalize_white_space=True)
     __tracebackhide__ = True
     await self._expect_impl(
         "to.have.title",
         FrameExpectOptions(expectedText=expected_values, timeout=timeout),
         title_or_reg_exp,
         "Page title expected to be",
     )
コード例 #5
0
 async def to_have_values(
     self,
     values: List[Union[Pattern[str], str]],
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     expected_text = to_expected_text_values(values)
     await self._expect_impl(
         "to.have.values",
         FrameExpectOptions(expectedText=expected_text, timeout=timeout),
         values,
         "Locator expected to have Values",
     )
コード例 #6
0
 async def to_have_id(
     self,
     id: Union[str, Pattern[str]],
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     expected_text = to_expected_text_values([id])
     await self._expect_impl(
         "to.have.id",
         FrameExpectOptions(expectedText=expected_text, timeout=timeout),
         id,
         "Locator expected to have ID",
     )
コード例 #7
0
 async def to_have_class(
     self,
     expected: Union[List[Union[Pattern[str], str]], Pattern[str], str],
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     if isinstance(expected, list):
         expected_text = to_expected_text_values(expected)
         await self._expect_impl(
             "to.have.class.array",
             FrameExpectOptions(expectedText=expected_text, timeout=timeout),
             expected,
             "Locator expected to have class",
         )
     else:
         expected_text = to_expected_text_values([expected])
         await self._expect_impl(
             "to.have.class",
             FrameExpectOptions(expectedText=expected_text, timeout=timeout),
             expected,
             "Locator expected to have class",
         )
コード例 #8
0
 async def to_be_checked(
     self,
     timeout: float = None,
     checked: bool = None,
 ) -> None:
     __tracebackhide__ = True
     await self._expect_impl(
         "to.be.checked"
         if checked is None or checked is True else "to.be.unchecked",
         FrameExpectOptions(timeout=timeout),
         None,
         "Locator expected to be checked",
     )
コード例 #9
0
 async def to_have_value(
     self,
     value: Union[str, Pattern],
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     expected_text = to_expected_text_values([value])
     await self._expect_impl(
         "to.have.value",
         FrameExpectOptions(expectedText=expected_text, timeout=timeout),
         value,
         "Locator expected to have Value",
     )
コード例 #10
0
 async def to_have_url(
     self, url_or_reg_exp: 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])
     await self._expect_impl(
         "to.have.url",
         FrameExpectOptions(expectedText=expected_text, timeout=timeout),
         url_or_reg_exp,
         "Page URL expected to be",
     )
コード例 #11
0
 async def to_have_js_property(
     self,
     name: str,
     value: Any,
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     await self._expect_impl(
         "to.have.property",
         FrameExpectOptions(
             expressionArg=name, expectedValue=value, timeout=timeout
         ),
         value,
         "Locator expected to have JS Property",
     )
コード例 #12
0
 async def to_have_css(
     self,
     name: str,
     value: Union[str, Pattern[str]],
     timeout: float = None,
 ) -> None:
     __tracebackhide__ = True
     expected_text = to_expected_text_values([value])
     await self._expect_impl(
         "to.have.css",
         FrameExpectOptions(
             expressionArg=name, expectedText=expected_text, timeout=timeout
         ),
         value,
         "Locator expected to have CSS",
     )