[Browser test] Update test to use existing hook

1) Reduce some code duplication.
2) Added bonus: will fix a problem with the failing "links" test.
3) Removed some commented code lines in feature file.

Change-Id: I7ad4ade89c6477fd42eca178bae294f4dfecdf5b
This commit is contained in:
Jeff Hall 2013-12-23 10:41:39 -05:00 committed by Jhall
parent 7779f28aa4
commit 456e8c1f99
2 changed files with 9 additions and 11 deletions

View file

@ -10,11 +10,9 @@ Feature: VisualEditor multi-edit workflow
Not implemented as a Scenario outline since the goal is
to test multiple page edits within a single session.
Scenario: Make multiple edits to the same article
Given I am logged in
When I am at my user page
And I click Edit for VisualEditor
And I enter and save the first edit
And I enter and save a second edit
And I enter and save a third edit
Then the saved page should contain all three edits.
@edit_user_page
Scenario: Make multiple edits to the same article
Given I enter and save the first edit
And I enter and save a second edit
And I enter and save a third edit
Then the saved page should contain all three edits.

View file

@ -1,5 +1,5 @@
When(/^I enter and save the first edit$/) do
@first_edit_text = Random.rand.to_s
@first_edit_text = "Editing with " + Random.rand.to_s
step "I insert the text #{@first_edit_text}"
step "I click Save page"
step "I click This is a minor edit"
@ -10,7 +10,7 @@ end
When(/^I enter and save a (.+) edit$/) do |count|
sleep 2 # Wait for the save confirmation to disappear
edit_text = Random.rand.to_s
edit_text = "Editing with " + Random.rand.to_s
instance_variable_set("@#{count}_edit_text", edit_text)
step "I click Edit for VisualEditor"
step "I insert the text #{edit_text}"
@ -27,5 +27,5 @@ When(/^I click Save page another time$/) do
end
Then(/^the saved page should contain all three edits\.$/) do
on(VisualEditorPage).page_text_element.when_present.text.should match(@third_edit_text + @second_edit_text + @first_edit_text)
on(VisualEditorPage).page_text_element.when_present.text.should match(@third_edit_text + @second_edit_text + "Editing with " + @random_string + " " + @first_edit_text)
end