1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# frozen_string_literal: true
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
When /^I toggle nsfw posts$/ do
find(".toggle_nsfw_state", match: :first).click
end
When /^I toggle all nsfw posts$/ do
all("a.toggle_nsfw_state").each &:click
end
Then /^I should have (\d+) nsfw posts$/ do |num_posts|
page.should have_css(".nsfw-shield", count: num_posts.to_i)
end
When /^I prepare the deletion of the first post$/ do
find(".stream .stream-element", match: :first).hover
within(find(".stream .stream-element", match: :first)) do
ctrl = find(".control-icons")
ctrl.hover
ctrl.find(".remove_post").click
end
end
When /^I prepare hiding the first post$/ do
find(".stream .stream-element", match: :first).hover
within(find(".stream .stream-element", match: :first)) do
ctrl = find(".control-icons")
ctrl.hover
ctrl.find(".hide_post").click
end
end
When /^I click to delete the first post$/ do
accept_alert do
step "I prepare the deletion of the first post"
end
expect(find(".stream")).to have_no_css(".stream-element.loaded.deleting")
end
When /^I click to hide the first post$/ do
accept_alert do
step "I prepare hiding the first post"
end
end
When /^I click to delete the first comment$/ do
within("div.comment", match: :first) do
find(".comment_delete", visible: false).click
end
end
Then /^I should not see any posts in my stream$/ do
expect(page).not_to have_selector("#paginate .loader")
expect(page).not_to have_selector(".stream-element .media")
expect(page).to have_selector(".stream-element .no-posts-info")
end
Then /^I should not see any picture in my stream$/ do
expect(page).to have_selector(".photo_area img", count: 0)
end
Then /^I should see (\d+) pictures in my stream$/ do |count|
expect(page).to have_selector(".photo_area img", count: count)
end
|