-
Notifications
You must be signed in to change notification settings - Fork 16.7k
fix(playwright): Download dashboard correctly #35484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -216,6 +216,13 @@ def find_unexpected_errors(page: Page) -> list[str]: | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| return error_messages | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| @staticmethod | ||||||||||||||||||||||||||||||||||||||||||||||||||
| def _get_screenshot(page: Page, element: Locator, element_name: str) -> bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if element_name == "standalone": | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return page.screenshot(full_page=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return element.screenshot() | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # noqa: C901 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self, url: str, element_name: str, user: User | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> bytes | None: | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -363,11 +370,18 @@ def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # n | |||||||||||||||||||||||||||||||||||||||||||||||||
| "falling back to standard screenshot" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| img = element.screenshot() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| img = WebDriverPlaywright._get_screenshot( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| page, element, element_name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| img = element.screenshot() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| img = WebDriverPlaywright._get_screenshot( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| page, element, element_name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| img = element.screenshot() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| img = WebDriverPlaywright._get_screenshot( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| page, element, element_name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+373
to
+383
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect method calls
The calls to Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #54df86 Should Bito avoid suggestions like this for future reviews? (Manage Rules)
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| except PlaywrightTimeout: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # raise again for the finally block, but handled above | ||||||||||||||||||||||||||||||||||||||||||||||||||
| pass | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
_get_screenshotmethod is incorrectly defined as a@staticmethodbut is being called using the class nameWebDriverPlaywright._get_screenshot()throughout the codebase. This breaks proper object-oriented design and prevents inheritance/mocking. The method should be an instance method (remove@staticmethodand useself) and all calls should useself._get_screenshot()instead of the class name prefix. This affects downstream calls inget_screenshotmethod at lines 373, 377, and 381.Code suggestion
Code Review Run #54df86
Should Bito avoid suggestions like this for future reviews? (Manage Rules)