diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index b22cf0924..2ef565e66 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -129,11 +129,23 @@ def run_command(quteproc, httpbin, command): else: count = None command = command.replace('(port)', str(httpbin.port)) - command = command.replace('(datapath)', utils.abs_datapath(__file__)) quteproc.send_cmd(command, count=count) +@bdd.when(bdd.parsers.parse("I execute the userscript {userscript}")) +def run_userscript(quteproc, userscript): + """Run a userscript located in tests/integration/data/userscripts. + + Wrapper around :spawn --userscript {userscript} that uses an absolute + path. + """ + abs_userscript_path = os.path.join(utils.abs_datapath(__file__), + 'userscripts', userscript) + cmd = ':spawn --userscript {abs_userscript_path}' + quteproc.send_cmd(cmd.format(abs_userscript_path=abs_userscript_path)) + + @bdd.when(bdd.parsers.parse("I reload")) def reload(qtbot, httpbin, quteproc, command): """Reload and wait until a new request is received.""" diff --git a/tests/integration/features/spawn.feature b/tests/integration/features/spawn.feature index 9ec2a046f..eba2496fc 100644 --- a/tests/integration/features/spawn.feature +++ b/tests/integration/features/spawn.feature @@ -17,7 +17,7 @@ Feature: :spawn Then "Executing echo with args ['about:blank'], userscript=False" should be logged Scenario: Running :spawn with userscript - When I run :spawn --userscript (datapath)/userscripts/open_current_url + When I execute the userscript open_current_url And I wait until about:blank is loaded Then the following tabs should be open: - about:blank