From 0d9cf0fd6b77c09c617df98cc0c7fc6845076af1 Mon Sep 17 00:00:00 2001 From: Anton Ilin Date: Sat, 1 Feb 2014 12:19:09 +0200 Subject: [PATCH] Tests for hovercard in reshares Coverage with tests is necessary for every feature --- features/desktop/hovercards.feature | 14 +++++++++++++- features/step_definitions/hovercard_steps.rb | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/features/desktop/hovercards.feature b/features/desktop/hovercards.feature index 54a63b4ab..c692d21e9 100644 --- a/features/desktop/hovercards.feature +++ b/features/desktop/hovercards.feature @@ -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 diff --git a/features/step_definitions/hovercard_steps.rb b/features/step_definitions/hovercard_steps.rb index 949f41722..64d7a0fcd 100644 --- a/features/step_definitions/hovercard_steps.rb +++ b/features/step_definitions/hovercard_steps.rb @@ -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