[BrowserTest] remove sleep from multiedit test

* put the shared step in shared_steps.rb
* replace "onfocus" with simple "click"
* update RSpec while we're at it

Change-Id: I77754abdbeba1314758f5fe10601f6601e8783bd
This commit is contained in:
Cmcmahon 2014-11-14 14:30:45 -07:00
parent 36e07b247e
commit 6d22cebb62
3 changed files with 19 additions and 22 deletions

View file

@ -9,19 +9,14 @@ When(/^I enter and save the first edit$/) do
end
When(/^I enter and save a (.+) edit$/) do |count|
on(VisualEditorPage) do |page|
page.wait_until(10) do
page.medium_dialog_element.visible? == false
end
on(VisualEditorPage).medium_dialog_element.when_not_visible(10)
edit_text = "Editing with " + Random.rand.to_s
instance_variable_set("@#{count}_edit_text", edit_text)
sleep 2
step "I click Edit for VisualEditor"
step "I insert the text #{edit_text}"
step "I click Save page"
step "I click Save page the second time"
end
end
When(/^I insert the text (.*?)$/) do |input_string|
on(VisualEditorPage).content_element.when_present(10).send_keys(input_string)
@ -32,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(10).text.should match(@third_edit_text + @second_edit_text + "Editing with " + @random_string + " " + @first_edit_text)
expect(on(VisualEditorPage).page_text_element.when_present(10).text).to match "#{@third_edit_text}#{@second_edit_text}Editing with #{@random_string} #{@first_edit_text}"
end

View file

@ -16,14 +16,6 @@ When(/^I click Insert references list$/) do
on(VisualEditorPage).insert_references_list_element.when_present.click
end
When(/^I click Edit for VisualEditor$/) do
on(VisualEditorPage) do |page|
page.edit_ve_element.when_present.click
# no longer need to dismiss beta warning here https://gerrit.wikimedia.org/r/#/c/119217/
page.content_element.when_present(10).fire_event("onfocus")
end
end
When(/^I click Reference$/) do
on(VisualEditorPage) do |page|
page.insert_menu_element.when_present.click

View file

@ -30,6 +30,13 @@ Given(/^I make the text "(.*?)" be selected$/) do |select_text|
sleep 1 # turn the sleep on if this test fails with bullet/number in front of string NOT "This is.."
end
When(/^I click Edit for VisualEditor$/) do
on(VisualEditorPage) do |page|
page.edit_ve_element.when_present.click
page.content_element.when_present.click
end
end
When(/^I click Review and Save$/) do
on(VisualEditorPage) do |page|
page.container_disabled_element.when_not_visible.should_not exist
@ -57,7 +64,10 @@ When(/^I click Save page$/) do
end
When(/^I click Save page the second time$/) do
on(VisualEditorPage).second_save_page_element.when_present.click
on(VisualEditorPage) do |page|
page.second_save_page_element.when_present.click
page.second_save_page_element.when_not_present
end
end
When(/^I do not see This is a minor edit$/) do