fix race condition in cukes

This commit is contained in:
Florian Staudacher 2014-04-21 21:01:27 +02:00
parent 0d51bba959
commit 19687c32a4
5 changed files with 15 additions and 10 deletions

View file

@ -16,20 +16,17 @@ Feature: preview posts in the stream
Scenario: preview and post a text-only message Scenario: preview and post a text-only message
Given I expand the publisher Given I expand the publisher
When I fill in the following: When I write the status message "I am eating yogurt"
| status_message_fake_text | I am eating yogurt |
And I press "Preview" And I press "Preview"
Then "I am eating yogurt" should be post 1 Then "I am eating yogurt" should be post 1
And the first post should be a preview And the first post should be a preview
When I fill in the following: When I write the status message "This preview rocks"
| status_message_fake_text | This preview rocks |
And I press "Preview" And I press "Preview"
Then "This preview rocks" should be post 1 Then "This preview rocks" should be post 1
And I should not see "I am eating a yogurt" And I should not see "I am eating a yogurt"
When I fill in the following: When I write the status message "I like rocks"
| status_message_fake_text | I like rocks |
And I press "Share" And I press "Share"
Then "I like rocks" should be post 1 Then "I like rocks" should be post 1
And I should not see "This preview rocks" And I should not see "This preview rocks"

View file

@ -7,7 +7,7 @@ end
And /^I mention Alice in the publisher$/ do And /^I mention Alice in the publisher$/ do
alice = User.find_by_email 'alice@alice.alice' alice = User.find_by_email 'alice@alice.alice'
fill_in 'status_message_fake_text', :with => "@{Alice Smith ; #{alice.person.diaspora_handle}}" write_in_publisher("@{Alice Smith ; #{alice.person.diaspora_handle}}")
end end
And /^I click on the first user in the mentions dropdown list$/ do And /^I click on the first user in the mentions dropdown list$/ do

View file

@ -63,8 +63,12 @@ When /^I post an extremely long status message$/ do
click_and_post("I am a very interesting message " * 64) click_and_post("I am a very interesting message " * 64)
end end
When /^I write the status message "([^"]*)"$/ do |text|
write_in_publisher(text)
end
When /^I insert an extremely long status message$/ do When /^I insert an extremely long status message$/ do
fill_in 'status_message_fake_text', :with => "I am a very interesting message " * 64 write_in_publisher("I am a very interesting message " * 64)
end end
When /^I open the show page of the "([^"]*)" post$/ do |post_text| When /^I open the show page of the "([^"]*)" post$/ do |post_text|

View file

@ -3,7 +3,7 @@ Then /^I like the post "([^"]*)"$/ do |post_text|
end end
Then /^"([^"]*)" should be post (\d+)$/ do |post_text, position| Then /^"([^"]*)" should be post (\d+)$/ do |post_text, position|
stream_element_numbers_content(position).text.should == post_text stream_element_numbers_content(position).should have_content(post_text)
end end
When /^I toggle nsfw posts$/ do When /^I toggle nsfw posts$/ do

View file

@ -1,6 +1,10 @@
module PublishingCukeHelpers module PublishingCukeHelpers
def write_in_publisher(txt)
fill_in 'status_message_fake_text', with: txt
end
def make_post(text) def make_post(text)
fill_in 'status_message_fake_text', :with => text write_in_publisher(txt)
find(".creation").click find(".creation").click
page.should have_content text unless page.has_css? '.nsfw-shield' page.should have_content text unless page.has_css? '.nsfw-shield'
end end