From cebc50a3281954f882e33962f2ca93f3359fa3ea Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Thu, 15 Jan 2015 20:06:56 -0300 Subject: [PATCH] [unfinished] fix publish_article features --- app/views/cms/publish.html.erb | 26 +++----------------------- features/publish_article.feature | 8 ++++++-- features/step_definitions/noosfero_steps.rb | 6 +++++- features/step_definitions/search_steps.rb | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/app/views/cms/publish.html.erb b/app/views/cms/publish.html.erb index e801003..39016ee 100644 --- a/app/views/cms/publish.html.erb +++ b/app/views/cms/publish.html.erb @@ -1,16 +1,3 @@ -

<%= _('Where do you want to publish this article?') %>

@@ -36,9 +23,7 @@
<%= _('You can publish this article on your profile where your friends and followers will see.') %>
<%= form_tag do %> <%= hidden_field_tag :back_to, @back_to %> -
- <%= labelled_text_field _('Title'), 'name', @article.name %> -
+ <%= labelled_form_field _('Title'), text_field_tag('name', @article.name) %> <% button_bar do %> <%= submit_button 'spread', _('Spread this') %> @@ -55,10 +40,7 @@ <%= hidden_field_tag :back_to, @back_to %> <% search_action = url_for(:action => 'search_communities_to_publish') %> <%= token_input_field_tag(:q, 'search-communities-to-publish', search_action, { :hint_text => _('Type in a search for your community'), :zindex => 10000, :focus => false }) %> - -
- <%= labelled_text_field _('Title'), 'name', @article.name %> -
+ <%= labelled_form_field _('Title'), text_field_tag('name', @article.name) %> <% button_bar do %> <%= submit_button 'spread', _('Spread this') %> <% end %> @@ -74,9 +56,7 @@ <%= form_tag :action => 'publish_on_portal_community', :id => @article.id do %> <%= hidden_field_tag :back_to, @back_to %> -
- <%= labelled_text_field _('Title'), :name, @article.name %> -
+ <%= labelled_form_field _('Title'), text_field_tag('name', @article.name) %> <% button_bar do %> <%= submit_button 'spread', _('Spread this') %> diff --git a/features/publish_article.feature b/features/publish_article.feature index a23847f..2b04db5 100644 --- a/features/publish_article.feature +++ b/features/publish_article.feature @@ -28,16 +28,20 @@ Feature: publish article When I go to sample-community's sitemap Then I should see "Sample Article" + @selenium Scenario: publishing an article with a different name Given I am logged in as "joaosilva" And "Joao Silva" is a member of "Sample Community" And I am on joaosilva's control panel And I follow "Manage Content" And I follow "Spread" - And I check "Sample Community" + And I choose the following communities to spread + | name | + | Sample Community | And I fill in "Title" with "Another name" And I press "Spread this" - When I go to sample-community's sitemap + And show sample-community tasks + When I go to sample-community's blog Then I should see "Another name" And I should not see "Sample Article" diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 3dd5ae3..f38386d 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -771,4 +771,8 @@ Given /^the field (.*) is public for all users$/ do |field| person.fields_privacy[field] = "public" person.save! end -end \ No newline at end of file +end + +And /^show (.*) tasks$/ do |identifier| + puts Community.find_by_identifier(identifier).tasks.pending.count +end diff --git a/features/step_definitions/search_steps.rb b/features/step_definitions/search_steps.rb index b0c320e..4eeef3f 100644 --- a/features/step_definitions/search_steps.rb +++ b/features/step_definitions/search_steps.rb @@ -3,3 +3,18 @@ When /^I choose the search filter "(.*)"$/ do |filter| # find("li", :text => filter).click page.execute_script("jQuery('li[title=#{filter}]').click();") end + +When /^I choose the following communities to spread$/ do |table| + ids = [] + table.hashes.each do |row| + name = row.delete("name") + community = Community.find_by_name(name) + ids << community.id + end + #TODO make this work somehow... + #fill_in('q', :with => ids.join(',')) + #fill_in('#search-communities-to-publish', :with => ids.join(',')) + page.execute_script("jQuery('#search-communities-to-publish').val(#{ids.join(',')})") + page.execute_script("jQuery('#search-communities-to-publish').show()") + p find('#search-communities-to-publish').value +end -- libgit2 0.21.2