diff --git a/Changelog.md b/Changelog.md index e4ab25b92..e22291293 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,7 @@ ## Refactor * Enable paranoid mode for devise [#8003](https://github.com/diaspora/diaspora/pull/8003) - +* Refactor likes cucumber test [#8002](https://github.com/diaspora/diaspora/pull/8002) ## Bug fixes ## Features diff --git a/features/desktop/likes.feature b/features/desktop/likes.feature index 73227004d..02bd395e8 100644 --- a/features/desktop/likes.feature +++ b/features/desktop/likes.feature @@ -16,13 +16,14 @@ Feature: Liking posts Scenario: Liking and unliking a post from the stream Then I should not have activated notifications for the post When I like the post "I like unicorns" in the stream - Then I should see "Unlike" within ".stream-element .feedback" - And I should see a ".likes .media" within "#main-stream .stream-element" + Then the post "I like unicorns" should have the "Unlike" action available + And the post "I like unicorns" should have 1 like + And the post "I like unicorns" should have a like from "Alice Smith" And I should have activated notifications for the post When I unlike the post "I like unicorns" in the stream - Then I should see "Like" within ".stream-element .feedback" - And I should not see a ".likes .media" within "#main-stream .stream-element" + Then the post "I like unicorns" should have the "Like" action available + And the post "I like unicorns" shouldn't have any likes Scenario: Liking and unliking a post from a single post page @@ -39,4 +40,6 @@ Feature: Liking posts When I like the post "I like unicorns" in the stream And I sign out And I sign in as "bob@bob.bob" - Then I should see a ".likes" within "#main-stream .stream-element" + Then the post "I like unicorns" should have the "Like" action available + And the post "I like unicorns" should have 1 like + And the post "I like unicorns" should have a like from "Alice Smith" diff --git a/features/step_definitions/left_navbar_steps.rb b/features/step_definitions/left_navbar_steps.rb index 4a88bebb1..f84f3526a 100644 --- a/features/step_definitions/left_navbar_steps.rb +++ b/features/step_definitions/left_navbar_steps.rb @@ -11,7 +11,7 @@ Given /^I have configured a Bitcoin address$/ do end Then /^I should see the Bitcoin address$/ do - find("#bitcoin_address")['value'].should == "AAAAAA" + find("#bitcoin_address")["value"].should == "AAAAAA" end Given /^I have configured a Liberapay username$/ do diff --git a/features/step_definitions/publisher_steps.rb b/features/step_definitions/publisher_steps.rb index 8479b1429..f0d6a8c46 100644 --- a/features/step_definitions/publisher_steps.rb +++ b/features/step_definitions/publisher_steps.rb @@ -70,5 +70,6 @@ When /^I select "([^"]*)" on the aspect dropdown$/ do |text| var elem = $(el); if ('" + text + "' == $.trim(elem.text()) ) { elem.click(); - }});") + }});" + ) end diff --git a/features/step_definitions/stream_steps.rb b/features/step_definitions/stream_steps.rb index eacc1668e..853df81ca 100644 --- a/features/step_definitions/stream_steps.rb +++ b/features/step_definitions/stream_steps.rb @@ -4,6 +4,35 @@ When /^I (?:like|unlike) the post "([^"]*)" in the stream$/ do |post_text| like_stream_post(post_text) end +Then /^the post "([^"]*)" should have the "([^"]*)" action available$/ do |post_text, action_text| + within_post(post_text) do + find(".feedback").should have_content(action_text) + end +end + +Then /^the post "([^"]*)" shouldn't have any likes$/ do |post_text| + within_post(post_text) do + find(".likes").should have_no_css(".avatar", visible: true) + end +end + +Then /^the post "([^"]*)" should have (\d+) like(?:s|)$/ do |post_text, likes_number| + within_post(post_text) do + find(".expand-likes").should have_content(likes_number) + end +end + +Then /^the post "([^"]*)" should have a like from "([^"]*)"$/ do |post_text, username| + within_post(post_text) do + find(".expand-likes").click + find(".likes .avatar")["data-original-title"].should have_content(username) + end +end + +Then /^I should see an image in the publisher$/ do + photo_in_publisher.should be_present +end + Then /^"([^"]*)" should be post (\d+)$/ do |post_text, position| stream_element_numbers_content(position).should have_content(post_text) end