DCausse has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394304 )

Change subject: Port russian_folding.feature to nodejs
......................................................................

Port russian_folding.feature to nodejs

56208fa7 needed to setup this ru wiki on vagrant.

Change-Id: Ia7a67e8b386c0a2b9bc1053b97725a23bbdc49d9
---
A tests/integration/features/russian_folding.feature
M tests/integration/features/step_definitions/page_steps.js
M tests/integration/features/support/hooks.js
3 files changed, 41 insertions(+), 7 deletions(-)


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

diff --git a/tests/integration/features/russian_folding.feature 
b/tests/integration/features/russian_folding.feature
new file mode 100644
index 0000000..6cc6dae
--- /dev/null
+++ b/tests/integration/features/russian_folding.feature
@@ -0,0 +1,31 @@
+@clean @api @ru
+Feature: Searches with Russian accents
+  Scenario: Searching for ё when text has е
+    When I api search on ru for чёрная дыра
+    Then Черная дыра is the first api search result
+
+  Scenario: Searching for е when text has ё
+    When I api search on ru for черный
+    Then Саша Чёрный is the first api search result
+
+  Scenario: Searching for no accent and lowercase
+    When I api search on ru for гликберг
+    Then Саша Чёрный is the first api search result
+
+  Scenario: Searching with insource allows to find exact matches
+    When I api search on ru for insource:гликберг
+    Then there are no api search results
+    And I api search on ru for insource:гли́кберг
+    Then Саша Чёрный is the first api search result
+
+  Scenario: Searching for with accent
+    When I api search on ru for Бра́зер
+    Then Бразер is the first api search result
+
+  Scenario: Searching for й when text has й
+    When I api search on ru for чёрный
+    Then Саша Чёрный is the first api search result
+
+  Scenario: Searching for й when text has и
+    When I api search on ru for чёрныи
+    Then there are no api search results
diff --git a/tests/integration/features/step_definitions/page_steps.js 
b/tests/integration/features/step_definitions/page_steps.js
index ebc9ac1..c8d7d7b 100644
--- a/tests/integration/features/step_definitions/page_steps.js
+++ b/tests/integration/features/step_definitions/page_steps.js
@@ -181,7 +181,7 @@
                } );
        } );
 
-       When( /^I api search( with rewrites enabled)?(?: with query independent 
profile ([^ ]+))?(?: with offset (\d+))?(?: in the (.*) language)?(?: in 
namespaces? (\d+(?: \d+)*))? for (.*)$/, function ( enableRewrites, qiprofile, 
offset, lang, namespaces, search ) {
+       When( /^I api search( with rewrites enabled)?(?: with query independent 
profile ([^ ]+))?(?: with offset (\d+))?(?: in the (.*) language)?(?: in 
namespaces? (\d+(?: \d+)*))?(?: on ([a-z]+))? for (.*)$/, function ( 
enableRewrites, qiprofile, offset, lang, namespaces, wiki, search ) {
                let options = {
                        srnamespace: (namespaces || "0").split(' ').join(','),
                        srenablerewrites: enableRewrites ? 1 : 0,
@@ -204,8 +204,11 @@
                search = Object.keys(this.searchVars).reduce( ( str, pattern ) 
=> str.replace( pattern, this.searchVars[pattern] ), search );
                // Replace %{\uXXXX}% with the appropriate unicode code point
                search = search.replace(/%\{\\u([\dA-Fa-f]{4,6})\}%/g, ( match, 
codepoint ) => JSON.parse( `"\\u${codepoint}"` ) );
-
-               return this.stepHelpers.searchFor( search, options );
+               let stepHelpers = this.stepHelpers;
+               if ( wiki ) {
+                       stepHelpers = this.stepHelpers.onWiki(wiki);
+               }
+               return stepHelpers.searchFor( search, options );
        } );
 
        Then( /there are no errors reported by the api/, function () {
diff --git a/tests/integration/features/support/hooks.js 
b/tests/integration/features/support/hooks.js
index 19f560f..beec9d8 100644
--- a/tests/integration/features/support/hooks.js
+++ b/tests/integration/features/support/hooks.js
@@ -625,11 +625,11 @@
        } ) );
 
 
-       BeforeOnce( { tags: "@ru" }, runBatchFn( {
+       BeforeOnce( { tags: "@ru" }, runBatchFn( 'ru', {
                edit: {
-                       'ru named Черная дыра':  'Черная дыра́ — область 
пространства-времени',
-                       'ru named Саша Чёрный': 'настоящее имя Алекса́ндр 
Миха́йлович Гли́кберг',
-                       'ru named Бразер': 'белорусский советский скульптор',
+                       'Черная дыра':  'Черная дыра́ — область 
пространства-времени',
+                       'Саша Чёрный': 'настоящее имя Алекса́ндр Миха́йлович 
Гли́кберг',
+                       'Бразер': 'белорусский советский скульптор',
                }
        } ) );
 

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

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

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

Reply via email to