mirror of
https://github.com/User0332/rewards-farmer.git
synced 2026-09-16 09:31:36 +00:00
wait for the breakdown panel's content, not just its container
check_selectors reports FAILED for two selectors that are fine.
The wait before them is satisfied by a placeholder. get_sidebar_section
returns the first section whose id starts with react-aria, and that section is
in the DOM as soon as the panel opens, holding a "Loading..." placeholder. So
`wait_until(get_sidebar_section() is not None)` returns immediately, and the
two selectors that read the panel's text then read "Loading..." and raise.
The report's own output shows it: the section that resolves OK has the text
"Loading...", and the two entries under it fail.
Before, on a healthy en-US account:
OK get_sidebar_section 'Loading...'
FAILED get_points_earned_from_searches_on_points_breakdown
FAILED get_close_button_on_points_breakdown
OK=10 ABSENT=1 FAILED=2
After:
OK get_sidebar_section "Points breakdown | Today's points | 480 | To"
OK get_points_earned_from_searches_on_points_breakdown (25, 25)
OK get_close_button_on_points_breakdown
OK=12 ABSENT=1 FAILED=0
This matters more than a cosmetic miscount. The README asks people to paste
this output into bug reports and says FAILED is what needs fixing, so a false
FAILED sends both the reporter and whoever triages it after selectors that
work. The bot itself was never affected, read_search_points reaches the same
selector through wait_for_element and so does wait.
Waiting on the content rather than the container keeps a genuine breakage
reporting FAILED; it just costs the timeout first.
This commit is contained in:
@@ -184,6 +184,18 @@ def main():
|
|||||||
driver.execute_script("arguments[0].click();", elements.get_points_breakdown_button())
|
driver.execute_script("arguments[0].click();", elements.get_points_breakdown_button())
|
||||||
wait_until(lambda: elements.get_sidebar_section() is not None, 30)
|
wait_until(lambda: elements.get_sidebar_section() is not None, 30)
|
||||||
|
|
||||||
|
# The section exists before it has content: the panel renders a
|
||||||
|
# "Loading..." placeholder inside it first, and that satisfies the
|
||||||
|
# presence check above immediately. Waiting only for the section leaves
|
||||||
|
# the two selectors below reading an empty panel, so they report FAILED
|
||||||
|
# for markup that is fine, on a page that is merely slow. Wait for the
|
||||||
|
# content itself. A selector that really is broken still reports FAILED,
|
||||||
|
# it just costs the timeout first.
|
||||||
|
wait_until(
|
||||||
|
lambda: elements.get_points_earned_from_searches_on_points_breakdown() is not None,
|
||||||
|
30,
|
||||||
|
)
|
||||||
|
|
||||||
report.check("get_sidebar_section", elements.get_sidebar_section)
|
report.check("get_sidebar_section", elements.get_sidebar_section)
|
||||||
report.check(
|
report.check(
|
||||||
"get_points_earned_from_searches_on_points_breakdown",
|
"get_points_earned_from_searches_on_points_breakdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user