Manybubbles has uploaded a new change for review.

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


Change subject: Tests for boolean operators.
......................................................................

Tests for boolean operators.

Also, update the logging in instructions after switching to the
mediawiki-selenium gem.

Bug: 56026
Change-Id: I1efbb677a679b639b07c3a0ef3e1aca8fe74f6e5
---
M tests/browser/README
M tests/browser/features/full_text.feature
M tests/browser/features/step_definitions/general_steps.rb
M tests/browser/features/step_definitions/search_steps.rb
4 files changed, 76 insertions(+), 1 deletion(-)


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

diff --git a/tests/browser/README b/tests/browser/README
index b438922..77d9e36 100644
--- a/tests/browser/README
+++ b/tests/browser/README
@@ -62,6 +62,8 @@
 If you want to run tests against anything other than
 en.wikipedia.beta.wmflabs.org first do this:
  export MEDIAWIKI_URL=http://your-mediawiki/wiki/
+ export MEDIAWIKI_USER=Selenium_user
+ export MEDIAWIKI_PASSWORD=selenium123
 
 To run all tests:
  bundle exec cucumber
diff --git a/tests/browser/features/full_text.feature 
b/tests/browser/features/full_text.feature
index 1f7eabe..51afed3 100644
--- a/tests/browser/features/full_text.feature
+++ b/tests/browser/features/full_text.feature
@@ -357,3 +357,73 @@
     When I search for prefix test aaaa prefix:Prefix Test/aa
     Then Prefix Test/AAAA is the first search result
     But Prefix Test AAAA is not in the search results
+
+  @boolean_operators @setup_main
+  Scenario Outline: -, !, and NOT prohibit words in search results
+    When I search for <query>
+    Then Catapult is the first search result
+    But Amazing Catapult is not in the search results
+  Examples:
+  |        query         |
+  | catapult -amazing    |
+  | -amazing catapult    |
+  | catapult !amazing    |
+  | !amazing catapult    |
+  | catapult NOT amazing |
+  | NOT amazing catapult |
+
+  @boolean_operators @setup_main
+  Scenario Outline: +, &&, and AND require matches but since that is the 
default they don't look like they do anything
+    When I search for <query>
+    Then Amazing Catapult is the first search result
+    But Catapult is not in the search results
+  Examples:
+  |         query         |
+  | +catapult amazing     |
+  | amazing +catapult     |
+  | +amazing +catapult    |
+  | catapult AND amazing  |
+
+  @boolean_operators @setup_main
+  Scenario Outline: OR and || matches docs with either set
+    When I search for <query>
+    Then Catapult is in the search results
+    And Two Words is in the search results
+  Examples:
+  |          query          |
+  | catapult OR África      |
+  | África \|\| catapult    |
+# Bug 56239
+#  | catapult OR "África"   |
+#  | catapult \|\| "África" |
+#  | "África" OR catapult   |
+#  | "África" \|\| catapult |
+
+  @boolean_operators @setup_main
+  Scenario Outline: boolean operators in bad positions in the query are ignored
+    When I search for <query>
+    Then Catapult is in the first search result
+  Examples:
+  |         query          |
+  | catapult +             |
+  | catapult -             |
+  | catapult !             |
+  | catapult AND           |
+  | catapult OR            |
+  | catapult NOT           |
+  | + catapult             |
+  | - catapult             |
+  | ! catapult             |
+  | AND catapult           |
+  | OR catapult            |
+  | catapult + amazing     |
+  | catapult - amazing     |
+  | catapult ! amazing     |
+  | catapult AND + amazing |
+  | catapult AND - amazing |
+  | catapult AND ! amazing |
+
+  @boolean_operators @setup_main
+  Scenario: searching for NOT something will not crash (technically it should 
bring up the most linked document, but this isn't worth checking)
+    When I search for NOT catapult
+    Then there is a search result
diff --git a/tests/browser/features/step_definitions/general_steps.rb 
b/tests/browser/features/step_definitions/general_steps.rb
index 8715168..2b4387d 100644
--- a/tests/browser/features/step_definitions/general_steps.rb
+++ b/tests/browser/features/step_definitions/general_steps.rb
@@ -1,5 +1,5 @@
 Given(/^I am logged in$/) do
-  visit(LoginPage).login_with(@mediawiki_username, @mediawiki_password)
+  visit(LoginPage).login_with(ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD'])
 end
 Given(/^I am at a random page.*$/) do
   visit RandomPage
diff --git a/tests/browser/features/step_definitions/search_steps.rb 
b/tests/browser/features/step_definitions/search_steps.rb
index 47f15c1..a0eaa50 100644
--- a/tests/browser/features/step_definitions/search_steps.rb
+++ b/tests/browser/features/step_definitions/search_steps.rb
@@ -98,6 +98,9 @@
 Then(/^I am on a page titled (.*)$/) do |title|
   on(ArticlePage).title.should == title
 end
+Then(/^there is a search result$/) do
+  on(SearchResultsPage).first_result_element.should exist
+end
 Then(/^(.*) is( in)? the first search result$/) do |title, in_ok|
   on(SearchResultsPage) do |page|
     if title == 'none' then

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1efbb677a679b639b07c3a0ef3e1aca8fe74f6e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to