blob: 5afa5f5fe495727c00441a99538f68a497e524ac (
plain)
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
|
# frozen_string_literal: true
Then /^I expand the publisher$/ do
click_publisher
end
And /^I close the publisher$/ do
find("#publisher .md-cancel").click
end
Then /^the publisher should be expanded$/ do
find("#publisher")["class"].should_not include("closed")
end
When /^I click to delete the first uploaded photo$/ do
page.execute_script("$('#photodropzone .x').css('display', 'block');")
image_count = all(".publisher_photo img", wait: false).count
find("#photodropzone .x", match: :first).trigger "click"
page.assert_selector(".publisher_photo img", count: image_count - 1)
end
Then /^I should see an uploaded image within the photo drop zone$/ do
expect(find("#photodropzone img")["src"]).to include("uploads/images")
end
Then /^I should not see an uploaded image within the photo drop zone$/ do
page.should_not have_css "#photodropzone img"
end
Then /^I should not be able to submit the publisher$/ do
expect(publisher_submittable?).to be false
end
Then /^I should see "([^"]*)" in the publisher$/ do |text|
expect(page).to have_field("status_message[text]", with: text)
end
When /^I write the status message "([^"]*)"$/ do |text|
write_in_publisher(text)
end
When /^I insert an extremely long status message$/ do
write_in_publisher("I am a very interesting message " * 64)
end
When /^I append "([^"]*)" to the publisher$/ do |text|
append_to_publisher(text)
end
When /^I type "([^"]*)" into the publisher$/ do |text|
type_into_publisher(text)
end
When /^I attach "([^"]*)" to the publisher$/ do |path|
upload_file_with_publisher(path)
end
And /^I submit the publisher$/ do
submit_publisher
end
When /^I click the publisher and post "([^"]*)"$/ do |text|
click_and_post(text)
end
When /^I post an extremely long status message$/ do
click_and_post("I am a very interesting message " * 64)
end
When /^I select "([^"]*)" on the aspect dropdown$/ do |text|
page.execute_script(
"$('#publisher .dropdown .dropdown_list, #publisher .aspect-dropdown .dropdown-menu')
.find('li').each(function(i,el){
var elem = $(el);
if ('" + text + "' == $.trim(elem.text()) ) {
elem.click();
}});"
)
end
|