tests: Stabilize reloading in tests

The test added in fbd148f983 was flaky because
reloading didn't wait for the page load to actually finish fully, and thus the
element not being found on the page.

Fix this by providing the page path to the step, and making sure it waits for it
to be fully loaded again.

Also undos some flaky tags done in 2018:
12e5375931
c1c182d958

As this might have been the real culprit.
If not, those should be re-added.

See #8348, #5390
This commit is contained in:
Florian Bruhin 2024-12-09 20:48:45 +01:00
parent 3a956b4097
commit 258e61f97c
3 changed files with 7 additions and 8 deletions

View File

@ -1,17 +1,16 @@
Feature: Going back and forward.
Testing the :back/:forward commands.
@skip # Too flaky
Scenario: Going back/forward
Given I open data/backforward/1.txt
When I open data/backforward/2.txt
And I run :tab-only
And I run :back
And I wait until data/backforward/1.txt is loaded
And I reload
And I reload data/backforward/1.txt
And I run :forward
And I wait until data/backforward/2.txt is loaded
And I reload
And I reload data/backforward/2.txt
Then the session should look like:
"""
windows:
@ -81,7 +80,6 @@ Feature: Going back and forward.
- url: http://localhost:*/data/backforward/2.txt
"""
@flaky
Scenario: Going back with count.
Given I open data/backforward/1.txt
When I open data/backforward/2.txt
@ -89,7 +87,7 @@ Feature: Going back and forward.
And I run :tab-only
And I run :back with count 2
And I wait until data/backforward/1.txt is loaded
And I reload
And I reload data/backforward/1.txt
Then the session should look like:
"""
windows:

View File

@ -278,11 +278,12 @@ def run_command(quteproc, server, tmpdir, command):
quteproc.send_cmd(command, count=count, invalid=invalid)
@bdd.when(bdd.parsers.parse("I reload"))
def reload(qtbot, server, quteproc):
@bdd.when(bdd.parsers.parse("I reload {path}"))
def reload(qtbot, server, quteproc, path):
"""Reload and wait until a new request is received."""
with qtbot.wait_signal(server.new_request):
quteproc.send_cmd(':reload')
quteproc.wait_for_load_finished(path)
@bdd.when(bdd.parsers.parse("I wait until {path} is loaded"))

View File

@ -280,7 +280,7 @@ Feature: Prompts
And I wait for a prompt
And I run :prompt-accept --save yes
And I wait for "*Text pasted: *" in the log
And I reload
And I reload data/prompt/clipboard.html
And I run :click-element id paste
Then the javascript message "Text pasted: *" should be logged