Manybubbles has uploaded a new change for review. https://gerrit.wikimedia.org/r/84762
Change subject: Tests for highlighting and search operator fixes. ...................................................................... Tests for highlighting and search operator fixes. Make sure html is stripped from headings. Make sure the right headings are returned. Make sure the search operator is correct. Bug: 53955 Change-Id: Ide2699f8902d62c609b210e0d1b579fe507a3175 --- M tests/browser/features/full_text.feature M tests/browser/features/full_text_highlighting.feature M tests/browser/features/step_definitions/search_steps.rb M tests/browser/features/support/articles/has_headings.txt M tests/browser/features/support/build_pages.rb 5 files changed, 62 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/62/84762/1 diff --git a/tests/browser/features/full_text.feature b/tests/browser/features/full_text.feature index 3c72e3d..20828a3 100644 --- a/tests/browser/features/full_text.feature +++ b/tests/browser/features/full_text.feature @@ -43,8 +43,8 @@ | "3.1 Conquest of Persian empire" | none is | not in | | # You can't search for the [edit] tokens that users can click to edit sections | "Succession of Umar edit" | none is | not in | | - | intitle:"" catapult | Catapult is | in | | - | incategory:"" catapult | Catapult is | in | | + | intitle:"" catapult | none is | not in | | + | incategory:"" catapult | none is | not in | | @setup_main Scenario Outline: Searching for empty-string like values @@ -118,3 +118,13 @@ Scenario: Searching for a page with javascript doesn't execute it (in this case, removing the page title) When I search for Javascript findme Then the title still exists + + @setup_main + Scenario: Searching for a page using its title and another word not in the page's text doesn't find the page + When I search for DontExistWord Two Words + Then there are no search results + + @setup_main + Scenario: Searching for a page using its title and another word in the page's text does find it + When I search for catapult Two Words + Then Two Words is the first search result diff --git a/tests/browser/features/full_text_highlighting.feature b/tests/browser/features/full_text_highlighting.feature index 6a97f3b..e9d89bd 100644 --- a/tests/browser/features/full_text_highlighting.feature +++ b/tests/browser/features/full_text_highlighting.feature @@ -1,23 +1,48 @@ Feature: Full text search highlighting + Background: + Given I am at a random page + @setup_main @setup_highlighting Scenario Outline: Found words are highlighted - Given I am at a random page When I search for <term> Then I am on a page titled Search results And <highlighted_title> is the highlighted title of the first search result And <highlighted_text> is the highlighted text of the first search result - And <highlighted_alttitle> is the highlighted alttitle of the first search result Examples: - | term | highlighted_title | highlighted_text | highlighted_alttitle | - | two words | *Two* *Words* | ffnonesenseword catapult pickles | | - | rdir | Two Words | ffnonesenseword catapult pickles | *Rdir* | - | pickles | Two Words | ffnonesenseword catapult *pickles* | | - | ffnonesenseword pickles | Two Words | *ffnonesenseword* catapult *pickles* | | - | two words catapult pickles | *Two* *Words* | ffnonesenseword *catapult* *pickles* | | - | template:test pickle | Template:Template *Test* | *pickles* | | + | term | highlighted_title | highlighted_text | + | two words | *Two* *Words* | ffnonesenseword catapult pickles | + | pickles | Two Words | ffnonesenseword catapult *pickles* | + | ffnonesenseword pickles | Two Words | *ffnonesenseword* catapult *pickles* | + | two words catapult pickles | *Two* *Words* | ffnonesenseword *catapult* *pickles* | + | template:test pickle | Template:Template *Test* | *pickles* | # Verify highlighting the presence of accent squashing - | Africa test | *África* | for *testing* | | + | Africa test | *África* | for *testing* | # Verify highlighting on large pages (Bug 52680). It is neat to see that the stopwords aren't highlighted. - | "discuss problems of social and cultural importance" | Rashidun Caliphate | the faithful gathered to *discuss problems* of *social* and *cultural importance*. During the caliphate of | | - # Verify section highlighting. Notice all the spaces after the highlighted text? That is a table.... - | "Succession of Umar" | Rashidun Caliphate | transferred to the Syrian front in 634. *Succession* of *Umar* Abu Bakr 632 634 Umar 634 644 | *Succession* of *Umar* | + | "discuss problems of social and cultural importance" | Rashidun Caliphate | the faithful gathered to *discuss problems* of *social* and *cultural importance*. During the caliphate of | + + @setup_headings + Scenario: Found words are highlighted in headings + When I search for "i am a heading" + Then *I* *am* a *heading* is the highlighted alttitle of the first search result + + @setup_highlighting + Scenario: Found words are highlighted in headings and text even in large documents + When I search for "Succession of Umar" + Then *Succession* of *Umar* is the highlighted alttitle of the first search result + And *Succession* of *Umar* is in the highlighted text of the first search result + + @setup_headings + Scenario: The highest scoring heading is highlighted AND it doesn't contain html even if the heading on the page does + When I search for bold heading + Then I am a *bold* *heading* is the highlighted alttitle of the first search result + + @setup_highlighting + Scenario: Redirects are highlighted + When I search for rdir + And *Rdir* is the highlighted alttitle of the first search result + + # Disabled until bug 54278 is fixed + # @setup_highlighting + # Scenario: The highest scoring redirect is highlighted + # When I search for crazy rdir + # Then *Crazy* *Rdir* is the highlighted alttitle of the first search result diff --git a/tests/browser/features/step_definitions/search_steps.rb b/tests/browser/features/step_definitions/search_steps.rb index 1716ab3..d1a0109 100644 --- a/tests/browser/features/step_definitions/search_steps.rb +++ b/tests/browser/features/step_definitions/search_steps.rb @@ -146,8 +146,12 @@ Then(/^(.*) is the highlighted title of the first search result$/) do |highlighted| on(SearchResultsPage).first_result_highlighted_title.should == highlighted end -Then(/^(.*) is the highlighted text of the first search result$/) do |highlighted| - on(SearchResultsPage).first_result_highlighted_text.should == highlighted +Then(/^(.*) is( in)? the highlighted text of the first search result$/) do |highlighted, in_ok| + if in_ok then + on(SearchResultsPage).first_result_highlighted_text.should include(highlighted) + else + on(SearchResultsPage).first_result_highlighted_text.should == highlighted + end end Then(/^(.*) is the highlighted heading of the first search result$/) do |highlighted| if highlighted.empty? then diff --git a/tests/browser/features/support/articles/has_headings.txt b/tests/browser/features/support/articles/has_headings.txt index ed681e1..7b7ef68 100644 --- a/tests/browser/features/support/articles/has_headings.txt +++ b/tests/browser/features/support/articles/has_headings.txt @@ -1,5 +1,9 @@ ==I am a heading== that contains text! + +==I am a '''bold heading'''== +that also contains text + ==References== they go here but don't say the r word in this text too much or this'll beat HasReferencesInText which I didn't link intentionally because that'd give it a boost and we don't want that. diff --git a/tests/browser/features/support/build_pages.rb b/tests/browser/features/support/build_pages.rb index a4e8ae0..84efe47 100644 --- a/tests/browser/features/support/build_pages.rb +++ b/tests/browser/features/support/build_pages.rb @@ -15,7 +15,6 @@ And a file named File:Savepage-greyed.png exists with contents Savepage-greyed.png and description Screenshot, for test purposes, associated with https://bugzilla.wikimedia.org/show_bug.cgi?id=52908 . And a page named IHaveAVideo exists with contents [[File:How to Edit Article in Arabic Wikipedia.ogg|thumb|267x267px]] And a page named IHaveASound exists with contents [[File:Serenade for Strings -mvt-1- Elgar.ogg]] - And a page named HasASection exists with contents ==I am a section== that contains text! And a page named IHaveATwoWordCategory exists with contents [[Category:CategoryWith ASpace]] } $setup_main = true @@ -92,6 +91,8 @@ if !$setup_highlighting steps %Q{ Given a page named Rashidun Caliphate exists with contents @rashidun_caliphate.txt + And a page named Crazy Rdir exists with contents #REDIRECT [[Two Words]] + And a page named Insane Rdir exists with contents #REDIRECT [[Two Words]] } end $setup_highlighting = true -- To view, visit https://gerrit.wikimedia.org/r/84762 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ide2699f8902d62c609b210e0d1b579fe507a3175 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits