Tests for hovercard in reshares

Coverage with tests is necessary for every feature
This commit is contained in:
Anton Ilin 2014-02-01 12:19:09 +02:00 committed by Anton Ilin
parent 88f502236a
commit 0d9cf0fd6b
2 changed files with 19 additions and 1 deletions

View file

@ -8,9 +8,11 @@ Feature: Hovercards
Given a user named "Bob Jones" with email "bob@bob.bob"
And "bob@bob.bob" has a public post with text "public stuff"
And a user named "Alice" with email "alice@alice.alice"
And "alice@alice.alice" has a public post with text "alice public stuff"
And the post with text "public stuff" is reshared by "alice@alice.alice"
And the post with text "alice public stuff" is reshared by "bob@bob.bob"
And I sign in as "alice@alice.alice"
Scenario: Hovercards on the main stream
Given I am on "bob@bob.bob"'s page
Then I should see "public stuff" within ".stream_element"
@ -18,3 +20,13 @@ Feature: Hovercards
Then I should see a hovercard
When I deactivate the first hovercard
Then I should not see a hovercard
Scenario: Hovercards on the main stream in reshares
When I am on "bob@bob.bob"'s page
Then I should see "alice public stuff" within ".reshare"
When I activate hovercard for "Alice" within ".reshare"
Then I should not see a hovercard
When I am on "alice@alice.alice"'s page
Then I should see "public stuff" within ".reshare"
When I activate hovercard for "Bob Jones" within ".reshare"
Then I should see a hovercard

View file

@ -13,3 +13,9 @@ end
Then(/^I should not see a hovercard$/) do
page.should_not have_css '#hovercard'
end
When (/^I activate hovercard for "([^"]*)" within "([^"]*)"$/) do |name, selector|
with_scope(selector) do
page.execute_script("$('.author').filter(function(index){return $(this).text() === \"#{name}\";}).trigger('mouseenter');")
end
end