Test suite: step 'the Tor Browser shows the "Unable to connect" error' is fagile

anonym
2026-04-13T10:00:32Z

That step, when invoked from `Scenario: The Tor Browser cannot access the LAN`, started to fail occasionally (\~5% of runs) since 2025-12-18 like this (from [this run](https://jenkins.tails.boum.org/job/test_Tails_ISO_stable/6182/)):

``...

That step, when invoked from Scenario: The Tor Browser cannot access the LAN, started to fail occasionally (~5% of runs) since 2025-12-18 like this (from this run):

[...]
02:45:48.859895934: try_for: attempt 19 (56.06s elapsed of 60s)...
02:45:48.860062857: executing Python as amnesia: node5590 = node5528.child(r'Problem loading page', roleName=r'document web')
02:45:48.955123422: execution complete
02:45:48.955262212: executing Python as amnesia:
    nodes5591 = node5590.findChildren(dogtail.predicate.GenericPredicate(roleName=r'heading'))
    print(len(nodes5591))
02:45:48.970694179: execution complete
02:45:48.970739354: try_for: failed by code block returning failure
02:45:51.970861200: try_for: attempt 20 (59.17s elapsed of 60s)...
02:45:51.971024987: executing Python as amnesia: node5592 = node5528.child(r'Problem loading page', roleName=r'document web')
02:45:52.066050907: execution complete
02:45:52.066228509: executing Python as amnesia:
    nodes5593 = node5592.findChildren(dogtail.predicate.GenericPredicate(roleName=r'heading'))
    print(len(nodes5593))
02:45:52.094614242: execution complete
02:45:52.094767970: try_for: failed by code block returning failure
    Then the Tor Browser shows the "Unable to connect" error (failed)                       # features/step_definitions/browser.rb:376
      try_for() timeout expired (Timeout::Error)
      ./features/support/helpers/misc_helpers.rb:145:in `rescue in try_for'
      ./features/support/helpers/misc_helpers.rb:51:in `try_for'
      ./features/step_definitions/browser.rb:383:in `/^the (Tor|Unsafe) Browser shows the "([^"]+)" error$/'
      features/torified_browsing.feature:13:in `Then the Tor Browser shows the "Unable to connect" error'
[...]

The above is not super helpful, but looking in the journal we can get more insight what fails:

Mar 03 11:12:01 amnesia tails-autotest-remote-shell[3085]: INFO:root:Executing Python as amnesia:
Mar 03 11:12:01 amnesia tails-autotest-remote-shell[3085]: node5590 = node5528.child(r'Problem loading page', roleName=r'document web')
Mar 03 11:12:01 amnesia tails-autotest-remote-shell[3085]: INFO:root:Result: [18291, "success", null, "", ""]
Mar 03 11:12:01 amnesia tails-autotest-remote-shell[3085]: INFO:root:Executing Python as amnesia:
Mar 03 11:12:01 amnesia tails-autotest-remote-shell[3085]: nodes5591 = node5590.findChildren(dogtail.predicate.GenericPredicate(roleName=r'heading'))
Mar 03 11:12:01 amnesia tails-autotest-remote-shell[3085]: print(len(nodes5591))
Mar 03 11:12:01 amnesia tails-autotest-remote-shell[3085]: INFO:root:Result: [18292, "success", null, "0\n", ""]

So we find the correct page (tab) "Problem loading page", but inside it we don't find any headings (the 0\n returned by print(len(nodes5591))).

We don't have this problem in the only other usage of this step (the Unsafe Browser shows the "The proxy server is refusing connections" error) or in the other steps using page_has_heading.