cleanup some publishing/posting cukes, hopefully stabilizing them

This commit is contained in:
Florian Staudacher 2014-04-22 01:24:40 +02:00 committed by Florian Staudacher
parent 19687c32a4
commit 7680165b14
5 changed files with 94 additions and 74 deletions

View file

@ -17,7 +17,7 @@ Feature: posting from the main page
And I have user with username "alice" in an aspect called "PostingTo"
And I have user with username "alice" in an aspect called "NotPostingThingsHere"
And I am on the home page
Scenario: expanding the publisher
Given ".markdownIndications" is hidden
And ".options_and_submit" is hidden
@ -28,23 +28,20 @@ Feature: posting from the main page
Scenario: post a text-only message to all aspects
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | I am eating yogurt |
And I press "Share"
When I write the status message "I am eating yogurt"
And I submit the publisher
And I go to the aspects page
Then "I am eating yogurt" should be post 1
Scenario: re-posting a text-only message
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | The World needs more Cats. |
And I press "Share"
When I write the status message "The World needs more Cats."
And I submit the publisher
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | The World needs more Cats. |
And I press "Share"
When I write the status message "The World needs more Cats."
And I submit the publisher
And I go to the aspects page
Then "The World needs more Cats." should be post 1
@ -58,10 +55,9 @@ Feature: posting from the main page
Scenario: post a text-only message to just one aspect
When I select only "PostingTo" aspect
And I expand the publisher
And I fill in the following:
| status_message_fake_text | I am eating a yogurt |
When I write the status message "I am eating a yogurt"
And I press "Share"
And I submit the publisher
When I am on the aspects page
And I select only "PostingTo" aspect
@ -74,9 +70,8 @@ Feature: posting from the main page
Scenario: post a photo with text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
When I fill in the following:
| status_message_fake_text | Look at this dog |
And I press "Share"
When I write the status message "Look at this dog"
And I submit the publisher
And I go to the aspects page
Then I should see a "img" within ".stream_element div.photo_attachments"
And I should see "Look at this dog" within ".stream_element"
@ -112,8 +107,7 @@ Feature: posting from the main page
Scenario: back out of uploading a picture to a post with text
Given I expand the publisher
And I have turned off jQuery effects
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
When I write the status message "I am eating a yogurt"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I click to delete the first uploaded photo
Then I should not see an uploaded image within the photo drop zone
@ -122,8 +116,7 @@ Feature: posting from the main page
Scenario: back out of uploading a picture when another has been attached
Given I expand the publisher
And I have turned off jQuery effects
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
When I write the status message "I am eating a yogurt"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I click to delete the first uploaded photo
@ -133,9 +126,8 @@ Feature: posting from the main page
@wip
Scenario: hide a contact's post
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | Here is a post for you to hide |
And I press "Share"
When I write the status message "Here is a post for you to hide"
And I submit the publisher
And I log out
And I sign in as "alice@alice.alice"
@ -151,9 +143,8 @@ Feature: posting from the main page
Scenario: delete one of my posts
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
And I press "Share"
When I write the status message "I am eating a yogurt"
And I submit the publisher
And I go to the aspects page
And I hover over the ".stream_element"
And I click to delete the first post
@ -165,7 +156,7 @@ Feature: posting from the main page
And I press the aspect dropdown
And I toggle the aspect "PostingTo"
And I append "I am eating a yogurt" to the publisher
And I press "Share"
And I submit the publisher
And I am on the aspects page
And I select only "PostingTo" aspect
@ -179,13 +170,13 @@ Feature: posting from the main page
And I press the aspect dropdown
And I toggle the aspect "PostingTo"
And I append "I am eating a yogurt" to the publisher
And I press "Share"
And I submit the publisher
And I expand the publisher
And I press the aspect dropdown
And I toggle the aspect "Besties"
And I append "And cornflakes also" to the publisher
And I press "Share"
And I submit the publisher
And I am on the aspects page
And I select only "PostingTo" aspect
@ -201,9 +192,8 @@ Feature: posting from the main page
# (NOTE) make this a jasmine spec
Scenario: reject deletion one of my posts
When I expand the publisher
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
And I press "Share"
When I write the status message "I am eating a yogurt"
And I submit the publisher
And I hover over the ".stream_element"
And I prepare the deletion of the first post

View file

@ -1,3 +1,21 @@
module AspectCukeHelpers
def click_aspect_dropdown
find('.dropdown .button').click
end
def toggle_aspect(a_name)
a_id = @me.aspects.where(name: a_name).pluck(:id).first
aspect_css = ".dropdown li[data-aspect_id='#{a_id}']"
page.should have_selector(aspect_css)
find(aspect_css).click
end
def aspect_dropdown_visible?
find('.aspect_membership.dropdown.active').should be_visible
end
end
World(AspectCukeHelpers)
When /^I click on "([^"]*)" aspect edit icon$/ do |aspect_name|
within(".all_aspects") do
li = find('li', text: aspect_name)
@ -23,20 +41,6 @@ When /^I select "([^"]*)" aspect as well$/ do |aspect_name|
step %Q(I should see "#{aspect_name}" aspect selected)
end
Then /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspects_list") do
page.should have_css "li[data-aspect_id='#{aspect.id}'] .selected"
end
end
Then /^I should see "([^"]*)" aspect unselected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspects_list") do
page.should have_no_css "li[data-aspect_id='#{aspect.id}'] .selected"
end
end
When /^I check the first contact list button$/ do
find(".contact_list .button", match: :first).tap do |button|
button.click
@ -51,3 +55,29 @@ When /^I uncheck the first contact list button$/ do
sleep 1 # The expectation above should wait for the request to finsh, but that doesn't work for some reason
end
end
When /^I press the aspect dropdown$/ do
click_aspect_dropdown
end
And /^I toggle the aspect "([^"]*)"$/ do |name|
toggle_aspect(name)
end
Then /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspects_list") do
page.should have_css "li[data-aspect_id='#{aspect.id}'] .selected"
end
end
Then /^I should see "([^"]*)" aspect unselected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspects_list") do
page.should have_no_css "li[data-aspect_id='#{aspect.id}'] .selected"
end
end
Then /^the aspect dropdown should be visible$/ do
aspect_dropdown_visible?
end

View file

@ -64,19 +64,6 @@ And /^I expand the publisher$/ do
click_publisher
end
When /^I press the aspect dropdown$/ do
find('.dropdown .button').click
end
Then /^the aspect dropdown should be visible$/ do
find(:css, '.aspect_membership.dropdown.active').should be_visible
end
And /^I toggle the aspect "([^"]*)"$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
find(".dropdown li[data-aspect_id='#{aspect.id}']").click
end
Then /^the publisher should be expanded$/ do
find("#publisher")["class"].should_not include("closed")
end
@ -85,18 +72,6 @@ Then /^the text area wrapper mobile should be with attachments$/ do
find("#publisher_textarea_wrapper")["class"].should include("with_attachments")
end
When /^I append "([^"]*)" to the publisher$/ do |stuff|
elem = find('#status_message_fake_text')
elem.native.send_keys(' ' + stuff)
end
When /^I append "([^"]*)" to the publisher mobile$/ do |stuff|
elem = find('#status_message_text')
elem.native.send_keys(' ' + stuff)
find('#status_message_text').value.should include(stuff)
end
And /^I want to mention (?:him|her) from the profile$/ do
find('#mention_button').click
within('#facebox') do

View file

@ -38,6 +38,10 @@ And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email|
user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspects)
end
And /^I submit the publisher$/ do
submit_publisher
end
When /^I click on the first block button/ do
find(".stream_element", match: :first).hover
find(".block_user").click
@ -71,6 +75,14 @@ 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 append "([^"]*)" to the publisher mobile$/ do |text|
append_to_publisher(text, '#status_message_text')
end
When /^I open the show page of the "([^"]*)" post$/ do |post_text|
visit post_path_by_content(post_text)
end

View file

@ -3,10 +3,23 @@ module PublishingCukeHelpers
fill_in 'status_message_fake_text', with: txt
end
def append_to_publisher(txt, input_selector='#status_message_fake_text')
elem = find(input_selector)
elem.native.send_keys(' ' + txt)
# make sure the other text field got the new contents
find('#status_message_text', visible: false).value.should include(txt)
end
def make_post(text)
write_in_publisher(txt)
find(".creation").click
page.should have_content text unless page.has_css? '.nsfw-shield'
write_in_publisher(text)
submit_publisher
end
def submit_publisher
txt = find('#publisher #status_message_fake_text').value
find('#publisher .creation').click
page.should have_content(txt) unless page.has_css?('.nsfw-shield')
end
def click_and_post(text)