EBernhardson has uploaded a new change for review. https://gerrit.wikimedia.org/r/208197
Change subject: Convert go feature to api tests ...................................................................... Convert go feature to api tests This also requires the nearmatch api changes to core in I7153262. Change-Id: Ie0a6e8b3b95b56dc9457fc9efe290950d3837a8b --- R tests/browser/features/go_api.feature A tests/browser/features/go_browser.feature M tests/browser/features/prefix_search_api.feature M tests/browser/features/step_definitions/search_steps.rb 4 files changed, 42 insertions(+), 34 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/97/208197/1 diff --git a/tests/browser/features/go.feature b/tests/browser/features/go_api.feature similarity index 61% rename from tests/browser/features/go.feature rename to tests/browser/features/go_api.feature index 75d16b7..51f3ffb 100644 --- a/tests/browser/features/go.feature +++ b/tests/browser/features/go_api.feature @@ -1,41 +1,36 @@ -@clean @go @phantomjs +@clean @go @api Feature: Go Search Scenario: I can "go" to a page with mixed capital and lower case name by the name all lower cased - When I go search for mixedcapsandlowercase - Then I am on a page titled MixedCapsAndLowerCase + When I get api near matches for mixedcapsandlowercase + Then MixedCapsAndLowerCase is the first api search result Scenario: I can "go" to a page with mixed capital and lower case name by the name with totally wrong case cased - When I go search for miXEdcapsandlowercASe - Then I am on a page titled MixedCapsAndLowerCase + When I get api near matches for miXEdcapsandlowercASe + Then MixedCapsAndLowerCase is the first api search result Scenario: I can "go" to a page with an accented character without the accent - When I go search for africa - Then I am on a page titled África + When I get api near matches for africa + Then África is the first api search result @accented_namespace Scenario: I can "go" to a page in a namespace with an accented character without the accent - When I go search for mo:test - Then I am on a page titled Mó:Test + When I get api near matches for mo:test + Then Mó:Test is the first api search result @accented_namespace Scenario: When I "go" to a page with the namespace specified twice I end up on the search results page - When I go search for file:mo:test - Then I am on a page titled Search results + When I get api near matches for file:mo:test + Then there are no api search results @from_core Scenario: I can "go" to a page with mixed capital and lower case name by the name all lower cased and quoted - When I go search for "mixedcapsandlowercase" - Then I am on a page titled MixedCapsAndLowerCase - - @from_core - Scenario: I can "go" to a user's page whether it is there or not - When I go search for User:DoesntExist - Then I am on a page titled User:DoesntExist + When I get api near matches for "mixedcapsandlowercase" + Then MixedCapsAndLowerCase is the first api search result @options Scenario Outline: When I near match just one page I go to that page - When I go search for <term> Nearmatchflattentest - Then I am on a page titled <title> Nearmatchflattentest + When I get api near matches for <term> Nearmatchflattentest + Then <title> Nearmatchflattentest is the first api search result Examples: | term | title | | soñ onlyaccent | Soñ Onlyaccent | @@ -45,8 +40,8 @@ @options Scenario Outline: When I near match more than one page but one is exact (case, modulo case, or converted to title case) I go to that page - When I go search for <term> Nearmatchflattentest - Then I am on a page titled <title> Nearmatchflattentest + When I get api near matches for <term> Nearmatchflattentest + Then <title> Nearmatchflattentest is the first api search result Examples: | term | title | | son | son | @@ -63,17 +58,17 @@ | SON Titlecase | Son Titlecase | | soñ twoaccents | Soñ Twoaccents | | són twoaccents | Són Twoaccents | - | bach | Johann Sebastian Bach | - | koan | Kōan | - | son redirect | Soñ Redirect | + | bach | Bach | + | koan | Koan | + | son redirect | Son Redirect | | Son Redirectnotbetter | Són Redirectnotbetter | - | Søn Redirectnoncompete | Blah Redirectnoncompete | - | Soñ Redirectnoncompete | Blah Redirectnoncompete | + | Søn Redirectnoncompete | Søn Redirectnoncompete | + | Soñ Redirectnoncompete | Soñ Redirectnoncompete | @options Scenario Outline: When I near match more than one page but none of them are exact then I go to the search results page - When I go search for <term> Nearmatchflattentest - Then I am on a page titled Search results + When I get api near matches for <term> Nearmatchflattentest + Then there are no api search results Examples: | term | | son twoaccents | @@ -82,5 +77,5 @@ @redirect Scenario: When I near match a redirect and a page then the redirect is chosen if it is a better match - When I go search for SEO Redirecttest - Then I am on a page titled Search Engine Optimization Redirecttest + When I get api near matches for SEO Redirecttest + Then SEO Redirecttest is the first api search result diff --git a/tests/browser/features/go_browser.feature b/tests/browser/features/go_browser.feature new file mode 100644 index 0000000..3fd4535 --- /dev/null +++ b/tests/browser/features/go_browser.feature @@ -0,0 +1,16 @@ +@clean @go @phantomjs +Feature: Go Search + @from_core + Scenario: I can "go" to a user's page whether it is there or not + When I go search for User:DoesntExist + Then I am on a page titled User:DoesntExist + + @options + Scenario Outline: When I near match more than one page but one is exact (case, modulo case, or converted to title case) I go to that page + When I go search for <term> Nearmatchflattentest + Then I am on a page titled <title> Nearmatchflattentest + Examples: + | term | title | + | bach | Johann Sebastian Bach | + | Søn Redirectnoncompete | Blah Redirectnoncompete | + | Soñ Redirectnoncompete | Blah Redirectnoncompete | diff --git a/tests/browser/features/prefix_search_api.feature b/tests/browser/features/prefix_search_api.feature index 2d3a45e..c320c2b 100644 --- a/tests/browser/features/prefix_search_api.feature +++ b/tests/browser/features/prefix_search_api.feature @@ -34,8 +34,6 @@ When I get api suggestions for template talk: Then Template talk:Foo is in the api suggestions -@clean @api @prefix -Feature: Prefix search Scenario Outline: Search suggestions When I get api suggestions for <term> Then <first_result> is the first api suggestion diff --git a/tests/browser/features/step_definitions/search_steps.rb b/tests/browser/features/step_definitions/search_steps.rb index 98a5df1..6c90254 100644 --- a/tests/browser/features/step_definitions/search_steps.rb +++ b/tests/browser/features/step_definitions/search_steps.rb @@ -1,5 +1,4 @@ require "cgi" -require "debugger" Given(/^I am logged in via api$/) do log_in_api -- To view, visit https://gerrit.wikimedia.org/r/208197 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie0a6e8b3b95b56dc9457fc9efe290950d3837a8b 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