mirror of
https://github.com/User0332/rewards-farmer.git
synced 2026-09-16 01:31:36 +00:00
tell absence and a slow render apart when a task fails
Every failed task printed the same reason, because the blanket catch in complete_all_tasks treated NoSuchElementException and TimeoutException as one finding. A wait that expires says nothing about whether the section was there, since wait_for_element swallowed whatever the getter raised and returned False. A market that does not ship visual search and a points panel that was on screen and slow both arrived as TimeoutException wait_for_element now keeps the last reason the getter gave and raises ElementNeverAppeared when nothing was in the DOM for the whole wait. _container_by_id raises ElementNotReady when the id is present but no visible copy has content yet, which is the hydrating case it used to report as missing. Both subclass what they refine, so claim_bonus_points and complete_bing_daily_set keep working untouched A task that was reached and then ran out of time is now a [FAIL] rather than a [SKIP], because it may have left points behind. Absence stays a [SKIP] 56 tests pass, 20 of them new. A mutation check backs them, forcing every expired wait to count as absence fails 2, and collapsing the two branches back into one [SKIP] fails 4 Refs #52
This commit is contained in:
@@ -163,6 +163,19 @@ class DuplicatedContainer(unittest.TestCase):
|
||||
|
||||
self.assertEqual(len(cards), 7)
|
||||
|
||||
def test_a_container_that_is_there_but_empty_is_not_reported_as_missing(self):
|
||||
# Both failures used to raise NoSuchElementException, so a section that
|
||||
# was on the page and still rendering got reported as one this market
|
||||
# does not ship. Waiting is the answer to this one.
|
||||
with self.assertRaises(element_selectors.ElementNotReady):
|
||||
selectors_for(self._driver(visible_links=0, hidden_links=7)).get_all_misc_cards()
|
||||
|
||||
def test_a_container_that_is_absent_is_reported_as_missing(self):
|
||||
with self.assertRaises(NoSuchElementException) as caught:
|
||||
selectors_for(FakeDriver()).get_all_misc_cards()
|
||||
|
||||
self.assertNotIsInstance(caught.exception, element_selectors.ElementNotReady)
|
||||
|
||||
|
||||
class DailySetOpener(unittest.TestCase):
|
||||
"""The opener label has to be distinguished from the level up entry."""
|
||||
|
||||
Reference in New Issue
Block a user