Clean up search.feature

This commit is contained in:
Florian Bruhin 2017-04-27 08:20:55 +02:00
parent 38099c45bd
commit 046401c489
2 changed files with 32 additions and 39 deletions

View File

@ -11,20 +11,17 @@ Feature: Searching on a page
Scenario: Searching text
When I run :search foo
And I run :yank selection
Then the clipboard should contain "foo"
Then "foo" should be found
Scenario: Searching twice
When I run :search foo
And I run :search bar
And I run :yank selection
Then the clipboard should contain "Bar"
Then "Bar" should be found
Scenario: Searching with --reverse
When I set general -> ignore-case to true
And I run :search -r foo
And I run :yank selection
Then the clipboard should contain "Foo"
Then "Foo" should be found
Scenario: Searching without matches
When I run :search doesnotmatch
@ -34,14 +31,12 @@ Feature: Searching on a page
Scenario: Searching with / and spaces at the end (issue 874)
When I run :set-cmd-text -s /space
And I run :command-accept
And I run :yank selection
Then the clipboard should contain "space "
Then "space " should be found
Scenario: Searching with / and slash in search term (issue 507)
When I run :set-cmd-text -s //slash
And I run :command-accept
And I run :yank selection
Then the clipboard should contain "/slash"
Then "/slash" should be found
# This doesn't work because this is QtWebKit behavior.
@xfail_norun
@ -54,26 +49,22 @@ Feature: Searching on a page
Scenario: Searching text with ignore-case = true
When I set general -> ignore-case to true
And I run :search bar
And I run :yank selection
Then the clipboard should contain "Bar"
Then "Bar" should be found
Scenario: Searching text with ignore-case = false
When I set general -> ignore-case to false
And I run :search bar
And I run :yank selection
Then the clipboard should contain "bar"
Then "bar" should be found
Scenario: Searching text with ignore-case = smart (lower-case)
When I set general -> ignore-case to smart
And I run :search bar
And I run :yank selection
Then the clipboard should contain "Bar"
Then "Bar" should be found
Scenario: Searching text with ignore-case = smart (upper-case)
When I set general -> ignore-case to smart
And I run :search Foo
And I run :yank selection
Then the clipboard should contain "Foo" # even though foo was first
Then "Foo" should be found # even though foo was first
## :search-next
@ -81,22 +72,19 @@ Feature: Searching on a page
When I set general -> ignore-case to true
And I run :search foo
And I run :search-next
And I run :yank selection
Then the clipboard should contain "Foo"
Then "Foo" should be found
Scenario: Jumping to next match with count
When I set general -> ignore-case to true
And I run :search baz
And I run :search-next with count 2
And I run :yank selection
Then the clipboard should contain "BAZ"
Then "BAZ" should be found
Scenario: Jumping to next match with --reverse
When I set general -> ignore-case to true
And I run :search --reverse foo
And I run :search-next
And I run :yank selection
Then the clipboard should contain "foo"
Then "foo" should be found
Scenario: Jumping to next match without search
# Make sure there was no search in the same window before
@ -109,8 +97,7 @@ Feature: Searching on a page
And I run :search foo
And I run :tab-prev
And I run :search-next
And I run :yank selection
Then the clipboard should contain "foo"
Then "foo" should be found
# https://github.com/qutebrowser/qutebrowser/issues/2438
Scenario: Jumping to next match after clearing
@ -118,8 +105,7 @@ Feature: Searching on a page
And I run :search foo
And I run :search
And I run :search-next
And I run :yank selection
Then the clipboard should contain "foo"
Then "foo" should be found
## :search-prev
@ -128,8 +114,7 @@ Feature: Searching on a page
And I run :search foo
And I run :search-next
And I run :search-prev
And I run :yank selection
Then the clipboard should contain "foo"
Then "foo" should be found
Scenario: Jumping to previous match with count
When I set general -> ignore-case to true
@ -137,16 +122,14 @@ Feature: Searching on a page
And I run :search-next
And I run :search-next
And I run :search-prev with count 2
And I run :yank selection
Then the clipboard should contain "baz"
Then "baz" should be found
Scenario: Jumping to previous match with --reverse
When I set general -> ignore-case to true
And I run :search --reverse foo
And I run :search-next
And I run :search-prev
And I run :yank selection
Then the clipboard should contain "Foo"
Then "Foo" should be found
Scenario: Jumping to previous match without search
# Make sure there was no search in the same window before
@ -160,15 +143,13 @@ Feature: Searching on a page
When I run :search foo
And I run :search-next
And I run :search-next
And I run :yank selection
Then the clipboard should contain "foo"
Then "foo" should be found
Scenario: Wrapping around page with --reverse
When I run :search --reverse foo
And I run :search-next
And I run :search-next
And I run :yank selection
Then the clipboard should contain "Foo"
Then "Foo" should be found
# TODO: wrapping message with scrolling
# TODO: wrapping message without scrolling

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import json
import pytest
import pytest_bdd as bdd
@ -24,6 +26,16 @@ import pytest_bdd as bdd
from end2end.features.test_yankpaste_bdd import init_fake_clipboard
bdd.scenarios('search.feature')
@bdd.then(bdd.parsers.parse('"{text}" should be found'))
def check_found_text(request, quteproc, text):
quteproc.send_cmd(':yank selection')
quteproc.wait_for(message='Setting fake clipboard: {}'.format(
json.dumps(text)))
# After cancelling the search, the text (sometimes?) shows up as selected.
# However, we can't get it via ':yank selection' it seems?
pytestmark = pytest.mark.qtwebengine_skip("Searched text is not selected...")
bdd.scenarios('search.feature')