qutebrowser/tests/end2end/features/search.feature

245 lines
9.0 KiB
Gherkin
Raw Normal View History

# vim: ft=cucumber fileencoding=utf-8 sts=4 sw=4 et:
2016-01-07 07:49:45 +01:00
Feature: Searching on a page
Searching text on the page (like /foo) with different options.
Background:
Given I open data/search.html
And I run :tab-only
2016-01-07 07:49:45 +01:00
## searching
Scenario: Searching text
When I run :search foo
And I wait for "search found foo" in the log
2017-04-27 08:20:55 +02:00
Then "foo" should be found
2016-01-07 07:49:45 +01:00
2016-01-07 08:21:18 +01:00
Scenario: Searching twice
When I run :search foo
And I wait for "search found foo" in the log
2016-01-07 08:21:18 +01:00
And I run :search bar
And I wait for "search found bar" in the log
2017-04-27 08:20:55 +02:00
Then "Bar" should be found
2016-01-07 08:21:18 +01:00
2016-01-07 07:49:45 +01:00
Scenario: Searching with --reverse
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 07:49:45 +01:00
And I run :search -r foo
And I wait for "search found foo with flags FindBackward" in the log
2017-04-27 08:20:55 +02:00
Then "Foo" should be found
2016-01-07 07:49:45 +01:00
Scenario: Searching without matches
When I run :search doesnotmatch
And I wait for "search didn't find doesnotmatch" in the log
2016-01-07 07:49:45 +01:00
Then the warning "Text 'doesnotmatch' not found on page!" should be shown
2016-01-14 07:53:00 +01:00
@xfail_norun
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 wait for "search found space " in the log
2017-04-27 08:20:55 +02:00
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 wait for "search found /slash" in the log
2017-04-27 08:20:55 +02:00
Then "/slash" should be found
# This doesn't work because this is QtWebKit behavior.
2016-01-14 07:53:00 +01:00
@xfail_norun
2016-01-07 07:49:45 +01:00
Scenario: Searching text with umlauts
When I run :search blub
And I wait for "search didn't find blub" in the log
2016-01-07 07:49:45 +01:00
Then the warning "Text 'blub' not found on page!" should be shown
## ignore_case
2016-01-07 07:49:45 +01:00
Scenario: Searching text with ignore_case = always
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 07:49:45 +01:00
And I run :search bar
And I wait for "search found bar" in the log
2017-04-27 08:20:55 +02:00
Then "Bar" should be found
2016-01-07 07:49:45 +01:00
Scenario: Searching text with ignore_case = never
2017-06-16 18:16:19 +02:00
When I set ignore_case to never
2016-01-07 07:49:45 +01:00
And I run :search bar
And I wait for "search found bar with flags FindCaseSensitively" in the log
2017-04-27 08:20:55 +02:00
Then "bar" should be found
2016-01-07 07:49:45 +01:00
Scenario: Searching text with ignore_case = smart (lower-case)
2017-06-16 16:22:41 +02:00
When I set ignore_case to smart
2016-01-07 07:49:45 +01:00
And I run :search bar
And I wait for "search found bar" in the log
2017-04-27 08:20:55 +02:00
Then "Bar" should be found
2016-01-07 07:49:45 +01:00
Scenario: Searching text with ignore_case = smart (upper-case)
2017-06-16 16:22:41 +02:00
When I set ignore_case to smart
2016-01-07 07:49:45 +01:00
And I run :search Foo
And I wait for "search found Foo with flags FindCaseSensitively" in the log
2017-04-27 08:20:55 +02:00
Then "Foo" should be found # even though foo was first
2016-01-07 07:49:45 +01:00
2016-01-07 08:21:18 +01:00
## :search-next
2016-01-07 07:49:45 +01:00
Scenario: Jumping to next match
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 07:49:45 +01:00
And I run :search foo
And I wait for "search found foo" in the log
2016-01-07 07:49:45 +01:00
And I run :search-next
And I wait for "next_result found foo" in the log
2017-04-27 08:20:55 +02:00
Then "Foo" should be found
2016-01-07 07:49:45 +01:00
2016-01-07 08:21:18 +01:00
Scenario: Jumping to next match with count
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 08:21:18 +01:00
And I run :search baz
And I wait for "search found baz" in the log
2016-01-07 08:21:18 +01:00
And I run :search-next with count 2
And I wait for "next_result found baz" in the log
2017-04-27 08:20:55 +02:00
Then "BAZ" should be found
2016-01-07 08:21:18 +01:00
Scenario: Jumping to next match with --reverse
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 08:21:18 +01:00
And I run :search --reverse foo
And I wait for "search found foo with flags FindBackward" in the log
2016-01-07 08:21:18 +01:00
And I run :search-next
And I wait for "next_result found foo with flags FindBackward" in the log
2017-04-27 08:20:55 +02:00
Then "foo" should be found
2016-01-07 08:21:18 +01:00
2016-01-07 07:49:45 +01:00
Scenario: Jumping to next match without search
2016-01-07 08:21:18 +01:00
# Make sure there was no search in the same window before
When I open data/search.html in a new window
And I run :search-next
Then the error "No search done yet." should be shown
2016-01-07 07:49:45 +01:00
Scenario: Repeating search in a second tab (issue #940)
When I open data/search.html in a new tab
And I run :search foo
And I wait for "search found foo" in the log
And I run :tab-prev
And I run :search-next
And I wait for "search found foo" in the log
2017-04-27 08:20:55 +02:00
Then "foo" should be found
# https://github.com/qutebrowser/qutebrowser/issues/2438
Scenario: Jumping to next match after clearing
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
And I run :search foo
And I wait for "search found foo" in the log
And I run :search
And I run :search-next
And I wait for "next_result found foo" in the log
2017-04-27 08:20:55 +02:00
Then "foo" should be found
2016-01-07 08:21:18 +01:00
## :search-prev
2016-01-07 07:49:45 +01:00
Scenario: Jumping to previous match
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 07:49:45 +01:00
And I run :search foo
And I wait for "search found foo" in the log
2016-01-07 07:49:45 +01:00
And I run :search-next
And I wait for "next_result found foo" in the log
2016-01-07 07:49:45 +01:00
And I run :search-prev
And I wait for "prev_result found foo with flags FindBackward" in the log
2017-04-27 08:20:55 +02:00
Then "foo" should be found
2016-01-07 07:49:45 +01:00
2016-01-07 08:21:18 +01:00
Scenario: Jumping to previous match with count
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 08:21:18 +01:00
And I run :search baz
And I wait for "search found baz" in the log
2016-01-07 08:21:18 +01:00
And I run :search-next
And I wait for "next_result found baz" in the log
2016-01-07 08:21:18 +01:00
And I run :search-next
And I wait for "next_result found baz" in the log
2016-01-07 08:21:18 +01:00
And I run :search-prev with count 2
And I wait for "prev_result found baz with flags FindBackward" in the log
2017-04-27 08:20:55 +02:00
Then "baz" should be found
2016-01-07 08:21:18 +01:00
Scenario: Jumping to previous match with --reverse
2017-06-16 18:16:19 +02:00
When I set ignore_case to always
2016-01-07 08:21:18 +01:00
And I run :search --reverse foo
And I wait for "search found foo with flags FindBackward" in the log
2016-01-07 08:21:18 +01:00
And I run :search-next
And I wait for "next_result found foo with flags FindBackward" in the log
2016-01-07 08:21:18 +01:00
And I run :search-prev
And I wait for "prev_result found foo" in the log
2017-04-27 08:20:55 +02:00
Then "Foo" should be found
2016-01-07 08:21:18 +01:00
2016-01-07 07:49:45 +01:00
Scenario: Jumping to previous match without search
2016-01-07 08:21:18 +01:00
# Make sure there was no search in the same window before
When I open data/search.html in a new window
And I run :search-prev
Then the error "No search done yet." should be shown
2016-01-07 07:49:45 +01:00
## wrapping
Scenario: Wrapping around page
2016-07-12 16:47:57 +02:00
When I run :search foo
And I wait for "search found foo" in the log
2016-01-07 07:49:45 +01:00
And I run :search-next
And I wait for "next_result found foo" in the log
2016-01-07 07:49:45 +01:00
And I run :search-next
And I wait for "next_result found foo" in the log
2017-04-27 08:20:55 +02:00
Then "foo" should be found
2016-01-07 07:49:45 +01:00
Scenario: Wrapping around page with --reverse
2016-07-12 16:47:57 +02:00
When I run :search --reverse foo
And I wait for "search found foo with flags FindBackward" in the log
2016-01-07 07:49:45 +01:00
And I run :search-next
And I wait for "next_result found foo with flags FindBackward" in the log
2016-01-07 07:49:45 +01:00
And I run :search-next
And I wait for "next_result found foo with flags FindBackward" in the log
2017-04-27 08:20:55 +02:00
Then "Foo" should be found
2016-01-07 07:49:45 +01:00
# TODO: wrapping message with scrolling
# TODO: wrapping message without scrolling
2017-05-09 07:32:53 +02:00
## follow searched links
Scenario: Follow a searched link
When I run :search follow
And I wait for "search found follow" in the log
And I run :follow-selected
Then data/hello.txt should be loaded
Scenario: Follow a searched link in a new tab
When I run :window-only
And I run :search follow
And I wait for "search found follow" in the log
And I run :follow-selected -t
And I wait until data/hello.txt is loaded
Then the following tabs should be open:
- data/search.html
- data/hello.txt (active)
Scenario: Don't follow searched text
When I run :window-only
And I run :search foo
And I wait for "search found foo" in the log
And I run :follow-selected
Then the following tabs should be open:
- data/search.html (active)
Scenario: Don't follow searched text in a new tab
When I run :window-only
And I run :search foo
And I wait for "search found foo" in the log
And I run :follow-selected -t
Then the following tabs should be open:
- data/search.html (active)
2017-05-09 09:11:25 +02:00
# Following a link selected via JS doesn't work in Qt 5.10 anymore.
@qt!=5.10
2017-05-09 09:11:25 +02:00
Scenario: Follow a manually selected link
When I run :jseval --file (testdata)/search_select.js
And I run :follow-selected
Then data/hello.txt should be loaded
# Following a link selected via JS doesn't work in Qt 5.10 anymore.
@qt!=5.10
2017-05-09 09:11:25 +02:00
Scenario: Follow a manually selected link in a new tab
When I run :window-only
And I run :jseval --file (testdata)/search_select.js
And I run :follow-selected -t
And I wait until data/hello.txt is loaded
Then the following tabs should be open:
- data/search.html
- data/hello.txt (active)