Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Staudacher <florian_staudacher@yahoo.de>2014-04-22 03:24:40 +0400
committerFlorian Staudacher <florian.staudacher@gmx.at>2014-04-22 05:28:06 +0400
commit7680165b144bab111126f7313078c6bafa330928 (patch)
treed8c2460f2065917e0aef313c788c4967eae05f71
parent19687c32a486af31286fb06d55a31b1b4fd05290 (diff)
cleanup some publishing/posting cukes, hopefully stabilizing them
-rw-r--r--features/desktop/posts_from_main_page.feature54
-rw-r--r--features/step_definitions/aspects_steps.rb56
-rw-r--r--features/step_definitions/custom_web_steps.rb25
-rw-r--r--features/step_definitions/posts_steps.rb12
-rw-r--r--features/support/publishing_cuke_helpers.rb19
5 files changed, 93 insertions, 73 deletions
diff --git a/features/desktop/posts_from_main_page.feature b/features/desktop/posts_from_main_page.feature
index e68434f05..0da96f25f 100644
--- a/features/desktop/posts_from_main_page.feature
+++ b/features/desktop/posts_from_main_page.feature
@@ -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
diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb
index f19e1e5bb..3636a8da3 100644
--- a/features/step_definitions/aspects_steps.rb
+++ b/features/step_definitions/aspects_steps.rb
@@ -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,6 +41,29 @@ When /^I select "([^"]*)" aspect as well$/ do |aspect_name|
step %Q(I should see "#{aspect_name}" aspect selected)
end
+When /^I check the first contact list button$/ do
+ find(".contact_list .button", match: :first).tap do |button|
+ button.click
+ button.parent.should have_css ".added"
+ end
+end
+
+When /^I uncheck the first contact list button$/ do
+ find(".contact_list .button", match: :first).tap do |button|
+ button.click
+ button.parent.should have_css ".add"
+ 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
@@ -37,17 +78,6 @@ Then /^I should see "([^"]*)" aspect unselected$/ do |aspect_name|
end
end
-When /^I check the first contact list button$/ do
- find(".contact_list .button", match: :first).tap do |button|
- button.click
- button.parent.should have_css ".added"
- end
-end
-
-When /^I uncheck the first contact list button$/ do
- find(".contact_list .button", match: :first).tap do |button|
- button.click
- button.parent.should have_css ".add"
- sleep 1 # The expectation above should wait for the request to finsh, but that doesn't work for some reason
- end
+Then /^the aspect dropdown should be visible$/ do
+ aspect_dropdown_visible?
end
diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb
index 3d4069427..ac06e50cb 100644
--- a/features/step_definitions/custom_web_steps.rb
+++ b/features/step_definitions/custom_web_steps.rb
@@ -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
diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb
index 641229595..8b8c1933b 100644
--- a/features/step_definitions/posts_steps.rb
+++ b/features/step_definitions/posts_steps.rb
@@ -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
diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb
index be13bae4e..eef1eeaea 100644
--- a/features/support/publishing_cuke_helpers.rb
+++ b/features/support/publishing_cuke_helpers.rb
@@ -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)