refactored test method into helpers
This commit is contained in:
parent
5dae27c170
commit
27997e9525
2 changed files with 19 additions and 7 deletions
|
|
@ -3,14 +3,11 @@ Then /^the post "([^"]*)" should be marked nsfw$/ do |text|
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the post should be collapsed$/ do
|
Then /^the post should be collapsed$/ do
|
||||||
find(".collapsible").should have_css(".expander")
|
first_post_collapsed?
|
||||||
find(".collapsible").has_selector?(".collapsed")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the post should be expanded$/ do
|
Then /^the post should be expanded$/ do
|
||||||
find(".expander").should_not be_visible
|
first_post_expanded?
|
||||||
find(".collapsible").has_no_selector?(".collapsed")
|
|
||||||
find(".collapsible").has_selector?(".opened")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see an uploaded image within the photo drop zone$/ do
|
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
|
end
|
||||||
|
|
||||||
When /^I expand the post$/ do
|
When /^I expand the post$/ do
|
||||||
find(".expander").click
|
expand_first_post
|
||||||
wait_until{ !find(".expander").visible? }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see "([^"]*)" as the first post in my stream$/ do |text|
|
Then /^I should see "([^"]*)" as the first post in my stream$/ do |text|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,22 @@ module PublishingCukeHelpers
|
||||||
')
|
')
|
||||||
end
|
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
|
def first_post_text
|
||||||
find('.stream_element:first .post-content').text()
|
find('.stream_element:first .post-content').text()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue