jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391437 )

Change subject: Add integration feature files that already pass
......................................................................


Add integration feature files that already pass

These feature files were 95% of the way to implemented, they
needed only a single new definition each to pass.

Change-Id: I546fe7a8a2b32b8e705cd27278cb9195105e1e49
---
M tests/integration/features/step_definitions/page_steps.js
M tests/integration/features/suggest_api.feature
A tests/integration/features/wildcard_api.feature
3 files changed, 95 insertions(+), 1 deletion(-)

Approvals:
  Smalyshev: Looks good to me, approved
  Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/tests/integration/features/step_definitions/page_steps.js 
b/tests/integration/features/step_definitions/page_steps.js
index 2e370d8..177fe24 100644
--- a/tests/integration/features/step_definitions/page_steps.js
+++ b/tests/integration/features/step_definitions/page_steps.js
@@ -216,6 +216,12 @@
                } );
        } );
 
+       Then( /there are no api search results/, function () {
+               withApi( this, () => {
+                       expect( this.apiResponse.query.search 
).to.have.lengthOf( 0 );
+               } );
+       } );
+
        Then( /^(.+) is( not)? in the api search results$/, function( title, 
not ) {
                withApi( this, () => {
                        let titles = this.apiResponse.query.search.map( res => 
res.title );
@@ -226,4 +232,10 @@
                        }
                } );
        } );
+
+       Then( /^this error is reported by api: (.+)$/, function ( 
expected_error ) {
+               withApi( this, () => {
+                       expect( this.apiError.info ).to.equal( 
expected_error.trim() );
+               } );
+       } );
 });
diff --git a/tests/integration/features/suggest_api.feature 
b/tests/integration/features/suggest_api.feature
index 79beb0c..0d70c7f 100644
--- a/tests/integration/features/suggest_api.feature
+++ b/tests/integration/features/suggest_api.feature
@@ -65,4 +65,31 @@
   Examples:
     |   term      |   first  | other  |
     | Ic          |  Iceman  |  Ice   |
-    | Ice         |   Ice    | Iceman |
\ No newline at end of file
+    | Ice         |   Ice    | Iceman |
+
+  Scenario: Ordering & limit
+    When I ask suggestion API at most 1 item for x-m
+      Then the API should produce list starting with X-Men
+      And the API should produce list of length 1
+
+  Scenario Outline: Search fallback to prefix search if namespace is provided
+    When I ask suggestion API for <term>
+      Then the API should produce list starting with <suggested>
+  Examples:
+    |   term      |    suggested        |
+    | Special:    | Special:ActiveUsers |
+    | Special:Act | Special:ActiveUsers |
+
+  Scenario Outline: Search prefers main namespace over crossns redirects
+    When I ask suggestion API for <term>
+      Then the API should produce list starting with <suggested>
+  Examples:
+    |   term      |    suggested      |
+    | V           | Venom             |
+    | V:          | V:N               |
+    | Z           | Zam Wilson        |
+    | Z:          | Z:Navigation      |
+
+  Scenario: Default sort can be used as search input
+    When I ask suggestion API for Wilson
+      Then the API should produce list starting with Sam Wilson
diff --git a/tests/integration/features/wildcard_api.feature 
b/tests/integration/features/wildcard_api.feature
new file mode 100644
index 0000000..fc86115
--- /dev/null
+++ b/tests/integration/features/wildcard_api.feature
@@ -0,0 +1,55 @@
+@clean @api @wildcard
+Feature: Searches that contain wildcard matches
+  Scenario Outline: Wildcards match plain matches
+    When I api search for pi<wildcard>les
+    Then Two Words is the first api search result
+  Examples:
+    | wildcard |
+    | *        |
+    | \\?k     |
+    | c\\?     |
+
+  Scenario Outline: Wildcards don't match stemmed matches
+    When I api search for pi<wildcard>kle
+    Then there are no api search results
+  Examples:
+    | wildcard |
+    | *        |
+    | \\?k     |
+
+  Scenario Outline: Wildcards in leading intitle: terms match
+    When I api search for intitle:functiona<wildcard> intitle:programming
+    Then Functional programming is the first api search result
+  Examples:
+    | wildcard |
+    | *        |
+    | \\?      |
+
+  Scenario Outline: Wildcard suffixes in trailing intitle: terms match stemmed 
matches
+    When I api search for intitle:functional intitle:programmin<wildcard>
+    Then Functional programming is the first api search result
+  Examples:
+    | wildcard |
+    | *        |
+    | \\?      |
+
+  Scenario Outline: Wildcards within trailing intitle: terms match stemmed 
matches
+    When I api search for intitle:functional intitle:prog<wildcard>amming
+    Then Functional programming is the first api search result
+  Examples:
+    | wildcard |
+    | *        |
+    | \\?      |
+
+  Scenario Outline: Searching with a single wildcard finds expected results
+    When I api search for catapu<wildcard>
+    Then Catapult is in the api search results
+  Examples:
+    | wildcard |
+    | *        |
+    | \\?t     |
+    | l\\?     |
+
+  Scenario: Searching with a complex wildcard query fails
+    When I api search for 
d*e*a*d*l*y*w*i*l*d*c*a*r*d*d*e*a*d*l*y*w*i*l*d*c*a*r*d*d*e*a*d*l*y*w*i*l*d*c*a*r*d*d*e*a*d*w*i*l*d*c*a*r*d*
+    Then this error is reported by api: Regular expression is too complex. 
Learn more about simplifying it 
[[mw:Special:MyLanguage/Help:CirrusSearch/RegexTooComplex|here]].

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I546fe7a8a2b32b8e705cd27278cb9195105e1e49
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Cindy-the-browser-test-bot <bernhardsone...@gmail.com>
Gerrit-Reviewer: DCausse <dcau...@wikimedia.org>
Gerrit-Reviewer: Gehel <guillaume.leder...@wikimedia.org>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: Tjones <tjo...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to