jenkins-bot has submitted this change and it was merged.
Change subject: Tests for highlight changed words in suggestions.
......................................................................
Tests for highlight changed words in suggestions.
Bug: 52286
Change-Id: I696434e9ec1694e72d62801299e2700a7e71ce8d
---
M tests/browser/features/full_text.feature
M tests/browser/features/step_definitions/search_steps.rb
M tests/browser/features/support/pages/search_results_page.rb
3 files changed, 25 insertions(+), 18 deletions(-)
Approvals:
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/browser/features/full_text.feature
b/tests/browser/features/full_text.feature
index 560a799..296f317 100644
--- a/tests/browser/features/full_text.feature
+++ b/tests/browser/features/full_text.feature
@@ -61,15 +61,20 @@
| incategory: | Search results |
| incategory:"" | Search results |
- @setup_suggestions
- Scenario Outline: Suggestions
- When I search for <term>
- Then <suggestion> is suggested
- Examples:
- | term | suggestion |
- | popular culatur | popular culture |
- | noble prize | nobel prize |
- | nobel prize | none |
+ @Setup_suggestions
+ Scenario: Common phrases spelled incorrectly get suggestions
+ When I search for popular cultur
+ Then popular *culture* is suggested
+
+ @Setup_suggestions
+ Scenario: Uncommon phrases spelled incorrectly get suggestions even if they
contain words that are spelled correctly on their own
+ When I search for noble prize
+ Then *nobel* prize is suggested
+
+ @Setup_suggestions
+ Scenario: Uncommon phrases spelled correctly don't get suggestsions even if
one of the words is very uncommon
+ When I search for nobel prize
+ Then there is no suggestion
@setup_weight
Scenario: Page weight include redirects
@@ -190,7 +195,7 @@
When I search for Rescore "Test Words"
Then Test Words Rescore Rescore is the first search result
- # Note that other tests will catch this situration as well but this test
should be pretty specific
+ # Note that other tests will catch this situation as well but this test
should be pretty specific
@setup_phrase_rescore
Scenario: Searching for an unquoted phrase still prioritizes titles over text
When I search for Rescore Test TextContent
diff --git a/tests/browser/features/step_definitions/search_steps.rb
b/tests/browser/features/step_definitions/search_steps.rb
index d1a0109..f4488a8 100644
--- a/tests/browser/features/step_definitions/search_steps.rb
+++ b/tests/browser/features/step_definitions/search_steps.rb
@@ -197,11 +197,10 @@
end
end
Then(/^(.*) is suggested$/) do |text|
- if text == 'none' then
- on(SearchResultsPage).suggestion_element.should_not exist
- else
- on(SearchResultsPage).suggestion.should == text
- end
+ on(SearchResultsPage).highlighted_suggestion.should == text
+end
+Then(/^there is no suggestion$/) do
+ on(SearchResultsPage).suggestion_element.should_not exist
end
Then(/there are no errors reported$/) do
on(SearchResultsPage).error_report_element.should_not exist
diff --git a/tests/browser/features/support/pages/search_results_page.rb
b/tests/browser/features/support/pages/search_results_page.rb
index 76cc6c0..e3143a6 100644
--- a/tests/browser/features/support/pages/search_results_page.rb
+++ b/tests/browser/features/support/pages/search_results_page.rb
@@ -21,8 +21,8 @@
def suggestion_element
suggestion_wrapper_element.link_element
end
- def suggestion
- suggestion_element.text
+ def highlighted_suggestion
+ get_highlighted_text(suggestion_element)
end
def results
@browser.divs(:class => 'mw-search-result-heading')
@@ -40,6 +40,9 @@
def get_highlighted_text(element)
result = element.element.attribute_value('innerHTML').strip
- result.gsub('<span class="searchmatch">', '*').gsub('</span>', '*')
+ result.gsub('<span class="searchmatch">', '*').
+ gsub('</span>', '*').
+ gsub('<em>', '*').
+ gsub('</em>', '*')
end
end
--
To view, visit https://gerrit.wikimedia.org/r/85207
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I696434e9ec1694e72d62801299e2700a7e71ce8d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits