Add tests for {url:pretty} variable

This commit is contained in:
Panagiotis Ktistakis 2016-04-20 17:58:14 +03:00
parent c7534bd4a3
commit 8550fb3401
3 changed files with 25 additions and 2 deletions

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test title</title>
</head>
<body>
foo
</body>
</html>

View File

@ -275,10 +275,12 @@ def expect_message(quteproc, httpbin, category, message):
@bdd.then(bdd.parsers.re(r'(?P<is_regex>regex )?"(?P<pattern>[^"]+)" should '
r'be logged'))
def should_be_logged(quteproc, is_regex, pattern):
def should_be_logged(quteproc, httpbin, is_regex, pattern):
"""Expect the given pattern on regex in the log."""
if is_regex:
pattern = re.compile(pattern)
else:
pattern = pattern.replace('(port)', str(httpbin.port))
line = quteproc.wait_for(message=pattern)
line.expected = True

View File

@ -16,9 +16,20 @@ Feature: :spawn
When I run :spawn echo {url}
Then "Executing echo with args ['about:blank'], userscript=False" should be logged
Scenario: Running :spawn with url variable in fully encoded format
When I open data/title with spaces.html
And I run :spawn echo {url}
Then "Executing echo with args ['http://localhost:(port)/data/title%20with%20spaces.html'], userscript=False" should be logged
Scenario: Running :spawn with url variable in pretty decoded format
When I open data/title with spaces.html
And I run :spawn echo {url:pretty}
Then "Executing echo with args ['http://localhost:(port)/data/title with spaces.html'], userscript=False" should be logged
@posix
Scenario: Running :spawn with userscript
When I execute the userscript open_current_url
When I open about:blank
And I execute the userscript open_current_url
And I wait until about:blank is loaded
Then the following tabs should be open:
- about:blank