diff --git a/app/assets/javascripts/app/pages/profile.js b/app/assets/javascripts/app/pages/profile.js index 17a21ea3b..716baa906 100644 --- a/app/assets/javascripts/app/pages/profile.js +++ b/app/assets/javascripts/app/pages/profile.js @@ -80,6 +80,11 @@ app.pages.Profile = app.views.Base.extend({ collection: this.streamCollection }); app.stream.fetch(); + + if( this.model.get('is_own_profile') ) { + app.publisher = new app.views.Publisher({collection : app.stream.items}); + } + return new view({model: app.stream}); }, diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index fed0296f7..937cb4bd4 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -21,10 +21,14 @@ .stream_container + -if user_signed_in? && current_page?(person_path(current_user.person)) + = render 'publisher/publisher', publisher_aspects_for(nil) + #main_stream.stream -# JS #paginate + %span.loader.hidden %a{:id=>"back-to-top", :title=>"#{t('layouts.application.back_to_top')}", :href=>"#"} ⇧ diff --git a/features/desktop/blocks_user.feature b/features/desktop/blocks_user.feature index 6057252a7..84e2b66af 100644 --- a/features/desktop/blocks_user.feature +++ b/features/desktop/blocks_user.feature @@ -18,9 +18,7 @@ Feature: Blocking a user from the stream Then I should not see any posts in my stream Scenario: Blocking a user from the profile page - When I am on the home page - And I follow "Alice Smith" + When I am on "alice@alice.alice"'s page When I click on the profile block button And I confirm the alert - And I am on the home page Then I should not see any posts in my stream diff --git a/features/desktop/post_preview.feature b/features/desktop/post_preview.feature index e587a2e51..b6b4bf15c 100644 --- a/features/desktop/post_preview.feature +++ b/features/desktop/post_preview.feature @@ -42,7 +42,7 @@ Feature: preview posts in the stream Scenario: preview a photo with text Given I expand the publisher - When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + And I attach "spec/fixtures/button.png" to the publisher When I fill in the following: | status_message_fake_text | Look at this dog | And I press "Preview" diff --git a/features/desktop/posts_from_main_page.feature b/features/desktop/posts_from_main_page.feature index 0da96f25f..0e4023424 100644 --- a/features/desktop/posts_from_main_page.feature +++ b/features/desktop/posts_from_main_page.feature @@ -69,7 +69,7 @@ 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" + And I attach "spec/fixtures/button.png" to the publisher When I write the status message "Look at this dog" And I submit the publisher And I go to the aspects page @@ -83,7 +83,7 @@ Feature: posting from the main page Scenario: post a photo without text Given I expand the publisher - When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + And I attach "spec/fixtures/button.png" to the publisher Then I should see an uploaded image within the photo drop zone When I press "Share" And I go to the aspects page @@ -96,10 +96,10 @@ Feature: posting from the main page Scenario: back out of posting a photo-only post Given I expand the publisher And I have turned off jQuery effects - When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload" + And I attach "spec/fixtures/button.png" to the publisher And I confirm the alert Then I should not see an uploaded image within the photo drop zone - When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + And I attach "spec/fixtures/button.png" to the publisher And I click to delete the first uploaded photo Then I should not see an uploaded image within the photo drop zone And I should not be able to submit the publisher @@ -108,7 +108,7 @@ Feature: posting from the main page Given I expand the publisher And I have turned off jQuery effects 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 "spec/fixtures/button.png" to the publisher And I click to delete the first uploaded photo Then I should not see an uploaded image within the photo drop zone And the publisher should be expanded @@ -117,8 +117,8 @@ Feature: posting from the main page Given I expand the publisher And I have turned off jQuery effects 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 attach "spec/fixtures/button.png" to the publisher + And I attach "spec/fixtures/button.png" to the publisher And I click to delete the first uploaded photo Then I should see an uploaded image within the photo drop zone And the publisher should be expanded diff --git a/features/desktop/posts_from_profile_page.feature b/features/desktop/posts_from_profile_page.feature index cd968d5b2..96ee0404a 100644 --- a/features/desktop/posts_from_profile_page.feature +++ b/features/desktop/posts_from_profile_page.feature @@ -34,11 +34,9 @@ Feature: posting from own profile 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 | who am I? | - - And I press "Share" + When I write the status message "who am I?" + And I attach "spec/fixtures/button.png" to the publisher + And I submit the publisher When I am on the home page Then I should see a "img" within ".stream_element div.photo_attachments" @@ -47,6 +45,6 @@ Feature: posting from own profile page Scenario: back out of posting a photo-only post Given I expand the publisher And I have turned off jQuery effects - When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + And I attach "spec/fixtures/button.png" to the publisher And I click to delete the first uploaded photo Then I should not see an uploaded image within the photo drop zone diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index 98e2cff05..0bcb3ef34 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -15,7 +15,7 @@ Then /^I should not see an uploaded image within the photo drop zone$/ do end Then /^I should not see any posts in my stream$/ do - all(".stream_element").should be_empty + page.assert_selector(".stream_element", count: 0) end Then /^I should not be able to submit the publisher$/ do @@ -83,6 +83,10 @@ When /^I append "([^"]*)" to the mobile publisher$/ do |text| append_to_publisher(text, '#status_message_text') end +When /^I attach "([^"]*)" to the publisher$/ do |path| + upload_file_with_publisher(path) +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 5e7e14e3e..cfebf3a95 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -4,13 +4,21 @@ module PublishingCukeHelpers end def append_to_publisher(txt, input_selector='#status_message_fake_text') - elem = find(input_selector) + elem = find(input_selector, visible: false) elem.native.send_keys(' ' + txt) # make sure the other text field got the new contents expect(find('#status_message_text', visible: false).value).to include(txt) end + def upload_file_with_publisher(path) + page.execute_script(%q{$("input[name='file']").css("opacity", '1');}) + with_scope("#publisher_textarea_wrapper") do + attach_file("file", Rails.root.join(path).to_s) + page.assert_selector(".publisher_photo.loading", count: 0) + end + end + def make_post(text) write_in_publisher(text) submit_publisher