EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312294

Change subject: browsertests: Report where results came from when the dont match
......................................................................

browsertests: Report where results came from when the dont match

Change-Id: Ifa32fa2672877b86c7aba033aa23be3fa9321247
---
M tests/browser/features/step_definitions/search_steps.rb
M tests/browser/features/support/cirrus_search_api_helper.rb
2 files changed, 11 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/94/312294/1

diff --git a/tests/browser/features/step_definitions/search_steps.rb 
b/tests/browser/features/step_definitions/search_steps.rb
index 2320075..1e9be31 100644
--- a/tests/browser/features/step_definitions/search_steps.rb
+++ b/tests/browser/features/step_definitions/search_steps.rb
@@ -33,7 +33,7 @@
     options["srqiprofile"] = qiprofile if qiprofile
     options = options.merge(@didyoumean_options) if defined?@didyoumean_options
 
-    @api_result = search_for(
+    @api_result, @api_last_options = search_for(
       search.gsub(/%[^ {]+%/, @search_vars)
         .gsub(/%\{\\u([\dA-Fa-f]{4,6})\}%/) do  # replace %{\uXXXX}% with the 
unicode code point
           [Regexp.last_match[1].hex].pack("U")
@@ -91,7 +91,7 @@
 end
 When(/^I get api near matches for (.*)$/) do |search|
   begin
-    @api_result = search_for(
+    @api_result, @api_last_options = search_for(
       search,
       srwhat: "nearmatch"
     )
@@ -537,20 +537,22 @@
 
 def check_all_search_results(title, not_searching, in_ok)
   found = on(SearchResultsPage).results.map(&:text)
-  check_all_search_results_internal(found, title, not_searching, in_ok)
+  check_all_search_results_internal(found, title, not_searching, in_ok, 
browser.url)
 end
 
 def check_all_api_search_results(title, not_searching, in_ok)
   found = @api_result["search"].map do |result|
     result["title"]
   end
-  check_all_search_results_internal(found, title, not_searching, in_ok)
+  check_all_search_results_internal(found, title, not_searching, in_ok, 
@api_last_options)
 end
 
-def check_all_search_results_internal(found, title, not_searching, in_ok)
+def check_all_search_results_internal(found, title, not_searching, in_ok, 
loaded_from)
   if in_ok
+       message = "expected #{found.inspect} to include a partial match for 
#{title.inspect}, loaded from #{loaded_from.inspect}"
     match = include(include(title))
   else
+       message = "expected #{found.inspect} to include #{title.inspect}, 
loaded from #{loaded_from.inspect}
     match = include(title)
   end
 
diff --git a/tests/browser/features/support/cirrus_search_api_helper.rb 
b/tests/browser/features/support/cirrus_search_api_helper.rb
index 41e95cd..9c2aad3 100644
--- a/tests/browser/features/support/cirrus_search_api_helper.rb
+++ b/tests/browser/features/support/cirrus_search_api_helper.rb
@@ -25,13 +25,14 @@
 
   # Search for a particular string using the api
   def search_for(search, options)
-    data = api.query(options.merge(
+    search_options = options.merge(
       list: "search",
       srsearch: search,
       srprop: 
"snippet|titlesnippet|redirectsnippet|sectionsnippet|categorysnippet|isfilematch",
       formatversion: 2
-    ))
-    data["query"]
+    )
+    data = api.query(search_options)
+    data["query"], search_options
   end
 
   # Get suggestions for a particular string using the api

-- 
To view, visit https://gerrit.wikimedia.org/r/312294
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa32fa2672877b86c7aba033aa23be3fa9321247
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to