Cmcmahon has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/55431


Change subject: use new page names for move to avoid collisions with created 
pages. actually move page
......................................................................

use new page names for move to avoid collisions with created pages. actually 
move page

Change-Id: Ia61ff81e1102462591c21f51b828bc54a8f847e2
---
M features/page.feature
M features/step_definitions/page_steps.rb
M features/support/env.rb
A features/support/pages/move_page.rb
4 files changed, 64 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/qa/browsertests 
refs/changes/31/55431/1

diff --git a/features/page.feature b/features/page.feature
index ca56dc3..7574e25 100644
--- a/features/page.feature
+++ b/features/page.feature
@@ -30,7 +30,8 @@
 
   Scenario: Move existing page dialog
     Given I am logged in
-      And I am on a newly created page with article text
+      And I am starting a page to be moved
+      And I create the page to be moved
     When I click Move
     Then I should be on a page that says Move newly created page
       And I should see a Namespace selectbox
@@ -40,12 +41,15 @@
       And I should see a Watch source page radio button
 
   Scenario: Move existing page
-    Given I have clicked Move on the newly created page
-    When I type To new page name containing the name of the existing page plus 
text Moved
+    Given I am logged in
+    And I am starting a page to be moved to a new name
+    And I have clicked Move on the newly created page
+    When I make a new page name for the moved page
       And I click Move page
     Then I should be on a page that says Move succeeded
-      And I should have a link to the old page title and a link to the new 
page title
       And I should see the text A redirect has been created
+      And I should have a link to the old page title and a link to the new 
page title
+
 
   Scenario: Moved page checks
     Given I moved a page successfully
diff --git a/features/step_definitions/page_steps.rb 
b/features/step_definitions/page_steps.rb
index ace44fd..0c2b786 100644
--- a/features/step_definitions/page_steps.rb
+++ b/features/step_definitions/page_steps.rb
@@ -36,8 +36,12 @@
 Then /^watchlist element should not be there$/ do
   on(ArticlePage).watchlist_element.should_not exist
 end
-Given(/^I am on a newly created page with article text$/) do
-  step 'I am at page that does not exist'
+
+Given /^I am starting a page to be moved$/  do
+  visit(DoesNotExistPage, using_params: {page_name: 
@page_to_be_moved_page_name})
+end
+
+Given /^I create the page to be moved$/  do
   step 'I click link Create'
   step 'I enter article text'
   step 'I click Save page button'
@@ -50,7 +54,7 @@
 
 Then(/^I should be on a page that says Move newly created page$/) do
   @browser.url.should match /Special:MovePage/
-  @browser.text.should match /Move page: #{@does_not_exist_page_name}/
+  @browser.text.should match /Move page: #{@page_to_be_moved_page_name}/
 end
 
 Then(/^I should see a Namespace selectbox$/) do
@@ -73,3 +77,36 @@
   on(MovePage).watch_source_element.should exist
 end
 
+Given /^I am starting a page to be moved to a new name$/  do
+  visit(DoesNotExistPage, using_params: {page_name: 
@page_to_be_moved_to_new_page_name})
+end
+
+Given(/^I have clicked Move on the newly created page$/) do
+  step 'I click link Create'
+  step 'I enter article text'
+  step 'I click Save page button'
+  step 'I click Move'
+end
+
+When(/^I make a new page name for the moved page$/) do
+  on(MovePage).new_title="#{@page_to_be_moved_page_name} Moved"
+end
+
+When(/^I click Move page$/) do
+  on(MovePage).move_page
+end
+
+Then(/^I should be on a page that says Move succeeded$/) do
+  @browser.text.should match /Move succeeded/
+end
+
+Then(/^I should have a link to the old page title and a link to the new page 
title$/) do
+  pending # on(MovePage).old_page_link.when_present.should exist
+  pending # on(MovePage).moved_page_link.when_present.should exist
+end
+
+Then(/^I should see the text A redirect has been created$/) do
+  @browser.text.should match /A redirect has been created/
+end
+
+
diff --git a/features/support/env.rb b/features/support/env.rb
index 397391a..41fc7e2 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -74,10 +74,14 @@
 saucelabs_key = secret['saucelabs_key']
 
 does_not_exist_page_name = Random.new.rand
+page_to_be_moved_page_name = Random.new.rand
+page_to_be_moved_to_new_page_name = Random.new.rand
 
 Before do |scenario|
   @config = config
   @does_not_exist_page_name = does_not_exist_page_name
+  @page_to_be_moved_page_name = page_to_be_moved_page_name
+  @page_to_be_moved_to_new_page_name = page_to_be_moved_to_new_page_name
   @mediawiki_username = mediawiki_username
   @mediawiki_password = mediawiki_password
   @browser = browser(environment, test_name(scenario), saucelabs_username, 
saucelabs_key)
diff --git a/features/support/pages/move_page.rb 
b/features/support/pages/move_page.rb
new file mode 100644
index 0000000..f078a82
--- /dev/null
+++ b/features/support/pages/move_page.rb
@@ -0,0 +1,12 @@
+class MovePage
+  include PageObject
+puts @does_not_exist_page_name.to_s
+  select(:namespace, id: 'wpNewTitleNs')
+  text_field(:new_title, id: 'wpNewTitleMain')
+  text_field(:reason, id: 'wpReason')
+  checkbox(:leave_redirect, id: 'wpLeaveRedirect')
+  checkbox(:watch_source, id: 'watch')
+  button(:move_page, name: 'wpMove')
+  a(:old_page_link, text: "#{@page_to_be_moved_page_name}")
+  a(:moved_page_link, text: "#{@page_to_be_moved_page_name} Moved") 
+end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia61ff81e1102462591c21f51b828bc54a8f847e2
Gerrit-PatchSet: 1
Gerrit-Project: qa/browsertests
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <[email protected]>

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

Reply via email to