jenkins-bot has submitted this change and it was merged. Change subject: Convert browser tests that check for create page link ......................................................................
Convert browser tests that check for create page link Converts a variety of tests that check for the 'create a new page' link to exist/not exist to use the api. These no longer check for that link, but its tested extensively in the remaining browser tests and shouldn't be anything to be concerned about. Change-Id: I0be02c8a1b55e51c96d389a3ba1cbb145412eed8 --- M tests/browser/features/bad_syntax_api.feature M tests/browser/features/bad_syntax_browser.feature D tests/browser/features/boolean_operators.feature A tests/browser/features/boolean_operators_api.feature R tests/browser/features/combined_filters_api.feature M tests/browser/features/exact_quotes_api.feature D tests/browser/features/exact_quotes_browser.feature M tests/browser/features/fuzzy_api.feature D tests/browser/features/fuzzy_browser.feature M tests/browser/features/hastemplate_api.feature D tests/browser/features/hastemplate_browser.feature M tests/browser/features/incategory_api.feature M tests/browser/features/incategory_browser.feature M tests/browser/features/insource_api.feature D tests/browser/features/insource_browser.feature M tests/browser/features/intitle_api.feature D tests/browser/features/intitle_browser.feature M tests/browser/features/linksto_api.feature D tests/browser/features/linksto_browser.feature M tests/browser/features/prefer_recent_api.feature M tests/browser/features/prefix_api.feature M tests/browser/features/prefix_browser.feature M tests/browser/features/step_definitions/search_steps.rb D tests/browser/features/update_general.feature A tests/browser/features/update_general_api.feature A tests/browser/features/update_general_browser.feature M tests/browser/features/update_non_existent_api.feature M tests/browser/features/update_redirect_api.feature 28 files changed, 305 insertions(+), 378 deletions(-) Approvals: Manybubbles: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/browser/features/bad_syntax_api.feature b/tests/browser/features/bad_syntax_api.feature index e4ecb6e..08d7c42 100644 --- a/tests/browser/features/bad_syntax_api.feature +++ b/tests/browser/features/bad_syntax_api.feature @@ -1,5 +1,76 @@ @bad_syntax @clean @api Feature: Searches with syntax errors + @setup_main + Scenario: Searching for <text>~<text> treats the tilde like a space except that the whole "word" (including tilde) makes a phrase search + When I api search for ffnonesenseword~catapult + Then Two Words is the first api search result + + @setup_main + Scenario: Searching for <text>~<text> treats the tilde like a space (not finding any results if a fuzzy search was needed) + When I api search for ffnonesensewor~catapult + Then there are no api search results + + @balance_quotes + Scenario Outline: Searching for for a phrase with a hanging quote adds the quote automatically + When I api search for <term> + Then Two Words is the first api search result + Examples: + | term | + | "two words | + | "two words" "ffnonesenseword catapult | + | "two words" "ffnonesenseword catapult pickles | + | "two words" pickles "ffnonesenseword catapult | + + @balance_quotes + Scenario Outline: Searching for a phrase containing /, :, and \" find the page as expected + Given a page named <title> exists + When I api search for <term> + Then <title> is the first api search result + Examples: + | term | title | + | "10.1093/acprof:oso/9780195314250.003.0001" | 10.1093/acprof:oso/9780195314250.003.0001 | + | "10.5194/os-8-1071-2012" | 10.5194/os-8-1071-2012 | + | "10.7227/rie.86.2" | 10.7227/rie.86.2 | + | "10.7227\"yay" | 10.7227"yay | + | intitle:"1911 Encyclopædia Britannica/Dionysius"' | 1911 Encyclopædia Britannica/Dionysius | + + 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 api search for NOT catapult + Then there is an api search result + + Scenario Outline: searching for less than and greater than doesn't find tons and tons of tokens + When I api search for <query> + Then there are no api search results + Examples: + | query | + | <} | + | <=} | + | >. | + | >=. | + | > | + | < | + | >> | + | <> | + | <>= | + | >>> | + | <<< | + | <<<~ | + + @filters + Scenario Outline: Empty filters work like terms but aren't in test data so aren't found + When I api search for <term> + Then there are no api search results + Examples: + | term | + | intitle:"" catapult | + | incategory:"" catapult | + | intitle: | + | intitle:"" | + | incategory: | + | incategory:"" | + | hastemplate: | + | hastemplate:"" | + Scenario Outline: Searching with a / doesn't cause a degraded search result When I api search for main <term> Then Main Page is the first api search result diff --git a/tests/browser/features/bad_syntax_browser.feature b/tests/browser/features/bad_syntax_browser.feature index ab07900..ab0b246 100644 --- a/tests/browser/features/bad_syntax_browser.feature +++ b/tests/browser/features/bad_syntax_browser.feature @@ -3,54 +3,12 @@ Background: Given I am at a random page - @setup_main - Scenario: Searching for <text>~<text> treats the tilde like a space except that the whole "word" (including tilde) makes a phrase search - When I search for ffnonesenseword~catapult - Then there is no warning - And Two Words is the first search result - And there is a link to create a new page from the search result - - @setup_main - Scenario: Searching for <text>~<text> treats the tilde like a space (not finding any results if a fuzzy search was needed) - When I search for ffnonesensewor~catapult - Then there is no warning - And there are no search results - And there is a link to create a new page from the search result - @exact_quotes @setup_main Scenario: Searching for "<word> <word>"~<not a numer> treats the ~ as a space When I search for "ffnonesenseword catapult"~anotherword Then there is no warning And Two Words is the first search result And there is no link to create a new page from the search result - - @balance_quotes - Scenario Outline: Searching for for a phrase with a hanging quote adds the quote automatically - When I search for <term> - Then there is no warning - And Two Words is the first search result - And there is no link to create a new page from the search result - Examples: - | term | - | "two words | - | "two words" "ffnonesenseword catapult | - | "two words" "ffnonesenseword catapult pickles | - | "two words" pickles "ffnonesenseword catapult | - - @balance_quotes - Scenario Outline: Searching for a phrase containing /, :, and \" find the page as expected - Given a page named <title> exists - When I search for <term> - Then there is no warning - And <title> is the first search result - And there is no link to create a new page from the search result - Examples: - | term | title | - | "10.1093/acprof:oso/9780195314250.003.0001" | 10.1093/acprof:oso/9780195314250.003.0001 | - | "10.5194/os-8-1071-2012" | 10.5194/os-8-1071-2012 | - | "10.7227/rie.86.2" | 10.7227/rie.86.2 | - | "10.7227\"yay" | 10.7227"yay | - | intitle:"1911 Encyclopædia Britannica/Dionysius"' | 1911 Encyclopædia Britannica/Dionysius | @boolean_operators Scenario Outline: boolean operators in bad positions in the query are ignored so you get the option to create a new page @@ -124,48 +82,6 @@ | catapult ~~~~~~ | | catapult \|\|--- | | \|\| catapult | - - 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 no warning - And there is a search result - And there is no link to create a new page from the search result - - Scenario Outline: searching for less than and greater than doesn't find tons and tons of tokens - When I search for <query> - Then there is no warning - And there are no search results - And there is no link to create a new page from the search result - Examples: - | query | - | <} | - | <=} | - | >. | - | >=. | - | > | - | < | - | >> | - | <> | - | <>= | - | >>> | - | <<< | - | <<<~ | - - @filters - Scenario Outline: Empty filters work like terms but aren't in test data so aren't found - When I search for <term> - Then there is no warning - And there are no search results - Examples: - | term | - | intitle:"" catapult | - | incategory:"" catapult | - | intitle: | - | intitle:"" | - | incategory: | - | incategory:"" | - | hastemplate: | - | hastemplate:"" | @wildcard Scenario Outline: Wildcards can't start a term but they aren't valid titles so you still don't get the link to create an article diff --git a/tests/browser/features/boolean_operators.feature b/tests/browser/features/boolean_operators.feature deleted file mode 100644 index cf66ca0..0000000 --- a/tests/browser/features/boolean_operators.feature +++ /dev/null @@ -1,44 +0,0 @@ -@boolean_operators @clean @phantomjs @setup_main -Feature: Searches with boolean operators - Background: - Given I am at a random page - - 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 - And there is no link to create a new page from the search result - Examples: - | query | - | catapult -amazing | - | -amazing catapult | - | catapult !amazing | - | !amazing catapult | - | catapult NOT amazing | - | NOT amazing catapult | - - 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 - And there is no link to create a new page from the search result - Examples: - | query | - | +catapult amazing | - | amazing +catapult | - | +amazing +catapult | - | catapult AND amazing | - - 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 - And there is no link to create a new page from the search result - Examples: - | query | - | catapult OR África | - | África \|\| catapult | - | catapult OR "África" | - | catapult \|\| "África" | - | "África" OR catapult | - | "África" \|\| catapult | diff --git a/tests/browser/features/boolean_operators_api.feature b/tests/browser/features/boolean_operators_api.feature new file mode 100644 index 0000000..230268e --- /dev/null +++ b/tests/browser/features/boolean_operators_api.feature @@ -0,0 +1,38 @@ +@boolean_operators @clean @api @setup_main +Feature: Searches with boolean operators + Scenario Outline: -, !, and NOT prohibit words in search results + When I api search for <query> + Then Catapult is the first api search result + But Amazing Catapult is not in the api search results + Examples: + | query | + | catapult -amazing | + | -amazing catapult | + | catapult !amazing | + | !amazing catapult | + | catapult NOT amazing | + | NOT amazing catapult | + + Scenario Outline: +, &&, and AND require matches but since that is the default they don't look like they do anything + When I api search for <query> + Then Amazing Catapult is the first api search result + But Catapult is not in the api search results + Examples: + | query | + | +catapult amazing | + | amazing +catapult | + | +amazing +catapult | + | catapult AND amazing | + + Scenario Outline: OR and || matches docs with either set + When I api search for <query> + Then Catapult is in the api search results + And Two Words is in the api search results + Examples: + | query | + | catapult OR África | + | África \|\| catapult | + | catapult OR "África" | + | catapult \|\| "África" | + | "África" OR catapult | + | "África" \|\| catapult | diff --git a/tests/browser/features/combined_filters.feature b/tests/browser/features/combined_filters_api.feature similarity index 60% rename from tests/browser/features/combined_filters.feature rename to tests/browser/features/combined_filters_api.feature index c01e944..665dd58 100644 --- a/tests/browser/features/combined_filters.feature +++ b/tests/browser/features/combined_filters_api.feature @@ -1,12 +1,8 @@ -@clean @filters @phantomjs +@clean @filters @api Feature: Searches with combined filters - Background: - Given I am at a random page - Scenario Outline: Filters can be combined - When I search for <term> - Then <first_result> is the first search result - And there is no link to create a new page from the search result + When I api search for <term> + Then <first_result> is the first api search result Examples: | term | first_result | | incategory:twowords intitle:catapult | none | diff --git a/tests/browser/features/exact_quotes_api.feature b/tests/browser/features/exact_quotes_api.feature index 083fe47..5d071cf 100644 --- a/tests/browser/features/exact_quotes_api.feature +++ b/tests/browser/features/exact_quotes_api.feature @@ -87,3 +87,9 @@ When I api search for catapult -"asdf" "two words" Then Two Words is in the api search results And Catapult is not in the api search results + + @setup_main + Scenario: Searching for a word in quotes disbles stemming (can't find plural with singular) + When I api search for "pickle" + Then there are no api search results + diff --git a/tests/browser/features/exact_quotes_browser.feature b/tests/browser/features/exact_quotes_browser.feature deleted file mode 100644 index 1272ad4..0000000 --- a/tests/browser/features/exact_quotes_browser.feature +++ /dev/null @@ -1,10 +0,0 @@ -@clean @exact_quotes @phantomjs -Feature: Searches that contain quotes - Background: - Given I am at a random page - - @setup_main - Scenario: Searching for a word in quotes disbles stemming (can't find plural with singular) - When I search for "pickle" - Then there are no search results - And there is no link to create a new page from the search result diff --git a/tests/browser/features/fuzzy_api.feature b/tests/browser/features/fuzzy_api.feature index ac8358e..e488899 100644 --- a/tests/browser/features/fuzzy_api.feature +++ b/tests/browser/features/fuzzy_api.feature @@ -11,3 +11,17 @@ Scenario: Fuzzy search doesn't find terms that don't match the first two characters for performance reasons When I api search for fgnonesenseword~ Then there are no api search results + + Scenario: Searching for <text>~ activates fuzzy search + When I api search for ffnonesensewor~ + Then Two Words is the first api search result + + Scenario Outline: Searching for <text>~<number between 0 and 1> activates fuzzy search + When I api search for ffnonesensewor~<number> + Then Two Words is the first api search result + Examples: + | number | + | .8 | + | 0.8 | + | 1 | + diff --git a/tests/browser/features/fuzzy_browser.feature b/tests/browser/features/fuzzy_browser.feature deleted file mode 100644 index db00d7f..0000000 --- a/tests/browser/features/fuzzy_browser.feature +++ /dev/null @@ -1,19 +0,0 @@ -@clean @phantomjs @setup_main -Feature: Searches that contain fuzzy matches - Background: - Given I am at a random page - - Scenario: Searching for <text>~ activates fuzzy search - When I search for ffnonesensewor~ - Then Two Words is the first search result - And there is no link to create a new page from the search result - - Scenario Outline: Searching for <text>~<number between 0 and 1> activates fuzzy search - When I search for ffnonesensewor~<number> - Then Two Words is the first search result - And there is no link to create a new page from the search result - Examples: - | number | - | .8 | - | 0.8 | - | 1 | diff --git a/tests/browser/features/hastemplate_api.feature b/tests/browser/features/hastemplate_api.feature index eb3245d..66c9608 100644 --- a/tests/browser/features/hastemplate_api.feature +++ b/tests/browser/features/hastemplate_api.feature @@ -19,3 +19,8 @@ Scenario: -hastemplate removes pages with matching templates When I api search for -hastemplate:"Template Test" catapult Then Two Words is not in the api search results + + Scenario: hastemplate: finds pages with matching templates (when you don't specify a namespace, Template is assumed) + When I api search for hastemplate:"Template Test" + Then Two Words is the first api search result + diff --git a/tests/browser/features/hastemplate_browser.feature b/tests/browser/features/hastemplate_browser.feature deleted file mode 100644 index 1cdad7c..0000000 --- a/tests/browser/features/hastemplate_browser.feature +++ /dev/null @@ -1,9 +0,0 @@ -@clean @filters @hastemplate @phantomjs -Feature: Searches with the hastemplate filter - Background: - Given I am at a random page - - Scenario: hastemplate: finds pages with matching templates (when you don't specify a namespace, Template is assumed) - When I search for hastemplate:"Template Test" - Then Two Words is the first search result - And there is no link to create a new page from the search result diff --git a/tests/browser/features/incategory_api.feature b/tests/browser/features/incategory_api.feature index be86b56..4ff374d 100644 --- a/tests/browser/features/incategory_api.feature +++ b/tests/browser/features/incategory_api.feature @@ -31,3 +31,18 @@ Scenario: incategory: finds a multiword category when it is surrounded by quotes When I api search for incategory:"CategoryWith ASpace" Then IHaveATwoWordCategory is the first api search result + + Scenario: incategory: can be combined with other text + When I api search for incategory:weaponry amazing + Then Amazing Catapult is the first api search result + + Scenario: -incategory: excludes pages with the category + When I api search for -incategory:weaponry incategory:twowords + Then Two Words is the first api search result + + Scenario: incategory: can handle a space after the : + When I api search for incategory: weaponry + Then Catapult is in the api search results + And Amazing Catapult is in the api search results + But Two Words is not in the api search results + diff --git a/tests/browser/features/incategory_browser.feature b/tests/browser/features/incategory_browser.feature index c2bab22..a956a62 100644 --- a/tests/browser/features/incategory_browser.feature +++ b/tests/browser/features/incategory_browser.feature @@ -10,19 +10,3 @@ But Two Words is not in the search results And there is no link to create a new page from the search result - Scenario: incategory: can be combined with other text - When I search for incategory:weaponry amazing - Then Amazing Catapult is the first search result - And there is no link to create a new page from the search result - - Scenario: -incategory: excludes pages with the category - When I search for -incategory:weaponry incategory:twowords - Then Two Words is the first search result - And there is no link to create a new page from the search result - - Scenario: incategory: can handle a space after the : - When I search for incategory: weaponry - Then Catapult is in the search results - And Amazing Catapult is in the search results - But Two Words is not in the search results - And there is no link to create a new page from the search result diff --git a/tests/browser/features/insource_api.feature b/tests/browser/features/insource_api.feature index f2f4d0a..bf9363e 100644 --- a/tests/browser/features/insource_api.feature +++ b/tests/browser/features/insource_api.feature @@ -1,5 +1,20 @@ @clean @filters @insource @api Feature: Searches with the insource filter + Scenario: insource: only includes pages with the source + When I api search for all:insource:pickles + Then Template:Template Test is in the api search results + But Two Words is not in the api search results + + Scenario: insource: can be combined with other text + When I api search for all:insource:catapult two words + Then Two Words is the first api search result + But Template:Template Test is not in the api search results + + Scenario: -insource: excludes pages with that in the source + When I api search for all:-insource:pickles pickles + Then Two Words is the first api search result + But Template:Template Test is not in the api search results + @wildcards Scenario: insource: can take a wildcard When I api search for all:insource:pickl* @@ -17,7 +32,7 @@ When I api search for insource:/\[\[Category/ asdf Then Catapult is the first api search result - @regex @highlighting + @regex Scenario: insource:// finds text inside of template calls When I api search for insource:/year_end.*=.*661/ Then Rashidun Caliphate is the first api search result @@ -43,6 +58,11 @@ Then RegexSpaces is the first api search result @regex + Scenario: insource:// can find a url + When I api search for all:insource:/show_bug.cgi\?id=52908/ + Then File:Savepage-greyed.png is the first api search result + + @regex Scenario: insource:// is case sensitive by default but can be made case insensitive When I api search for insource:/a\.B/ Then there are no api search results @@ -50,22 +70,21 @@ Then RegexEscapedDot is the first api search result @regex - Scenario: insource:// doesn't break other clauses - When I api search for insource:/b c/ insource:/a b c/ - Then RegexSpaces is the first api search result - - @regex - Scenario: insource:// for other complex regexes finds answers and doesn't spin forever - When I api search for all:insource:/[ab]*a[cd]{50,80}/ - Then RegexComplexResult is the first api search result - - @regex Scenario: insource:// reports errors sanely When I api search for all:insource:/[ / Then this error is reported by api: Regular expression syntax error at 2: expected ']' + + @regex + Scenario: insource:// doesn't break other clauses + When I api search for insource:/b c/ insource:/a b c/ + Then RegexSpaces is the first api search result @regex Scenario: insource:// for some complex regexes fails entirely When I api search for all:insource:/[ab]*a[ab]{50,80}/ Then this error is reported by api: Regular expression is too complex. Learn more about simplifying it [[mw:Special:MyLanguage/Help:CirrusSearch/RegexTooComplex|here]]. + @regex + Scenario: insource:// for other complex regexes finds answers and doesn't spin forever + When I api search for all:insource:/[ab]*a[cd]{50,80}/ + Then RegexComplexResult is the first api search result diff --git a/tests/browser/features/insource_browser.feature b/tests/browser/features/insource_browser.feature deleted file mode 100644 index 21dfe70..0000000 --- a/tests/browser/features/insource_browser.feature +++ /dev/null @@ -1,27 +0,0 @@ -@clean @filters @insource @phantomjs -Feature: Searches with the insource filter - Background: - Given I am at a random page - - Scenario: insource: only includes pages with the source - When I search for all:insource:pickles - Then Template:Template Test is in the search results - But Two Words is not in the search results - And there is no link to create a new page from the search result - - Scenario: insource: can be combined with other text - When I search for all:insource:catapult two words - Then Two Words is the first search result - But Template:Template Test is not in the search results - And there is no link to create a new page from the search result - - Scenario: -insource: excludes pages with that in the source - When I search for all:-insource:pickles pickles - Then Two Words is the first search result - But Template:Template Test is not in the search results - And there is no link to create a new page from the search result - - @regex - Scenario: insource:// can find a url - When I search for all:insource:/show_bug.cgi\?id=52908/ - Then File:Savepage-greyed.png is the first search imageresult diff --git a/tests/browser/features/intitle_api.feature b/tests/browser/features/intitle_api.feature index d500716..ac13212 100644 --- a/tests/browser/features/intitle_api.feature +++ b/tests/browser/features/intitle_api.feature @@ -19,3 +19,26 @@ When I api search for intitle: "amazing catapult" Then Amazing Catapult is the first api search result And Two Words is not in the api search results + + Scenario: intitle: only includes pages with the title + When I api search for intitle:catapult + Then Catapult is in the api search results + And Amazing Catapult is in the api search results + But Two Words is not in the api search results + + Scenario: -intitle: excludes pages with part of the title + When I api search for -intitle:amazing intitle:catapult + Then Catapult is the first api search result + And Amazing Catapult is not in the api search results + + Scenario: -intitle: doesn't highlight excluded title + When I api search for -intitle:catapult two words + Then Two Words is the first api search result + And ffnonesenseword catapult pickles anotherword is the highlighted text of the first api search result + + Scenario: intitle: will accept a space after its : + When I api search for intitle: catapult + Then Catapult is in the api search results + And Amazing Catapult is in the api search results + But Two Words is not in the api search results + diff --git a/tests/browser/features/intitle_browser.feature b/tests/browser/features/intitle_browser.feature deleted file mode 100644 index 7b26df7..0000000 --- a/tests/browser/features/intitle_browser.feature +++ /dev/null @@ -1,29 +0,0 @@ -@clean @filters @intitle @phantomjs -Feature: Searches with the intitle filter - Background: - Given I am at a random page - - Scenario: intitle: only includes pages with the title - When I search for intitle:catapult - Then Catapult is in the search results - And Amazing Catapult is in the search results - But Two Words is not in the search results - And there is no link to create a new page from the search result - - Scenario: -intitle: excludes pages with part of the title - When I search for -intitle:amazing intitle:catapult - Then Catapult is the first search result - And Amazing Catapult is not in the search results - And there is no link to create a new page from the search result - - Scenario: -intitle: doesn't highlight excluded title - When I search for -intitle:catapult two words - Then Two Words is the first search result - And ffnonesenseword catapult pickles anotherword is the highlighted text of the first search result - - Scenario: intitle: will accept a space after its : - When I search for intitle: catapult - Then Catapult is in the search results - And Amazing Catapult is in the search results - But Two Words is not in the search results - And there is no link to create a new page from the search result diff --git a/tests/browser/features/linksto_api.feature b/tests/browser/features/linksto_api.feature index 24bdf26..e527e6c 100644 --- a/tests/browser/features/linksto_api.feature +++ b/tests/browser/features/linksto_api.feature @@ -1,5 +1,10 @@ @clean @filters @linksto @api Feature: Searches with the linksto filter + Scenario: linksto only includes pages with the links + When I api search for linksto:"LinksToTest Target" + Then LinksToTest Plain is in the api search results + And LinksToTest OtherText is in the api search results + Scenario: linksto can be combined with other text When I api search for linksto:"LinksToTest Target" text Then LinksToTest OtherText is the first api search result diff --git a/tests/browser/features/linksto_browser.feature b/tests/browser/features/linksto_browser.feature deleted file mode 100644 index 22bf6ce..0000000 --- a/tests/browser/features/linksto_browser.feature +++ /dev/null @@ -1,11 +0,0 @@ -@clean @filters @linksto @phantomjs -Feature: Searches with the linksto filter - Background: - Given I am at a random page - - Scenario: linksto only includes pages with the links - When I search for linksto:"LinksToTest Target" - Then LinksToTest Plain is in the search results - And LinksToTest OtherText is in the search results - But LinksToTest No Link is not in the search results - And there is no link to create a new page from the search result diff --git a/tests/browser/features/prefer_recent_api.feature b/tests/browser/features/prefer_recent_api.feature index 90acf17..bc2e85d 100644 --- a/tests/browser/features/prefer_recent_api.feature +++ b/tests/browser/features/prefer_recent_api.feature @@ -1,4 +1,4 @@ -@clean @phantomjs @prefer_recent +@clean @api @prefer_recent Feature: Searches with prefer-recent Scenario Outline: Recently updated articles are prefered if prefer-recent: is specified When I api search for PreferRecent First OR Second OR Third diff --git a/tests/browser/features/prefix_api.feature b/tests/browser/features/prefix_api.feature index 983f4bb..e7a38f9 100644 --- a/tests/browser/features/prefix_api.feature +++ b/tests/browser/features/prefix_api.feature @@ -54,3 +54,9 @@ Scenario: The prefix: filter doesn't find redirects When I api search for prefix:Prefix Test Redirec Then there are no api search results + + Scenario: The prefix: filter filters results to those with titles prefixed by value + When I api search for prefix prefix:prefix + Then Prefix Test is the first api search result + But Foo Prefix Test is not in the api search results + diff --git a/tests/browser/features/prefix_browser.feature b/tests/browser/features/prefix_browser.feature index a1c2f2d..235a1d8 100644 --- a/tests/browser/features/prefix_browser.feature +++ b/tests/browser/features/prefix_browser.feature @@ -8,8 +8,3 @@ Then Prefix Test is the first search result But Foo Prefix Test is not in the search results - Scenario: The prefix: filter filters results to those with titles prefixed by value - When I search for prefix prefix:prefix - Then Prefix Test is the first search result - But Foo Prefix Test is not in the search results - And there is no link to create a new page from the search result diff --git a/tests/browser/features/step_definitions/search_steps.rb b/tests/browser/features/step_definitions/search_steps.rb index 4acef83..45d0e32 100644 --- a/tests/browser/features/step_definitions/search_steps.rb +++ b/tests/browser/features/step_definitions/search_steps.rb @@ -171,6 +171,9 @@ Then(/^there is a search result$/) do on(SearchResultsPage).first_result_element.should exist end +Then(/^there is an api search result$/) do + @api_result["search"].length.should_not == 0 +end Then(/^(.+) is( in)? the ((?:[^ ])+(?: or (?:[^ ])+)*) search result$/) do |title, in_ok, indexes| on(SearchResultsPage) do |page| found = indexes.split(/ or /).any? do |index| diff --git a/tests/browser/features/update_general.feature b/tests/browser/features/update_general.feature deleted file mode 100644 index 7db33d3..0000000 --- a/tests/browser/features/update_general.feature +++ /dev/null @@ -1,83 +0,0 @@ -@clean @phantomjs @update -Feature: Search backend updates - Scenario: Deleted pages are removed from the index - Given a page named DeleteMe exists - And I am at a random page - Then within 20 seconds searching for DeleteMe yields DeleteMe as the first result - When I delete DeleteMe - Then within 20 seconds searching for DeleteMe yields none as the first result - - Scenario: Deleted redirects are removed from the index - Given a page named DeleteMeRedirect exists with contents #REDIRECT [[DeleteMe]] - And a page named DeleteMe exists - And I am at a random page - Then within 20 seconds searching for DeleteMeRedirect yields DeleteMe as the first result - When I delete DeleteMeRedirect - Then within 20 seconds searching for DeleteMeRedirect yields none as the first result - - Scenario: Altered pages are updated in the index - Given a page named ChangeMe exists with contents foo - When I edit ChangeMe to add superduperchangedme - And I am at a random page - Then within 20 seconds searching for superduperchangedme yields ChangeMe as the first result - - Scenario: Pages containing altered template are updated in the index - Given a page named Template:ChangeMe exists with contents foo - And a page named ChangeMyTemplate exists with contents {{Template:ChangeMe}} - When I edit Template:ChangeMe to add superduperultrachangedme - And I am at a random page - Then within 20 seconds searching for superduperultrachangedme yields ChangeMyTemplate as the first result - - # This test doesn't rely on our paranoid revision delete handling logic, rather, it verifies what should work with the - # logic with a similar degree of paranoia - Scenario: When a revision is deleted the page is updated regardless of if the revision is current - Given I am logged in - And a page named RevDelTest exists with contents first - And a page named RevDelTest exists with contents delete this revision - And within 20 seconds searching for intitle:RevDelTest "delete this revision" yields RevDelTest as the first result - And a page named RevDelTest exists with contents current revision - When I delete the second most recent revision of RevDelTest - Then within 20 seconds searching for intitle:RevDelTest "delete this revision" yields none as the first result - When I search for intitle:RevDelTest current revision - Then RevDelTest is the first search result - - @move - Scenario: Moved pages that leave a redirect are updated in the index - Given I am logged in - And a page named Move%{epoch} From1 exists with contents move me - And within 20 seconds searching for Move%{epoch} From1 yields Move%{epoch} From1 as the first result - When I move Move%{epoch} From1 to Move%{epoch} To1 and leave a redirect - And within 20 seconds searching for Move%{epoch} From1 yields Move%{epoch} To1 as the first result - And within 20 seconds searching for Move%{epoch} To1 yields Move%{epoch} To1 as the first result - - @move - Scenario: Moved pages that leave a redirect are updated in the index - Given I am logged in - And a page named Move%{epoch} From2 exists with contents move me - And within 20 seconds searching for Move%{epoch} From2 yields Move%{epoch} From2 as the first result - When I move Move%{epoch} From2 to Move%{epoch} To2 and do not leave a redirect - Then within 20 seconds searching for Move%{epoch} From2 yields none as the first result - And within 20 seconds searching for Move%{epoch} To2 yields Move%{epoch} To2 as the first result - - @move - Scenario: Moved pages that switch indexes are removed from their old index if they leave a redirect - Given I am logged in - And a page named Move%{epoch} From3 exists with contents move me - And within 20 seconds searching for Move%{epoch} From3 yields Move%{epoch} From3 as the first result - When I move Move%{epoch} From3 to User:Move%{epoch} To3 and leave a redirect - Then within 20 seconds searching for User:Move%{epoch} To3 yields User:Move%{epoch} To3 as the first result - And within 20 seconds searching for Move%{epoch} From3 yields none as the first result - - @move - Scenario: Moved pages that switch indexes are removed from their old index if they don't leave a redirect - Given I am logged in - And a page named Move%{epoch} From4 exists with contents move me - And within 20 seconds searching for Move%{epoch} From4 yields Move%{epoch} From4 as the first result - When I move Move%{epoch} From4 to User:Move%{epoch} To4 and do not leave a redirect - Then within 20 seconds searching for User:Move%{epoch} To4 yields User:Move%{epoch} To4 as the first result - And within 20 seconds searching for Move%{epoch} To4 yields none as the first result - - Scenario: Really really long links don't break updates - When a page named ReallyLongLink%{epoch} exists with contents @really_long_link.txt - And I am at a random page - Then within 20 seconds searching for ReallyLongLink%{epoch} yields ReallyLongLink%{epoch} as the first result diff --git a/tests/browser/features/update_general_api.feature b/tests/browser/features/update_general_api.feature new file mode 100644 index 0000000..4a89394 --- /dev/null +++ b/tests/browser/features/update_general_api.feature @@ -0,0 +1,29 @@ +@clean @api @update +Feature: Search backend updates + Scenario: Deleted pages are removed from the index + Given a page named DeleteMe exists + Then within 20 seconds api searching for DeleteMe yields DeleteMe as the first result + When I delete DeleteMe + Then within 20 seconds api searching for DeleteMe yields none as the first result + + Scenario: Deleted redirects are removed from the index + Given a page named DeleteMeRedirect exists with contents #REDIRECT [[DeleteMe]] + And a page named DeleteMe exists + Then within 20 seconds api searching for DeleteMeRedirect yields DeleteMe as the first result + When I delete DeleteMeRedirect + Then within 20 seconds api searching for DeleteMeRedirect yields none as the first result + + Scenario: Altered pages are updated in the index + Given a page named ChangeMe exists with contents foo + When I edit ChangeMe to add superduperchangedme + Then within 20 seconds api searching for superduperchangedme yields ChangeMe as the first result + + Scenario: Pages containing altered template are updated in the index + Given a page named Template:ChangeMe exists with contents foo + And a page named ChangeMyTemplate exists with contents {{Template:ChangeMe}} + When I edit Template:ChangeMe to add superduperultrachangedme + Then within 20 seconds api searching for superduperultrachangedme yields ChangeMyTemplate as the first result + + Scenario: Really really long links don't break updates + When a page named ReallyLongLink%{epoch} exists with contents @really_long_link.txt + Then within 20 seconds api searching for ReallyLongLink%{epoch} yields ReallyLongLink%{epoch} as the first result diff --git a/tests/browser/features/update_general_browser.feature b/tests/browser/features/update_general_browser.feature new file mode 100644 index 0000000..9978df9 --- /dev/null +++ b/tests/browser/features/update_general_browser.feature @@ -0,0 +1,41 @@ +@clean @phantomjs @update +Feature: Search backend updates + # This test doesn't rely on our paranoid revision delete handling logic, rather, it verifies what should work with the + # logic with a similar degree of paranoia + Scenario: When a revision is deleted the page is updated regardless of if the revision is current + Given I am logged in + And a page named RevDelTest exists with contents first + And a page named RevDelTest exists with contents delete this revision + And within 20 seconds searching for intitle:RevDelTest "delete this revision" yields RevDelTest as the first result + And a page named RevDelTest exists with contents current revision + When I delete the second most recent revision of RevDelTest + Then within 20 seconds searching for intitle:RevDelTest "delete this revision" yields none as the first result + When I search for intitle:RevDelTest current revision + Then RevDelTest is the first search result + + @move + Scenario: Moved pages that leave a redirect are updated in the index + Given I am logged in + And a page named Move%{epoch} From2 exists with contents move me + And within 20 seconds searching for Move%{epoch} From2 yields Move%{epoch} From2 as the first result + When I move Move%{epoch} From2 to Move%{epoch} To2 and do not leave a redirect + Then within 20 seconds searching for Move%{epoch} From2 yields none as the first result + And within 20 seconds searching for Move%{epoch} To2 yields Move%{epoch} To2 as the first result + + @move + Scenario: Moved pages that switch indexes are removed from their old index if they leave a redirect + Given I am logged in + And a page named Move%{epoch} From3 exists with contents move me + And within 20 seconds searching for Move%{epoch} From3 yields Move%{epoch} From3 as the first result + When I move Move%{epoch} From3 to User:Move%{epoch} To3 and leave a redirect + Then within 20 seconds searching for User:Move%{epoch} To3 yields User:Move%{epoch} To3 as the first result + And within 20 seconds searching for Move%{epoch} From3 yields none as the first result + + @move + Scenario: Moved pages that switch indexes are removed from their old index if they don't leave a redirect + Given I am logged in + And a page named Move%{epoch} From4 exists with contents move me + And within 20 seconds searching for Move%{epoch} From4 yields Move%{epoch} From4 as the first result + When I move Move%{epoch} From4 to User:Move%{epoch} To4 and do not leave a redirect + Then within 20 seconds searching for User:Move%{epoch} To4 yields User:Move%{epoch} To4 as the first result + And within 20 seconds searching for Move%{epoch} To4 yields none as the first result diff --git a/tests/browser/features/update_non_existent_api.feature b/tests/browser/features/update_non_existent_api.feature index 8339ac6..08b3acc 100644 --- a/tests/browser/features/update_non_existent_api.feature +++ b/tests/browser/features/update_non_existent_api.feature @@ -1,13 +1,9 @@ -@clean @non_existent @phantomjs @update +@clean @non_existent @api @update Feature: Search backend updates that reference nonexistent pages - Background: - Given I am at a random page - Scenario: Pages that link to nonexistent pages still get their search index updated Given a page named IDontExist doesn't exist And a page named ILinkToNonExistentPages%{epoch} exists with contents [[IDontExist]] - When I am at a random page - Then within 10 seconds searching for ILinkToNonExistentPages%{epoch} yields ILinkToNonExistentPages%{epoch} as the first result + Then within 10 seconds api searching for ILinkToNonExistentPages%{epoch} yields ILinkToNonExistentPages%{epoch} as the first result Scenario: Pages that redirect to nonexistent pages don't throw errors Given a page named IDontExist doesn't exist @@ -15,30 +11,27 @@ Scenario: Linking to a nonexistent page doesn't add it to the search index with an [INVALID] word count Given a page named ILinkToNonExistentPages%{epoch} exists with contents [[IDontExistLink%{epoch}]] - When I am at a random page - Then within 20 seconds searching for IDontExistLink%{epoch} yields ILinkToNonExistentPages%{epoch} as the first result - And there are no search results with [INVALID] words in the data + Then within 20 seconds api searching for IDontExistLink%{epoch} yields ILinkToNonExistentPages%{epoch} as the first result + And there are no api search results with [INVALID] words in the data When a page named IDontExistLink%{epoch} exists - Then within 10 seconds searching for IDontExistLink%{epoch} yields IDontExistLink%{epoch} as the first result - And there are no search results with [INVALID] words in the data + Then within 10 seconds api searching for IDontExistLink%{epoch} yields IDontExistLink%{epoch} as the first result + And there are no api search results with [INVALID] words in the data Scenario: Redirecting to a non-existing page doesn't add it to the search index with an [INVALID] word count Given a page named IRedirectToNonExistentPages%{epoch} exists with contents #REDIRECT [[IDontExistRdir%{epoch}]] - And I am at a random page When wait 5 seconds for the index to get the page - And I search for IDontExistRdir%{epoch} - And there are no search results with [INVALID] words in the data + And I api search for IDontExistRdir%{epoch} + And there are no api search results with [INVALID] words in the data And a page named IDontExistRdir%{epoch} exists - Then within 10 seconds searching for IDontExistRdir%{epoch} yields IDontExistRdir%{epoch} as the first result - And there are no search results with [INVALID] words in the data + Then within 10 seconds api searching for IDontExistRdir%{epoch} yields IDontExistRdir%{epoch} as the first result + And there are no api search results with [INVALID] words in the data Scenario: Linking to a page that redirects to a non-existing page doesn't add it to the search index with an [INVALID] word count Given a page named IRedirectToNonExistentPagesLinked%{epoch} exists with contents #REDIRECT [[IDontExistRdirLinked%{epoch}]] And a page named ILinkIRedirectToNonExistentPages%{epoch} exists with contents [[IRedirectToNonExistentPagesLinked%{epoch}]] - And I am at a random page When wait 5 seconds for the index to get the page - And I search for IDontExistRdir%{epoch} - And there are no search results with [INVALID] words in the data + And I api search for IDontExistRdir%{epoch} + And there are no api search results with [INVALID] words in the data When a page named IDontExistRdirLinked%{epoch} exists - Then within 10 seconds searching for IDontExistRdirLinked%{epoch} yields IDontExistRdirLinked%{epoch} as the first result - And there are no search results with [INVALID] words in the data + Then within 10 seconds api searching for IDontExistRdirLinked%{epoch} yields IDontExistRdirLinked%{epoch} as the first result + And there are no api search results with [INVALID] words in the data diff --git a/tests/browser/features/update_redirect_api.feature b/tests/browser/features/update_redirect_api.feature index 51272e1..7d6714b 100644 --- a/tests/browser/features/update_redirect_api.feature +++ b/tests/browser/features/update_redirect_api.feature @@ -6,7 +6,7 @@ Then within 20 seconds api searching for ToBeRedirect%{epoch} yields ToBeRedirect%{epoch} as the first result When a page named ToBeRedirect%{epoch} exists with contents #REDIRECT [[RedirectTaget]] Then within 20 seconds api searching for ToBeRedirect%{epoch} yields RedirectTaget as the first result - And ToBeRedirect%{epoch} is not in the search results + And ToBeRedirect%{epoch} is not in the api search results Scenario: Turning a page from a redirect to a regular page puts it in the index Given a page named RedirectTaget exists -- To view, visit https://gerrit.wikimedia.org/r/207042 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0be02c8a1b55e51c96d389a3ba1cbb145412eed8 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits