diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 90bc1a3ec..725f6d76f 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -23,6 +23,7 @@ import re import time import json import logging +import collections import yaml import pytest_bdd as bdd @@ -118,6 +119,18 @@ def list_of_loaded_pages(httpbin, pages): assert actual_requests == expected_requests +@bdd.then(bdd.parsers.parse("The unordered requests should be:\n{pages}")) +def list_of_loaded_pages_unordered(httpbin, pages): + expected_requests = [httpbin.ExpectedRequest('GET', '/' + path.strip()) + for path in pages.split('\n')] + actual_requests = httpbin.get_requests() + # Requests are not hashable, we need to convert to ExpectedRequests + actual_requests = map(httpbin.ExpectedRequest.from_request, + actual_requests) + assert (collections.Counter(actual_requests) == + collections.Counter(expected_requests)) + + @bdd.then(bdd.parsers.re(r'the (?Perror|message|warning) ' r'"(?P.*)" should be shown.')) def expect_error(quteproc, httpbin, category, message): diff --git a/tests/integration/features/misc.feature b/tests/integration/features/misc.feature index 24fabd320..c7e8112e4 100644 --- a/tests/integration/features/misc.feature +++ b/tests/integration/features/misc.feature @@ -160,7 +160,7 @@ Feature: Various utility commands. And I run :stop And I open custom/redirect-later-continue in a new tab And I wait 1s - Then the requests should be: + Then the unordered requests should be: custom/redirect-later-continue custom/redirect-later?delay=-1 # no request on / because we stopped the redirect