Manybubbles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/81021
Change subject: Test updating linked pages.
......................................................................
Test updating linked pages.
Change-Id: I22ec662b7fb5a6dab64b21b7d6a2936bbacb4ef0
---
M tests/browser/features/step_definitions/page_steps.rb
A tests/browser/features/step_definitions/transformers.rb
M tests/browser/features/support/pages/article_page.rb
M tests/browser/features/updates.feature
4 files changed, 55 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/21/81021/1
diff --git a/tests/browser/features/step_definitions/page_steps.rb
b/tests/browser/features/step_definitions/page_steps.rb
index feae230..a25297c 100644
--- a/tests/browser/features/step_definitions/page_steps.rb
+++ b/tests/browser/features/step_definitions/page_steps.rb
@@ -1,4 +1,7 @@
-Given(/^a page named (.*) exists with contents (.*)$/) do |title, text|
+Given(/^a page named (.*) exists(?: with contents (.*))?$/) do |title, text|
+ if !text then
+ text = title
+ end
edit_page(title, text, false)
end
@@ -7,6 +10,12 @@
edit_page(title, description, false) # Make sure the description is
correct
end
+Given(/^a page named (.*) doesn't exist$/) do |title|
+ visit(ArticlePage, using_params: {page_name: title}) do |page|
+ page.create_link_element.should exist
+ end
+end
+
When(/^I delete (.+)$/) do |title|
visit(DeletePage, using_params: {page_name: title}) do |page|
page.delete
diff --git a/tests/browser/features/step_definitions/transformers.rb
b/tests/browser/features/step_definitions/transformers.rb
new file mode 100644
index 0000000..3f91b35
--- /dev/null
+++ b/tests/browser/features/step_definitions/transformers.rb
@@ -0,0 +1,5 @@
+$start_time = Time.now
+
+Transform(/%{epoch}/) do |param|
+ param.gsub('%{epoch}', $start_time.to_i.to_s)
+end
diff --git a/tests/browser/features/support/pages/article_page.rb
b/tests/browser/features/support/pages/article_page.rb
index 5ee17eb..ebe7c57 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -8,4 +8,5 @@
cell(:file_last_comment){ table_element(:class => 'filehistory')[1][5] }
link(:upload, text: 'upload it')
link(:upload_new_version, text: 'Upload a new version of this file')
+ link(:create_link, text: 'Create')
end
diff --git a/tests/browser/features/updates.feature
b/tests/browser/features/updates.feature
index 4e5fa0a..762e051 100644
--- a/tests/browser/features/updates.feature
+++ b/tests/browser/features/updates.feature
@@ -1,7 +1,8 @@
Feature: Search backend updates
- Scenario: Deleted pages are removed from the index
+ Background:
Given I am logged in
- And a page named DeleteMe exists with contents deleteme
+ Scenario: Deleted pages are removed from the index
+ Given a page named DeleteMe exists with contents deleteme
When I delete DeleteMe
And I am at a random page so I can reload it if I need to
# Sometimes deletes take a second or two to kick in
@@ -14,8 +15,43 @@
Then ChangeMe is the first search result
Scenario: Pages containing altered template are updated in the index
- And a page named Template:ChangeMe exists with contents foo
+ 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
# Updating a template uses the job queue and that can take quite a while
to complete in beta
Then within 75 seconds searching for superduperultrachangedme yields
ChangeMyTemplate as the first result
+
+ Scenario: Pages that link to non-existant pages still get their search index
updated
+ Given a page named IDontExist doesn't exist
+ And a page named ILinkToNonExistantPages%{epoch} exists with contents
[[IDontExist]]
+ When I search for ILinkToNonExistantPages%{epoch}
+ Then ILinkToNonExistantPages%{epoch} is the first search result
+
+ Scenario: Pages that redirect to non-existant pages don't throw errors
+ Given a page named IDontExist doesn't exist
+ When a page named IRedirectToNonExistantPages%{epoch} exists with contents
#REDIRECT [[IDontExist]]
+ Then I am on a page titled IRedirectToNonExistantPages%{epoch}
+
+ Scenario: Pages weights are updated when new pages link to them
+ Given a page named WeightedLink%{epoch} 1 exists
+ And a page named WeightedLink%{epoch} 2/1 exists with contents
[[WeightedLink%{epoch} 2]]
+ And a page named WeightedLink%{epoch} 2 exists
+ And I search for WeightedLink%{epoch}
+ And WeightedLink%{epoch} 2 is the first search result
+ When a page named WeightedLink%{epoch} 1/1 exists with contents
[[WeightedLink%{epoch} 1]]
+ And a page named WeightedLink%{epoch} 1/2 exists with contents
[[WeightedLink%{epoch} 1]]
+ And I search for WeightedLink%{epoch}
+ Then WeightedLink%{epoch} 1 is the first search result
+
+ Scenario: Pages weights are updated when new pages link to their redirects
+ Given a page named WeightedLinkRdir%{epoch} 1/Rdir exists with contents
#REDIRECT [[WeightedLinkRdir%{epoch} 1]]
+ And a page named WeightedLinkRdir%{epoch} 1 exists
+ And a page named WeightedLinkRdir%{epoch} 2/Rdir exists with contents
#REDIRECT [[WeightedLinkRdir%{epoch} 2]]
+ And a page named WeightedLinkRdir%{epoch} 2/1 exists with contents
[[WeightedLink%{epoch} 2/Rdir]]
+ And a page named WeightedLinkRdir%{epoch} 2 exists
+ And I search for WeightedLinkRdir%{epoch}
+ And WeightedLinkRdir%{epoch} 2 is the first search result
+ When a page named WeightedLinkRdir%{epoch} 1/1 exists with contents
[[WeightedLinkRdir%{epoch} 1/Rdir]]
+ And a page named WeightedLinkRdir%{epoch} 1/2 exists with contents
[[WeightedLinkRdir%{epoch} 1/Rdir]]
+ And I search for WeightedLinkRdir%{epoch}
+ Then WeightedLinkRdir%{epoch} 1 is the first search result
--
To view, visit https://gerrit.wikimedia.org/r/81021
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I22ec662b7fb5a6dab64b21b7d6a2936bbacb4ef0
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