refactored test method into helpers

This commit is contained in:
Florian Staudacher 2012-03-16 22:25:53 +01:00
parent 5dae27c170
commit 27997e9525
2 changed files with 19 additions and 7 deletions

View file

@ -3,14 +3,11 @@ Then /^the post "([^"]*)" should be marked nsfw$/ do |text|
end
Then /^the post should be collapsed$/ do
find(".collapsible").should have_css(".expander")
find(".collapsible").has_selector?(".collapsed")
first_post_collapsed?
end
Then /^the post should be expanded$/ do
find(".expander").should_not be_visible
find(".collapsible").has_no_selector?(".collapsed")
find(".collapsible").has_selector?(".opened")
first_post_expanded?
end
Then /^I should see an uploaded image within the photo drop zone$/ do
@ -44,8 +41,7 @@ When /^I click on the first block button/ do
end
When /^I expand the post$/ do
find(".expander").click
wait_until{ !find(".expander").visible? }
expand_first_post
end
Then /^I should see "([^"]*)" as the first post in my stream$/ do |text|

View file

@ -17,6 +17,22 @@ module PublishingCukeHelpers
')
end
def expand_first_post
find(".stream_element:first .expander").click
wait_until{ !find(".expander").visible? }
end
def first_post_collapsed?
find(".stream_element:first .collapsible").should have_css(".expander")
find(".stream_element:first .collapsible").has_selector?(".collapsed")
end
def first_post_expanded?
find(".stream_element:first .expander").should_not be_visible
find(".stream_element:first .collapsible").has_no_selector?(".collapsed")
find(".stream_element:first .collapsible").has_selector?(".opened")
end
def first_post_text
find('.stream_element:first .post-content').text()
end