From dec0f0753d0d0600ed45a4d691f5e2368c66f1db Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 17:22:07 +0200 Subject: [PATCH] Relax the checking in :view-source test --- tests/end2end/features/conftest.py | 15 ++++----------- tests/end2end/features/misc.feature | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index be72ad653..231e6565a 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -458,18 +458,11 @@ def check_header(quteproc, header, value): assert data['headers'][header] == value -@bdd.then(bdd.parsers.parse("the page source should look like {filename}")) -def check_contents(quteproc, filename): - """Check the current page's content. - - The filename is interpreted relative to tests/end2end/data. - """ +@bdd.then(bdd.parsers.parse('the page should contain the html "{text}"')) +def check_contents_html(quteproc, text): + """Check the current page's content based on a substring.""" content = quteproc.get_content(plain=False) - path = os.path.join(utils.abs_datapath(), - os.path.join(*filename.split('/'))) - with open(path, 'r', encoding='utf-8') as f: - file_content = f.read() - assert content == file_content + assert text in content @bdd.then(bdd.parsers.parse('the page should contain the plaintext "{text}"')) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 39f44e31e..cd60b15b4 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -203,7 +203,7 @@ Feature: Various utility commands. url: http://localhost:*/data/hello.txt - active: true history: [] - And the page source should look like misc/hello.txt.html + And the page should contain the html "/* Literal.Number.Integer */" @qtwebengine_skip: Flaky due to :view-source being async Scenario: :view-source on source page.