| 294 | |
| 295 | |
| 296 | class TimeoutSettings: |
| 297 | |
| 298 | @staticmethod |
| 299 | def launch_timeout(timeout: Optional[float] = None) -> float: |
| 300 | return ( |
| 301 | timeout |
| 302 | if timeout is not None |
| 303 | else DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT_IN_MILLISECONDS |
| 304 | ) |
| 305 | |
| 306 | def __init__(self, parent: Optional["TimeoutSettings"]) -> None: |
| 307 | self._parent = parent |
| 308 | self._default_timeout: Optional[float] = None |
| 309 | self._default_navigation_timeout: Optional[float] = None |
| 310 | |
| 311 | def set_default_timeout(self, timeout: Optional[float]) -> None: |
| 312 | self._default_timeout = timeout |
| 313 | |
| 314 | def timeout(self, timeout: float = None) -> float: |
| 315 | if timeout is not None: |
| 316 | return timeout |
| 317 | if self._default_timeout is not None: |
| 318 | return self._default_timeout |
| 319 | if self._parent: |
| 320 | return self._parent.timeout() |
| 321 | return DEFAULT_PLAYWRIGHT_TIMEOUT_IN_MILLISECONDS |
| 322 | |
| 323 | def set_default_navigation_timeout( |
| 324 | self, navigation_timeout: Optional[float] |
| 325 | ) -> None: |
| 326 | self._default_navigation_timeout = navigation_timeout |
| 327 | |
| 328 | def default_navigation_timeout(self) -> Optional[float]: |
| 329 | return self._default_navigation_timeout |
| 330 | |
| 331 | def default_timeout(self) -> Optional[float]: |
| 332 | return self._default_timeout |
| 333 | |
| 334 | def navigation_timeout(self, timeout: float = None) -> float: |
| 335 | if timeout is not None: |
| 336 | return timeout |
| 337 | if self._default_navigation_timeout is not None: |
| 338 | return self._default_navigation_timeout |
| 339 | if self._default_timeout is not None: |
| 340 | return self._default_timeout |
| 341 | if self._parent: |
| 342 | return self._parent.navigation_timeout() |
| 343 | return DEFAULT_PLAYWRIGHT_TIMEOUT_IN_MILLISECONDS |
| 344 | |
| 345 | |
| 346 | def serialize_error(ex: Exception, tb: Optional[TracebackType]) -> ErrorPayload: |
no outgoing calls
no test coverage detected