You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "eschutho (via GitHub)" <gi...@apache.org> on 2026/04/23 02:02:26 UTC
[PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
eschutho opened a new pull request, #39579:
URL: https://github.com/apache/superset/pull/39579
### SUMMARY
When taking a PDF screenshot of a long dashboard, some charts were still showing the loading spinner in the output. The Playwright screenshot path checked for `.loading` elements to disappear by calling `page.locator(".loading").all()` once and waiting for each to detach — but this only captured spinners that existed at that single moment. Charts that started loading *after* the snapshot was taken (common on long dashboards where charts render lazily) were never waited for.
**Fix:** Replace the snapshot loop with `page.wait_for_function` which continuously polls `document.querySelectorAll('.loading').length === 0` until the page is genuinely clear of all spinners. Also use `self._screenshot_load_wait` (already stored on the base `WebDriverProxy` class) for the timeout, consistent with the Selenium path.
**Before:**
```python
for loading_element in page.locator(".loading").all():
loading_element.wait_for(state="detached")
```
**After:**
```python
page.wait_for_function(
"() => document.querySelectorAll('.loading').length === 0",
timeout=self._screenshot_load_wait * 1000,
)
```
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend-only change to screenshot timing logic.
### TESTING INSTRUCTIONS
1. Open a long dashboard with many charts (10+) that take a few seconds to load.
2. Trigger a PDF report download.
3. Verify that all charts are fully rendered in the PDF with no loading spinners visible.
Two unit tests were added covering:
- `test_uses_wait_for_function_to_detect_spinners` — verifies `page.wait_for_function` is called with the correct JS expression and timeout, and that the old `locator(".loading")` snapshot approach is not used.
- `test_spinner_timeout_logs_warning_and_raises` — verifies a `PlaywrightTimeout` from `wait_for_function` is logged as a warning and re-raised.
### ADDITIONAL INFORMATION
- [x] Has associated issue: https://app.shortcut.com/preset/story/104659/pdf-download-shows-incomplete-dashboard-with-loading-spinner
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39579:
URL: https://github.com/apache/superset/pull/39579#issuecomment-4301231119
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila merged PR #39579:
URL: https://github.com/apache/superset/pull/39579
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on code in PR #39579:
URL: https://github.com/apache/superset/pull/39579#discussion_r3130438678
##########
superset/utils/webdriver.py:
##########
@@ -300,8 +300,10 @@ def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # n
logger.debug(
"Wait for loading element of charts to be gone at url: %s", url
)
- for loading_element in page.locator(".loading").all():
- loading_element.wait_for(state="detached")
+ page.wait_for_function(
+ "() => document.querySelectorAll('.loading').length === 0",
+ timeout=self._screenshot_load_wait * 1000,
Review Comment:
@eschutho why do we multiply the `_screenshot_load_wait` by `1000` here? Isn't `SCREENSHOT_LOAD_WAIT` already in seconds?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on code in PR #39579:
URL: https://github.com/apache/superset/pull/39579#discussion_r3134700586
##########
superset/utils/webdriver.py:
##########
@@ -300,8 +300,10 @@ def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # n
logger.debug(
"Wait for loading element of charts to be gone at url: %s", url
)
- for loading_element in page.locator(".loading").all():
- loading_element.wait_for(state="detached")
+ page.wait_for_function(
+ "() => document.querySelectorAll('.loading').length === 0",
+ timeout=self._screenshot_load_wait * 1000,
Review Comment:
oh gotcha! Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #39579:
URL: https://github.com/apache/superset/pull/39579#issuecomment-4301280659
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/39579?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `1 line` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 63.77%. Comparing base ([`72d39be`](https://app.codecov.io/gh/apache/superset/commit/72d39bea857b929246cd9dd74f8480c173da0cd4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`199435e`](https://app.codecov.io/gh/apache/superset/commit/199435e5c55e7df227e0cada9340c8137ca44840?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 14 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/39579?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/utils/webdriver.py](https://app.codecov.io/gh/apache/superset/pull/39579?src=pr&el=tree&filepath=superset%2Futils%2Fwebdriver.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdXRpbHMvd2ViZHJpdmVyLnB5) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/39579?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #39579 +/- ##
==========================================
- Coverage 64.57% 63.77% -0.81%
==========================================
Files 2564 2564
Lines 133558 133574 +16
Branches 31031 31031
==========================================
- Hits 86250 85182 -1068
- Misses 45816 46882 +1066
- Partials 1492 1510 +18
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.88% <0.00%> (+<0.01%)` | :arrow_up: |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.66% <0.00%> (+<0.01%)` | :arrow_up: |
| [python](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `60.29% <0.00%> (-1.81%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `60.15% <0.00%> (+<0.01%)` | :arrow_up: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/39579/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/39579?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #39579:
URL: https://github.com/apache/superset/pull/39579#discussion_r3127901320
##########
tests/unit_tests/utils/webdriver_test.py:
##########
@@ -640,6 +640,114 @@ def test_find_unexpected_errors_processes_alerts(
mock_button.click.assert_called_once()
mock_close_button.click.assert_called_once()
+ @patch("superset.utils.webdriver.PLAYWRIGHT_AVAILABLE", True)
+ @patch("superset.utils.webdriver.sync_playwright")
+ @patch("superset.utils.webdriver.app")
+ def test_uses_wait_for_function_to_detect_spinners(
+ self, mock_app, mock_sync_playwright
+ ):
+ """wait_for_function polls for spinner absence rather than snapshotting."""
+ mock_user = MagicMock()
+ mock_user.username = "test_user"
+ mock_app.config = {
+ "WEBDRIVER_OPTION_ARGS": [],
+ "WEBDRIVER_WINDOW": {"pixel_density": 1},
+ "SCREENSHOT_PLAYWRIGHT_DEFAULT_TIMEOUT": 30000,
+ "SCREENSHOT_PLAYWRIGHT_WAIT_EVENT": "networkidle",
+ "SCREENSHOT_SELENIUM_HEADSTART": 0,
+ "SCREENSHOT_SELENIUM_ANIMATION_WAIT": 0,
+ "SCREENSHOT_REPLACE_UNEXPECTED_ERRORS": False,
+ "SCREENSHOT_TILED_ENABLED": False,
+ "SCREENSHOT_LOCATE_WAIT": 10,
+ "SCREENSHOT_LOAD_WAIT": 60,
+ "SCREENSHOT_WAIT_FOR_ERROR_MODAL_VISIBLE": 10,
+ "SCREENSHOT_WAIT_FOR_ERROR_MODAL_INVISIBLE": 10,
+ }
+
+ mock_playwright_instance = MagicMock()
+ mock_browser = MagicMock()
+ mock_context = MagicMock()
+ mock_page = MagicMock()
+ mock_element = MagicMock()
+
+ mock_sync_playwright.return_value.__enter__.return_value = (
+ mock_playwright_instance
+ )
+ mock_playwright_instance.chromium.launch.return_value = mock_browser
+ mock_browser.new_context.return_value = mock_context
+ mock_context.new_page.return_value = mock_page
+ mock_page.locator.return_value = mock_element
+ mock_element.screenshot.return_value = b"screenshot"
+
+ with patch.object(WebDriverPlaywright, "auth", return_value=mock_context):
+ driver = WebDriverPlaywright("chrome")
+ driver.get_screenshot("http://example.com", "test-element", mock_user)
+
+ mock_page.wait_for_function.assert_called_once_with(
+ "() => document.querySelectorAll('.loading').length === 0",
+ timeout=60 * 1000,
+ )
+ # Guard against reintroducing the old snapshot-based approach
+ loading_locator_calls = [
+ c for c in mock_page.locator.call_args_list if c.args == (".loading",)
+ ]
+ assert loading_locator_calls == []
+
+ @patch("superset.utils.webdriver.PLAYWRIGHT_AVAILABLE", True)
+ @patch("superset.utils.webdriver.sync_playwright")
+ @patch("superset.utils.webdriver.logger")
+ @patch("superset.utils.webdriver.app")
+ def test_spinner_timeout_logs_warning_and_raises(
+ self, mock_app, mock_logger, mock_sync_playwright
+ ):
Review Comment:
**Suggestion:** Add explicit type hints to this newly added test method parameters and return type to satisfy the typing requirement for new Python methods. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This newly introduced test method also lacks explicit type annotations on its parameters and return type. Under a rule requiring type hints for new Python methods, the suggestion correctly identifies an actual violation.
</details>
[Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20tests%2Funit_tests%2Futils%2Fwebdriver_test.py%0A%2A%2ALine%3A%2A%2A%20700%3A702%0A%2A%2AComment%3A%2A%2A%0A%09%2ACustom%20Rule%3A%20Add%20explicit%20type%20hints%20to%20this%20newly%20added%20test%20method%20parameters%20and%20return%20type%20to%20satisfy%20the%20typing%20requirement%20for%20new%20Python%20methods.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20
minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20tests%2Funit_tests%2Futils%2Fwebdriver_test.py%0A%2A%2ALine%3A%2A%2A%20700%3A702%0A%2A%2AComment%3A%2A%2A%0A%09%2ACustom%20Rule%3A%20Add%20explicit%20type%20hints%20to%20this%20newly%20added%20test%20method%20parameters%20and%20return%20type%20to%20satisfy%20the%20typing%20requirement%20for%20new%20Python%20methods.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20corr
ectness%20and%20implement%20a%20minimal%20fix%0A)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** tests/unit_tests/utils/webdriver_test.py
**Line:** 700:702
**Comment:**
*Custom Rule: Add explicit type hints to this newly added test method parameters and return type to satisfy the typing requirement for new Python methods.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39579&comment_hash=e0820df0b3ebe77cb80fa42230139ec27e2b5e9e45a642e57f52029e75419844&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39579&comment_hash=e0820df0b3ebe77cb80fa42230139ec27e2b5e9e45a642e57f52029e75419844&reaction=dislike'>👎</a>
##########
tests/unit_tests/utils/webdriver_test.py:
##########
@@ -640,6 +640,114 @@ def test_find_unexpected_errors_processes_alerts(
mock_button.click.assert_called_once()
mock_close_button.click.assert_called_once()
+ @patch("superset.utils.webdriver.PLAYWRIGHT_AVAILABLE", True)
+ @patch("superset.utils.webdriver.sync_playwright")
+ @patch("superset.utils.webdriver.app")
+ def test_uses_wait_for_function_to_detect_spinners(
+ self, mock_app, mock_sync_playwright
+ ):
Review Comment:
**Suggestion:** Add explicit type hints to this newly added test method parameters and its return type so the function signature is fully typed. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This newly added test method has no type annotations for its parameters or return type. If the PR's typing rule requires explicit type hints on new Python methods, this is a real violation in the existing code.
</details>
[Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20tests%2Funit_tests%2Futils%2Fwebdriver_test.py%0A%2A%2ALine%3A%2A%2A%20646%3A648%0A%2A%2AComment%3A%2A%2A%0A%09%2ACustom%20Rule%3A%20Add%20explicit%20type%20hints%20to%20this%20newly%20added%20test%20method%20parameters%20and%20its%20return%20type%20so%20the%20function%20signature%20is%20fully%20typed.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%
0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20tests%2Funit_tests%2Futils%2Fwebdriver_test.py%0A%2A%2ALine%3A%2A%2A%20646%3A648%0A%2A%2AComment%3A%2A%2A%0A%09%2ACustom%20Rule%3A%20Add%20explicit%20type%20hints%20to%20this%20newly%20added%20test%20method%20parameters%20and%20its%20return%20type%20so%20the%20function%20signature%20is%20fully%20typed.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20
a%20minimal%20fix%0A)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** tests/unit_tests/utils/webdriver_test.py
**Line:** 646:648
**Comment:**
*Custom Rule: Add explicit type hints to this newly added test method parameters and its return type so the function signature is fully typed.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39579&comment_hash=240db7feb1ddd9eb9fdc67bdb1c1061d2625acf2555464d4692c91b56b75baeb&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39579&comment_hash=240db7feb1ddd9eb9fdc67bdb1c1061d2625acf2555464d4692c91b56b75baeb&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(reports): poll for spinner absence instead of snapshotting loading elements [superset]
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #39579:
URL: https://github.com/apache/superset/pull/39579#discussion_r3134340292
##########
superset/utils/webdriver.py:
##########
@@ -300,8 +300,10 @@ def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # n
logger.debug(
"Wait for loading element of charts to be gone at url: %s", url
)
- for loading_element in page.locator(".loading").all():
- loading_element.wait_for(state="detached")
+ page.wait_for_function(
+ "() => document.querySelectorAll('.loading').length === 0",
+ timeout=self._screenshot_load_wait * 1000,
Review Comment:
@Vitor-Avila the playwright timeout is in milliseconds. https://playwright.dev/python/docs/api/class-frame#frame-wait-for-function
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org