Commit 82012975eb8accbac901a06c04227a67322160f8
Committed by
Daniela Feitosa
1 parent
8b0ca3f5
Exists in
master
and in
23 other branches
Loading logged-in stuff through Ajax
Also, fixing all selenium tests (ActionItem1672)
Showing
39 changed files
with
460 additions
and
335 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
| ... | ... | @@ -51,6 +51,11 @@ class ContentViewerController < ApplicationController |
| 51 | 51 | return |
| 52 | 52 | end |
| 53 | 53 | |
| 54 | + if request.xhr? && params[:toolbar] | |
| 55 | + render :partial => 'article_toolbar' | |
| 56 | + return | |
| 57 | + end | |
| 58 | + | |
| 54 | 59 | redirect_to_translation |
| 55 | 60 | |
| 56 | 61 | # At this point the page will be showed | ... | ... |
app/controllers/public/profile_controller.rb
| ... | ... | @@ -215,6 +215,14 @@ class ProfileController < PublicController |
| 215 | 215 | end |
| 216 | 216 | end |
| 217 | 217 | |
| 218 | + def profile_info | |
| 219 | + begin | |
| 220 | + @block = profile.blocks.find(params[:block_id]) | |
| 221 | + rescue | |
| 222 | + render :text => _('Profile information could not be loaded') | |
| 223 | + end | |
| 224 | + end | |
| 225 | + | |
| 218 | 226 | protected |
| 219 | 227 | |
| 220 | 228 | def check_access_to_profile | ... | ... |
app/helpers/lightbox_helper.rb
app/views/blocks/profile_image.rhtml
| ... | ... | @@ -14,14 +14,11 @@ |
| 14 | 14 | <p><%= h block.owner.short_name %></p> |
| 15 | 15 | <% end %> |
| 16 | 16 | |
| 17 | -<% if !user.nil? and user.has_permission?('edit_profile', profile) %> | |
| 18 | - <div style='text-align: center; font-size: 75%; clear: both'> | |
| 19 | - <%= link_to _('Control panel'), :controller => 'profile_editor' %> | |
| 20 | - </div> | |
| 21 | -<% end %> | |
| 17 | +<div style="text-align: center; font-size: 75%; clear: both" id="profile-admin-url-<%= block.id %>"></div> | |
| 22 | 18 | |
| 23 | -<div class="profile-info-options"> | |
| 24 | - <%= render :file => 'blocks/profile_info_actions/' + block.owner.class.name.underscore %> | |
| 25 | -</div> | |
| 19 | +<div class="profile-info-options" id="profile-info-options-<%= block.id %>"></div> | |
| 26 | 20 | |
| 27 | 21 | </div><!-- end class="vcard" --> |
| 22 | +<script type="text/javascript"> | |
| 23 | + <%= remote_function :url => { :controller => 'profile', :action => 'profile_info', :block_id => block.id } %> | |
| 24 | +</script> | ... | ... |
app/views/blocks/profile_info.rhtml
| ... | ... | @@ -14,15 +14,13 @@ |
| 14 | 14 | </div> |
| 15 | 15 | </div> |
| 16 | 16 | |
| 17 | -<ul class="profile-info-data"> | |
| 17 | +<ul class="profile-info-data" id="profile-info-data-<%= block.id %>"> | |
| 18 | 18 | <li><%= link_to __('Homepage'), block.owner.url, :class => 'url' %></li> |
| 19 | 19 | <li><%= link_to _('View profile'), block.owner.public_profile_url %></li> |
| 20 | 20 | <% if block.owner.enterprise? && !block.owner.environment.enabled?('disable_products_for_enterprises') %> |
| 21 | 21 | <li><%= link_to(_('Products/Services'), :controller => 'catalog', :profile => block.owner.identifier) %></li> |
| 22 | 22 | <% end %> |
| 23 | - <% if !user.nil? and user.has_permission?('edit_profile', profile) %> | |
| 24 | - <li><%= link_to _('Control panel'), block.owner.admin_url %></li> | |
| 25 | - <% end %> | |
| 23 | + <li id="profile-admin-url-<%= block.id %>"></li> | |
| 26 | 24 | <% if profile.person? %> |
| 27 | 25 | <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li> |
| 28 | 26 | <% end %> |
| ... | ... | @@ -39,8 +37,9 @@ |
| 39 | 37 | </div> |
| 40 | 38 | <% end %> |
| 41 | 39 | |
| 42 | -<div class="profile-info-options"> | |
| 43 | - <%= render :file => 'blocks/profile_info_actions/' + block.owner.class.name.underscore %> | |
| 44 | -</div> | |
| 40 | +<div class="profile-info-options" id="profile-info-options-<%= block.id %>"></div> | |
| 45 | 41 | |
| 46 | 42 | </div><!-- end class="vcard" --> |
| 43 | +<script type="text/javascript"> | |
| 44 | + <%= remote_function :url => { :controller => 'profile', :action => 'profile_info', :block_id => block.id } %> | |
| 45 | +</script> | ... | ... |
| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | +<div<%= " class='logged-in'" if user %>> | |
| 2 | + <% if @page.allow_post_content?(user) || @page.allow_publish_content?(user) %> | |
| 3 | + <div id="article-actions"> | |
| 4 | + <% if @page.allow_post_content?(user) %> | |
| 5 | + <%= link_to content_tag( 'span', label_for_edit_article(@page) ), | |
| 6 | + profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }), | |
| 7 | + :class => 'button with-text icon-edit' %> | |
| 8 | + <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> | |
| 9 | + <% if @page != profile.home_page && !@page.has_posts? %> | |
| 10 | + <%= link_to content_tag( 'span', _('Delete') ), | |
| 11 | + profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page }), | |
| 12 | + :class => 'button with-text icon-delete' %> | |
| 13 | + <% end %> | |
| 14 | + <% if !environment.enabled?('disable_cms') && !@page.folder? %> | |
| 15 | + <% if profile.kind_of?(Person) %> | |
| 16 | + <%= link_to content_tag( 'span', _('Spread this') ), | |
| 17 | + profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }), | |
| 18 | + :class => 'button with-text icon-spread' %> | |
| 19 | + <% elsif profile.kind_of?(Community) && environment.portal_community %> | |
| 20 | + <%= link_to content_tag( 'span', _('Spread this') ), | |
| 21 | + profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }), | |
| 22 | + :class => 'button with-text icon-spread' %> | |
| 23 | + <% end %> | |
| 24 | + <% end %> | |
| 25 | + <% end %> | |
| 26 | + <% end %> | |
| 27 | + <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> | |
| 28 | + <% if !@page.gallery? %> | |
| 29 | + <%= link_to _('Add translation'), | |
| 30 | + profile.admin_url.merge(:controller => 'cms', :action => 'new', | |
| 31 | + :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)), | |
| 32 | + :type => @page.type, :article => { :translation_of_id => @page.native_translation.id }), | |
| 33 | + :class => 'button with-text icon-locale' if @page.translatable? && !@page.native_translation.language.blank? %> | |
| 34 | + <%= lightbox_remote_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %> | |
| 35 | + <% end %> | |
| 36 | + <% if (@page.folder? && !@page.has_posts?) || (@page.parent && @page.parent.folder? && !@page.parent.has_posts?) %> | |
| 37 | + <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> | |
| 38 | + <% end %> | |
| 39 | + <% end %> | |
| 40 | + <% if profile.kind_of?(Enterprise) && @page.gallery? %> | |
| 41 | + <%= button('upload-file', _('Upload files'), :controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent)) %> | |
| 42 | + <% end %> | |
| 43 | + </div> | |
| 44 | + <% elsif profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) %> | |
| 45 | + <div id="article-actions"> | |
| 46 | + <%= link_to content_tag( 'span', _('Suggest an article') ), profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}), :id => 'suggest-article-link', :class => 'button with-text icon-new' %> | |
| 47 | + </div> | |
| 48 | + <% end %> | |
| 49 | + <div id="article-header"> | |
| 50 | + <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %> | |
| 51 | + <%= article_title(@page, :no_link => true) %> | |
| 52 | + <%= article_translations(@page) %> | |
| 53 | + </div> | |
| 54 | +</div> | ... | ... |
app/views/content_viewer/view_page.rhtml
| ... | ... | @@ -6,62 +6,11 @@ |
| 6 | 6 | |
| 7 | 7 | <div id="article" class="<%= @page.css_class_name %>"> |
| 8 | 8 | |
| 9 | +<div id="article-toolbar"></div> | |
| 9 | 10 | |
| 10 | -<div<%= " class='logged-in'" if user %>> | |
| 11 | - <% if @page.allow_post_content?(user) || @page.allow_publish_content?(user) %> | |
| 12 | - <div id="article-actions"> | |
| 13 | - <% if @page.allow_post_content?(user) %> | |
| 14 | - <%= link_to content_tag( 'span', label_for_edit_article(@page) ), | |
| 15 | - profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }), | |
| 16 | - :class => 'button with-text icon-edit' %> | |
| 17 | - <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> | |
| 18 | - <% if @page != profile.home_page && !@page.has_posts? %> | |
| 19 | - <%= link_to content_tag( 'span', _('Delete') ), | |
| 20 | - profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page }), | |
| 21 | - :class => 'button with-text icon-delete' %> | |
| 22 | - <% end %> | |
| 23 | - <% if !environment.enabled?('disable_cms') && !@page.folder? %> | |
| 24 | - <% if profile.kind_of?(Person) %> | |
| 25 | - <%= link_to content_tag( 'span', _('Spread this') ), | |
| 26 | - profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }), | |
| 27 | - :class => 'button with-text icon-spread' %> | |
| 28 | - <% elsif profile.kind_of?(Community) && environment.portal_community %> | |
| 29 | - <%= link_to content_tag( 'span', _('Spread this') ), | |
| 30 | - profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }), | |
| 31 | - :class => 'button with-text icon-spread' %> | |
| 32 | - <% end %> | |
| 33 | - <% end %> | |
| 34 | - <% end %> | |
| 35 | - <% end %> | |
| 36 | - <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> | |
| 37 | - <% if !@page.gallery? %> | |
| 38 | - <%= link_to _('Add translation'), | |
| 39 | - profile.admin_url.merge(:controller => 'cms', :action => 'new', | |
| 40 | - :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)), | |
| 41 | - :type => @page.type, :article => { :translation_of_id => @page.native_translation.id }), | |
| 42 | - :class => 'button with-text icon-locale' if @page.translatable? && !@page.native_translation.language.blank? %> | |
| 43 | - <%= lightbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %> | |
| 44 | - <% end %> | |
| 45 | - <% if (@page.folder? && !@page.has_posts?) || (@page.parent && @page.parent.folder? && !@page.parent.has_posts?) %> | |
| 46 | - <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> | |
| 47 | - <% end %> | |
| 48 | - <% end %> | |
| 49 | - <% if profile.kind_of?(Enterprise) && @page.gallery? %> | |
| 50 | - <%= button('upload-file', _('Upload files'), :controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent)) %> | |
| 51 | - <% end %> | |
| 52 | - </div> | |
| 53 | - <% elsif profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) %> | |
| 54 | - <div id="article-actions"> | |
| 55 | - <%= link_to content_tag( 'span', _('Suggest an article') ), profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}), :id => 'suggest-article-link', :class => 'button with-text icon-new' %> | |
| 56 | - </div> | |
| 57 | - <% end %> | |
| 58 | - <div id="article-header"> | |
| 59 | - <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %> | |
| 60 | - <%= article_title(@page, :no_link => true) %> | |
| 61 | - <%= article_translations(@page) %> | |
| 62 | - </div> | |
| 63 | -</div> | |
| 64 | - | |
| 11 | +<script type="text/javascript"> | |
| 12 | + <%= remote_function :update => "article-toolbar", :url => @page.url.merge({ :toolbar => true, :only_path => true }), :complete => "$$('#article-toolbar .remote-lbOn').each(function(link) { new lightbox(link); }); jQuery('#article-toolbar .simplemenu-trigger').click(function(e) { e.stopPropagation(); })" %> | |
| 13 | +</script> | |
| 65 | 14 | |
| 66 | 15 | <% if !@page.tags.empty? %> |
| 67 | 16 | <div id="article-tags"> | ... | ... |
| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | +if !user.nil? and user.has_permission?('edit_profile', profile) | |
| 2 | + page.replace_html "profile-admin-url-#{@block.id}", link_to(_('Control panel'), @block.owner.admin_url) | |
| 3 | +else | |
| 4 | + page.hide "profile-admin-url-#{@block.id}" | |
| 5 | +end | |
| 6 | +page.replace_html "profile-info-options-#{@block.id}", :file => 'blocks/profile_info_actions/' + @block.owner.class.name.underscore | ... | ... |
features/activate_enterprise.feature
| ... | ... | @@ -7,10 +7,10 @@ Feature: activate enterprise |
| 7 | 7 | Given the following users |
| 8 | 8 | | login | name | |
| 9 | 9 | | joaosilva | Joao Silva | |
| 10 | + And I am logged in as "joaosilva" | |
| 10 | 11 | |
| 11 | 12 | Scenario: added an unexistent code |
| 12 | 13 | Given feature "enterprise_activation" is enabled on environment |
| 13 | - And I am logged in as "joaosilva" | |
| 14 | 14 | And I am on Joao Silva's control panel |
| 15 | 15 | And I fill in "Enterprise activation code" with "abcde" |
| 16 | 16 | When I press "Activate" |
| ... | ... | @@ -21,7 +21,6 @@ Feature: activate enterprise |
| 21 | 21 | And the following enterprises |
| 22 | 22 | | identifier | name | enabled | |
| 23 | 23 | | products-factory | Products Factory | false | |
| 24 | - And I am logged in as "joaosilva" | |
| 25 | 24 | And I am on Joao Silva's control panel |
| 26 | 25 | And enterprise "Products Factory" is enabled |
| 27 | 26 | And I fill in "Enterprise activation code" with code of "Products Factory" |
| ... | ... | @@ -33,7 +32,6 @@ Feature: activate enterprise |
| 33 | 32 | And the following enterprises |
| 34 | 33 | | identifier | name | enabled | |
| 35 | 34 | | products-factory | Products Factory | false | |
| 36 | - And I am logged in as "joaosilva" | |
| 37 | 35 | And I am on Joao Silva's control panel |
| 38 | 36 | And I fill in "Enterprise activation code" with code of "Products Factory" |
| 39 | 37 | When I press "Activate" |
| ... | ... | @@ -45,7 +43,6 @@ Feature: activate enterprise |
| 45 | 43 | And the following enterprises |
| 46 | 44 | | identifier | name | enabled | foundation_year | |
| 47 | 45 | | services-provider | Services Provider | false | 2000 | |
| 48 | - And I am logged in as "joaosilva" | |
| 49 | 46 | And I am on Joao Silva's control panel |
| 50 | 47 | And I fill in "Enterprise activation code" with code of "Services Provider" |
| 51 | 48 | And I press "Activate" |
| ... | ... | @@ -59,7 +56,6 @@ Feature: activate enterprise |
| 59 | 56 | And the following enterprises |
| 60 | 57 | | identifier | name | enabled | cnpj | |
| 61 | 58 | | services-provider | Services Provider | false | 00000000000000 | |
| 62 | - And I am logged in as "joaosilva" | |
| 63 | 59 | And I am on Joao Silva's control panel |
| 64 | 60 | And I fill in "Enterprise activation code" with code of "Services Provider" |
| 65 | 61 | And I press "Activate" |
| ... | ... | @@ -74,11 +70,10 @@ Feature: activate enterprise |
| 74 | 70 | And the following enterprises |
| 75 | 71 | | identifier | name | enabled | foundation_year | |
| 76 | 72 | | services-provider | Services Provider | false | 2000 | |
| 77 | - And I am logged in as "joaosilva" | |
| 78 | - And I am on Joao Silva's control panel | |
| 73 | + And I visit "Joao Silva's control panel" and wait | |
| 79 | 74 | And I fill in "Enterprise activation code" with code of "Services Provider" |
| 80 | - And I press "Activate" | |
| 81 | - And I fill in "enterprise-activation-answer" with "2000" | |
| 75 | + And I press "Activate" and wait | |
| 76 | + And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000" | |
| 82 | 77 | And I press "Continue" |
| 83 | 78 | And I check "I read the terms of use and accepted them" |
| 84 | 79 | When I press "Continue" |
| ... | ... | @@ -92,22 +87,21 @@ Feature: activate enterprise |
| 92 | 87 | And feature "enterprise_activation" is enabled on environment |
| 93 | 88 | And the following enterprises |
| 94 | 89 | | identifier | name | enabled | foundation_year | |
| 95 | - | services-provider | Services Provider | false | 2000 | | |
| 90 | + | services-provider-2 | Services Provider 2 | false | 2000 | | |
| 96 | 91 | | active-template | Active Template | false | 2000 | |
| 97 | 92 | And "Active Template" is the active enterprise template |
| 98 | - And "Services Provider" doesnt have "Active Template" as template | |
| 99 | - And I am logged in as "joaosilva" | |
| 100 | - And I am on Joao Silva's control panel | |
| 101 | - And I fill in "Enterprise activation code" with code of "Services Provider" | |
| 102 | - And I press "Activate" | |
| 103 | - And I fill in "enterprise-activation-answer" with "2000" | |
| 93 | + And "Services Provider 2" doesnt have "Active Template" as template | |
| 94 | + And I visit "Joao Silva's control panel" and wait | |
| 95 | + And I fill in "Enterprise activation code" with code of "Services Provider 2" | |
| 96 | + And I press "Activate" and wait | |
| 97 | + And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000" | |
| 104 | 98 | And I press "Continue" |
| 105 | 99 | And I check "I read the terms of use and accepted them" |
| 106 | 100 | When I press "Continue" |
| 107 | - Then I should see "Services Provider was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise" | |
| 108 | - And enterprise "Services Provider" should be enabled | |
| 109 | - And "Joao Silva" is admin of "Services Provider" | |
| 110 | - And "Services Provider" has "Active Template" as template | |
| 101 | + Then I should see "Services Provider 2 was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise" | |
| 102 | + And enterprise "Services Provider 2" should be enabled | |
| 103 | + And "Joao Silva" is admin of "Services Provider 2" | |
| 104 | + And "Services Provider 2" has "Active Template" as template | |
| 111 | 105 | |
| 112 | 106 | @selenium |
| 113 | 107 | Scenario: not replace template after enable an enterprise |
| ... | ... | @@ -115,20 +109,18 @@ Feature: activate enterprise |
| 115 | 109 | And feature "enterprise_activation" is enabled on environment |
| 116 | 110 | And the following enterprises |
| 117 | 111 | | identifier | name | enabled | foundation_year | |
| 118 | - | services-provider | Services Provider | false | 2000 | | |
| 112 | + | services-provider-3 | Services Provider 3 | false | 2000 | | |
| 119 | 113 | | active-template | Active Template | false | 2000 | |
| 120 | 114 | And "Active Template" is the active enterprise template |
| 121 | - And "Services Provider" doesnt have "Active Template" as template | |
| 122 | - And I am logged in as "joaosilva" | |
| 123 | - And I am on Joao Silva's control panel | |
| 124 | - And I fill in "Enterprise activation code" with code of "Services Provider" | |
| 125 | - And I press "Activate" | |
| 126 | - And I fill in "enterprise-activation-answer" with "2000" | |
| 115 | + And "Services Provider 3" doesnt have "Active Template" as template | |
| 116 | + When I visit "Joao Silva's control panel" and wait | |
| 117 | + And I fill in "Enterprise activation code" with code of "Services Provider 3" | |
| 118 | + And I press "Activate" and wait | |
| 119 | + And I fill in "What year your enterprise was founded? It must have 4 digits, eg 1990." with "2000" | |
| 127 | 120 | And I press "Continue" |
| 128 | 121 | And I check "I read the terms of use and accepted them" |
| 129 | 122 | When I press "Continue" |
| 130 | - Then I should see "Services Provider was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise" | |
| 131 | - And enterprise "Services Provider" should be enabled | |
| 132 | - And "Joao Silva" is admin of "Services Provider" | |
| 133 | - And "Services Provider" doesnt have "Active Template" as template | |
| 134 | - | |
| 123 | + Then I should see "Services Provider 3 was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise" | |
| 124 | + And enterprise "Services Provider 3" should be enabled | |
| 125 | + And "Joao Silva" is admin of "Services Provider 3" | |
| 126 | + And "Services Provider 3" doesnt have "Active Template" as template | ... | ... |
features/admin_categories.feature
| ... | ... | @@ -14,10 +14,15 @@ Feature: manage categories |
| 14 | 14 | Given I am logged in as admin |
| 15 | 15 | |
| 16 | 16 | @selenium |
| 17 | - Scenario: admin user could create a category | |
| 17 | + Scenario: admin user could access new category | |
| 18 | 18 | Given I follow "Administration" |
| 19 | - And I follow "Manage Categories" | |
| 20 | - And I follow "New category" | |
| 19 | + When I follow "Manage Categories" | |
| 20 | + And I follow "New category" and wait | |
| 21 | + Then I should be on /admin/categories/new | |
| 22 | + | |
| 23 | + @selenium | |
| 24 | + Scenario: admin user could create a category | |
| 25 | + Given I visit "/admin/categories/new" and wait | |
| 21 | 26 | When I fill in "Name" with "Category 1" |
| 22 | 27 | And I press "Save" |
| 23 | 28 | Then I should see "Categories" |
| ... | ... | @@ -47,7 +52,8 @@ Feature: manage categories |
| 47 | 52 | Given the following category |
| 48 | 53 | | parent | name | display_in_menu | |
| 49 | 54 | | Steak | Pig | true | |
| 50 | - And I follow "Administration" | |
| 55 | + And I am on the homepage | |
| 56 | + When I follow "Administration" | |
| 51 | 57 | And I follow "Manage Categories" |
| 52 | 58 | Then I should see "Food Show" |
| 53 | 59 | When I follow "Show" | ... | ... |
features/approve_article.feature
| ... | ... | @@ -18,18 +18,19 @@ Feature: approve article |
| 18 | 18 | And "Maria Silva" is a member of "Sample Community" |
| 19 | 19 | And "Joao Silva" is admin of "Sample Community" |
| 20 | 20 | |
| 21 | + @selenium | |
| 21 | 22 | Scenario: edit an article before approval |
| 22 | 23 | Given I am logged in as "mariasilva" |
| 23 | 24 | And I am on Maria Silva's homepage |
| 24 | - And I follow "Spread" | |
| 25 | + When I follow "Spread" and wait | |
| 25 | 26 | And I check "Sample Community" |
| 26 | 27 | And I press "Spread this" |
| 27 | - When I am logged in as "joaosilva" | |
| 28 | + And I am logged in as "joaosilva" | |
| 28 | 29 | And I go to Sample Community's control panel |
| 29 | - And I follow "Process requests" | |
| 30 | + And I follow "Process requests" and wait | |
| 30 | 31 | And I fill in "Text" with "This is an article edited" |
| 31 | 32 | And I choose "Accept" |
| 32 | 33 | And I press "Apply!" |
| 33 | 34 | And I go to Sample Community's sitemap |
| 34 | - When I follow "Sample Article" | |
| 35 | + And I follow "Sample Article" | |
| 35 | 36 | Then I should see "This is an article edited" | ... | ... |
features/balloon.feature
| ... | ... | @@ -2,22 +2,18 @@ Feature: balloon |
| 2 | 2 | I want to view a balloon when mouse clicks on profile trigger |
| 3 | 3 | |
| 4 | 4 | Background: |
| 5 | - Given I am on the homepage | |
| 6 | 5 | Given the following users |
| 7 | - | login | name | | |
| 6 | + | login | name | | |
| 8 | 7 | | joaosilva | Joao Silva | |
| 9 | 8 | And the following communities |
| 10 | - | identifier | name | | |
| 11 | - | sample | Sample | | |
| 9 | + | identifier | name | | |
| 10 | + | sample | Sample | | |
| 12 | 11 | |
| 13 | 12 | @selenium |
| 14 | 13 | Scenario: I should not see trigger if not enabled |
| 15 | - Given the following blocks | |
| 16 | - | owner | type | | |
| 17 | - | environment | PeopleBlock | | |
| 18 | - And feature "show_balloon_with_profile_links_when_clicked" is disabled on environment | |
| 19 | - And I go to the homepage | |
| 20 | - Then I should not see "Friends" | |
| 14 | + Given feature "show_balloon_with_profile_links_when_clicked" is disabled on environment | |
| 15 | + When I go to /browse/people | |
| 16 | + Then I should not see "Profile links" | |
| 21 | 17 | |
| 22 | 18 | @selenium |
| 23 | 19 | Scenario: I should not see trigger by default |
| ... | ... | @@ -25,7 +21,7 @@ Feature: balloon |
| 25 | 21 | | owner | type | |
| 26 | 22 | | environment | PeopleBlock | |
| 27 | 23 | And feature "show_balloon_with_profile_links_when_clicked" is enabled on environment |
| 28 | - And I go to the homepage | |
| 24 | + When I go to the homepage | |
| 29 | 25 | Then I should not see "Friends" |
| 30 | 26 | |
| 31 | 27 | @selenium |
| ... | ... | @@ -34,39 +30,33 @@ Feature: balloon |
| 34 | 30 | | owner | type | |
| 35 | 31 | | environment | PeopleBlock | |
| 36 | 32 | And feature "show_balloon_with_profile_links_when_clicked" is enabled on environment |
| 37 | - And I go to the homepage | |
| 38 | - When I click ".menu-submenu-trigger" | |
| 39 | - Then I should see "Profile" | |
| 40 | - And I should see "Friends" | |
| 33 | + When I go to the homepage | |
| 34 | + And I follow "Profile links" | |
| 35 | + Then I should see "Friends" | |
| 41 | 36 | |
| 42 | 37 | @selenium |
| 43 | 38 | Scenario: I should see balloon when clicked on community block trigger |
| 44 | - Given the following blocks | |
| 45 | - | owner | type | | |
| 46 | - | environment | CommunitiesBlock | | |
| 47 | - And feature "show_balloon_with_profile_links_when_clicked" is enabled on environment | |
| 48 | - And I go to the homepage | |
| 49 | - When I click ".menu-submenu-trigger" | |
| 50 | - Then I should see "Profile" | |
| 51 | - And I should see "Members" | |
| 52 | - And I should see "Agenda" | |
| 39 | + Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment | |
| 40 | + When I go to /browse/communities | |
| 41 | + And I follow "Profile links" | |
| 42 | + Then I should see "Members" | |
| 53 | 43 | |
| 54 | 44 | @selenium |
| 55 | 45 | Scenario: I should not see trigger if not enabled on page |
| 56 | 46 | Given feature "show_balloon_with_profile_links_when_clicked" is disabled on environment |
| 57 | - And I go to /assets/communities | |
| 58 | - Then I should not see "Members" | |
| 47 | + When I go to /assets/people | |
| 48 | + Then I should not see "Profile links" | |
| 59 | 49 | |
| 60 | 50 | @selenium |
| 61 | 51 | Scenario: I should not see trigger by default on page |
| 62 | 52 | Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment |
| 63 | - And I go to /assets/communities | |
| 53 | + When I go to /assets/communities | |
| 64 | 54 | Then I should not see "Members" |
| 65 | 55 | |
| 66 | 56 | @selenium |
| 67 | 57 | Scenario: I should see balloon when clicked on page trigger |
| 68 | 58 | Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment |
| 69 | - And I go to /assets/communities | |
| 70 | - When I click ".menu-submenu-trigger" | |
| 59 | + When I go to /assets/communities | |
| 60 | + And I follow "Profile links" | |
| 71 | 61 | Then I should see "Members" |
| 72 | 62 | And I should see "Agenda" | ... | ... |
features/blog.feature
| ... | ... | @@ -83,12 +83,13 @@ Feature: blog |
| 83 | 83 | When I follow "Configure blog" |
| 84 | 84 | Then I should be on edit "Blog One" by joaosilva |
| 85 | 85 | |
| 86 | + @selenium | |
| 86 | 87 | Scenario: configure blog when viewing it |
| 87 | 88 | Given the following blogs |
| 88 | 89 | | owner | name | |
| 89 | 90 | | joaosilva | Blog One | |
| 90 | 91 | And I go to /joaosilva/blog-one |
| 91 | - When I follow "Configure blog" | |
| 92 | + When I follow "Configure blog" and wait | |
| 92 | 93 | Then I should be on edit "Blog One" by joaosilva |
| 93 | 94 | |
| 94 | 95 | Scenario: change address of blog | ... | ... |
features/browse.feature
| ... | ... | @@ -39,10 +39,9 @@ Feature: browse |
| 39 | 39 | And I should see "Invite friends" |
| 40 | 40 | And I should see "My friends" |
| 41 | 41 | |
| 42 | - @selenium | |
| 43 | 42 | Scenario: Browse people by query |
| 44 | 43 | Given I go to /browse/people |
| 45 | - When I fill in "query" with "Silva" | |
| 44 | + When I fill in "Silva" for "query" | |
| 46 | 45 | And I press "Search" |
| 47 | 46 | Then I should see "Joao Silva" |
| 48 | 47 | And I should see "Pedro Silva" |
| ... | ... | @@ -53,8 +52,8 @@ Feature: browse |
| 53 | 52 | @selenium |
| 54 | 53 | Scenario: Communities browse menu should add logged information |
| 55 | 54 | Given I am logged in as "joaosilva" |
| 56 | - And I am on the homepage | |
| 57 | - And I should not see "More Recent" | |
| 55 | + When I go to /joaosilva | |
| 56 | + Then I should not see "More Recent" | |
| 58 | 57 | And I should not see "More Active" |
| 59 | 58 | And I should not see "More Popular" |
| 60 | 59 | And I should not see "My communities" |
| ... | ... | @@ -76,14 +75,12 @@ Feature: browse |
| 76 | 75 | And I should see "More Active" |
| 77 | 76 | And I should see "More Popular" |
| 78 | 77 | |
| 79 | - @selenium | |
| 80 | 78 | Scenario: Browse communities by query |
| 81 | - Given I go to /browse/communities | |
| 82 | - When I fill in "query" with "Silva" | |
| 79 | + When I go to /browse/communities | |
| 80 | + And I fill in "Silva" for "query" | |
| 83 | 81 | And I press "Search" |
| 84 | 82 | Then I should see "Community Silva" |
| 85 | 83 | And I should not see "Joao Silva" |
| 86 | 84 | And I should not see "Pedro Silva" |
| 87 | 85 | And I should not see "Paulo Neto" |
| 88 | 86 | And I should not see "Community Neto" |
| 89 | - | ... | ... |
features/categories_block.feature
| ... | ... | @@ -61,12 +61,10 @@ Feature: categories_block |
| 61 | 61 | And I follow "Edit" within ".categories-block" |
| 62 | 62 | And I check "Product" |
| 63 | 63 | And I press "Save" |
| 64 | - Then I should see "Food" | |
| 65 | - And I should not see "Vegetarian" | |
| 66 | - And I should not see "Steak" | |
| 64 | + Then I should see "Book" | |
| 65 | + And I should not see "Literature" | |
| 67 | 66 | When I click ".category-link-expand category-root" |
| 68 | - Then I should see "Vegetarian" | |
| 69 | - And I should see "Steak" | |
| 67 | + Then I should see "Literature" | |
| 70 | 68 | |
| 71 | 69 | @selenium |
| 72 | 70 | Scenario: List just general categories | ... | ... |
features/chat.feature
| ... | ... | @@ -43,6 +43,7 @@ Feature: chat |
| 43 | 43 | Given I am on Tame's homepage |
| 44 | 44 | Then I should not see "Open chat" link |
| 45 | 45 | |
| 46 | + @selenium | |
| 46 | 47 | Scenario: not provide the chat online users list when environment not support that |
| 47 | 48 | Given I am logged in as "tame" |
| 48 | 49 | Then I should not see "Online friends " |
| ... | ... | @@ -98,6 +99,7 @@ Feature: chat |
| 98 | 99 | And the "#chat-busy" should be visible |
| 99 | 100 | And the "#chat-disconnect" should be visible |
| 100 | 101 | |
| 102 | + @selenium | |
| 101 | 103 | Scenario: link to open chatroom of a community |
| 102 | 104 | Given the following communities |
| 103 | 105 | | identifier | name | |
| ... | ... | @@ -108,6 +110,7 @@ Feature: chat |
| 108 | 110 | When I go to Autoramas's profile |
| 109 | 111 | Then I should see "Enter chat room" link |
| 110 | 112 | |
| 113 | + @selenium | |
| 111 | 114 | Scenario: not see link to open chatroom of a community if not a member |
| 112 | 115 | Given the following communities |
| 113 | 116 | | identifier | name | |
| ... | ... | @@ -117,6 +120,7 @@ Feature: chat |
| 117 | 120 | When I go to Autoramas's profile |
| 118 | 121 | Then I should not see "Enter chat room" link |
| 119 | 122 | |
| 123 | + @selenium | |
| 120 | 124 | Scenario: not see link to open chatroom of a community if xmpp_chat disabled |
| 121 | 125 | Given the following communities |
| 122 | 126 | | identifier | name | | ... | ... |
features/comment.feature
| ... | ... | @@ -18,7 +18,7 @@ Feature: comment |
| 18 | 18 | Scenario: not post a comment without javascript |
| 19 | 19 | Given I am on /booking/article-to-comment |
| 20 | 20 | And I fill in "Name" with "Joey Ramone" |
| 21 | - And I fill in "e-Mail" with "joey@ramones.com" | |
| 21 | + And I fill in "e-mail" with "joey@ramones.com" | |
| 22 | 22 | And I fill in "Title" with "Hey ho, let's go!" |
| 23 | 23 | And I fill in "Enter your comment" with "Hey ho, let's go!" |
| 24 | 24 | When I press "Post comment" |
| ... | ... | @@ -28,7 +28,7 @@ Feature: comment |
| 28 | 28 | Scenario: post a comment while not authenticated |
| 29 | 29 | Given I am on /booking/article-to-comment |
| 30 | 30 | And I fill in "Name" with "Joey Ramone" |
| 31 | - And I fill in "e-Mail" with "joey@ramones.com" | |
| 31 | + And I fill in "e-mail" with "joey@ramones.com" | |
| 32 | 32 | And I fill in "Title" with "Hey ho, let's go!" |
| 33 | 33 | And I fill in "Enter your comment" with "Hey ho, let's go!" |
| 34 | 34 | When I press "Post comment" |
| ... | ... | @@ -67,7 +67,7 @@ Feature: comment |
| 67 | 67 | Scenario: disable post comment button |
| 68 | 68 | Given I am on /booking/article-to-comment |
| 69 | 69 | And I fill in "Name" with "Joey Ramone" |
| 70 | - And I fill in "e-Mail" with "joey@ramones.com" | |
| 70 | + And I fill in "e-mail" with "joey@ramones.com" | |
| 71 | 71 | And I fill in "Title" with "Hey ho, let's go!" |
| 72 | 72 | And I fill in "Enter your comment" with "Hey ho, let's go!" |
| 73 | 73 | When I press "Post comment" | ... | ... |
features/contact.feature
| ... | ... | @@ -12,16 +12,18 @@ In order to ask questions and solve problems |
| 12 | 12 | | sample-community | Sample Community | |
| 13 | 13 | And I am logged in as "joaosilva" |
| 14 | 14 | |
| 15 | + @selenium | |
| 15 | 16 | Scenario: without states |
| 16 | 17 | Given I am on Sample Community's homepage |
| 17 | - When I follow "Send an e-mail" | |
| 18 | + When I follow "Send an e-mail" and wait | |
| 18 | 19 | Then I should not see "City and state" |
| 19 | 20 | |
| 21 | + @selenium | |
| 20 | 22 | Scenario: with states |
| 21 | 23 | Given the following states |
| 22 | 24 | | name | |
| 23 | 25 | | Bahia | |
| 24 | 26 | And I am on Sample Community's homepage |
| 25 | - When I follow "Send an e-mail" | |
| 27 | + When I follow "Send an e-mail" and wait | |
| 26 | 28 | Then I should see "City and state" |
| 27 | 29 | ... | ... |
features/edit_article.feature
| ... | ... | @@ -77,52 +77,57 @@ Feature: edit article |
| 77 | 77 | Then I should see "My Article" |
| 78 | 78 | And I should be on /joaosilva/my-article |
| 79 | 79 | |
| 80 | + @selenium | |
| 80 | 81 | Scenario: edit an article |
| 81 | 82 | Given I am on Joao Silva's sitemap |
| 82 | - And I follow "Save the whales" | |
| 83 | - And I follow "Edit" | |
| 83 | + When I follow "Save the whales" and wait | |
| 84 | + And I follow "Edit" and wait | |
| 84 | 85 | And I fill in "Title" with "My Article edited" |
| 85 | - When I press "Save" | |
| 86 | + And I press "Save" and wait | |
| 86 | 87 | Then I should be on /joaosilva/my-article-edited |
| 87 | 88 | |
| 89 | + @selenium | |
| 88 | 90 | Scenario: cancel button back to article when edit |
| 89 | 91 | Given I am on Joao Silva's sitemap |
| 90 | - And I follow "Save the whales" | |
| 91 | - And I follow "Edit" | |
| 92 | - When I follow "Cancel" within ".main-block" | |
| 92 | + When I follow "Save the whales" and wait | |
| 93 | + And I follow "Edit" and wait | |
| 94 | + And I follow "Cancel" within ".main-block" and wait | |
| 93 | 95 | Then I should be on /joaosilva/save-the-whales |
| 94 | 96 | |
| 97 | + @selenium | |
| 95 | 98 | Scenario: create an article inside a folder |
| 96 | 99 | Given I am on Joao Silva's control panel |
| 97 | - And I follow "Manage Content" | |
| 100 | + When I follow "Manage Content" | |
| 98 | 101 | And I follow "New content" |
| 99 | - And I follow "Folder" | |
| 102 | + And I follow "Folder" and wait | |
| 100 | 103 | And I fill in "Title" with "My Folder" |
| 101 | - And I press "Save" | |
| 104 | + And I press "Save" and wait | |
| 102 | 105 | Then I should be on /joaosilva/my-folder |
| 103 | 106 | When I follow "New article" |
| 104 | - And I follow "Text article with visual editor" | |
| 107 | + And I follow "Text article with visual editor" and wait | |
| 105 | 108 | And I fill in "Title" with "My Article" |
| 106 | - And I press "Save" | |
| 109 | + And I press "Save" and wait | |
| 107 | 110 | Then I should see "My Article" |
| 108 | 111 | And I should be on /joaosilva/my-folder/my-article |
| 109 | 112 | |
| 113 | + @selenium | |
| 110 | 114 | Scenario: cancel button back to folder after giving up creating |
| 111 | 115 | Given I am on Joao Silva's control panel |
| 112 | - And I follow "Manage Content" | |
| 116 | + When I follow "Manage Content" | |
| 113 | 117 | And I follow "New content" |
| 114 | - And I follow "Folder" | |
| 118 | + And I follow "Folder" and wait | |
| 115 | 119 | And I fill in "Title" with "My Folder" |
| 116 | - And I press "Save" | |
| 120 | + And I press "Save" and wait | |
| 117 | 121 | Then I should be on /joaosilva/my-folder |
| 118 | 122 | When I follow "New article" |
| 119 | - And I follow "Text article with visual editor" | |
| 120 | - When I follow "Cancel" within ".no-boxes" | |
| 121 | - And I should be on /joaosilva/my-folder | |
| 123 | + And I follow "Text article with visual editor" and wait | |
| 124 | + And I follow "Cancel" within ".no-boxes" and wait | |
| 125 | + Then I should be on /joaosilva/my-folder | |
| 122 | 126 | |
| 127 | + @selenium | |
| 123 | 128 | Scenario: save and continue |
| 124 | 129 | Given I am on /joaosilva/save-the-whales |
| 125 | - And I follow "Edit" | |
| 130 | + And I follow "Edit" and wait | |
| 126 | 131 | When I fill in "Text" with "new text" |
| 127 | 132 | And I press "Save and continue" |
| 128 | 133 | Then the "Text" field should contain "new text" |
| ... | ... | @@ -140,31 +145,33 @@ Feature: edit article |
| 140 | 145 | And the "Title" field should contain "My new article" |
| 141 | 146 | And the "Text" field should contain "text for the new article" |
| 142 | 147 | |
| 148 | + @selenium | |
| 143 | 149 | Scenario: add a translation to an article |
| 144 | 150 | Given I am on Joao Silva's sitemap |
| 145 | 151 | And I follow "Save the whales" |
| 146 | 152 | Then I should not see "Add translation" |
| 147 | - And I follow "Edit" | |
| 153 | + And I follow "Edit" and wait | |
| 148 | 154 | And I select "English" from "Language" |
| 149 | - Then I press "Save" | |
| 150 | - And I follow "Add translation" | |
| 155 | + Then I press "Save" and wait | |
| 156 | + And I follow "Add translation" and wait | |
| 151 | 157 | And I fill in "Title" with "Mi neuvo artículo" |
| 152 | 158 | And I select "Español" from "Language" |
| 153 | - When I press "Save" | |
| 159 | + When I press "Save" and wait | |
| 154 | 160 | Then I should be on /joaosilva/mi-neuvo-articulo |
| 155 | 161 | And I should see "Translations" |
| 156 | 162 | |
| 163 | + @selenium | |
| 157 | 164 | Scenario: not add a translation without a language |
| 158 | 165 | Given the following articles |
| 159 | 166 | | owner | name | language | |
| 160 | 167 | | joaosilva | Article in English | en | |
| 161 | 168 | And I am on Joao Silva's sitemap |
| 162 | - And I follow "Article in English" | |
| 163 | - And I follow "Add translation" | |
| 169 | + When I follow "Article in English" and wait | |
| 170 | + And I follow "Add translation" and wait | |
| 164 | 171 | And I fill in "Title" with "Article in Portuguese" |
| 165 | - When I press "Save" | |
| 172 | + And I press "Save" and wait | |
| 166 | 173 | Then I should see "Language must be choosen" |
| 167 | - And I select "Português" from "Language" | |
| 168 | - When I press "Save" | |
| 174 | + When I select "Português" from "Language" | |
| 175 | + And I press "Save" and wait | |
| 169 | 176 | Then I should not see "Language must be choosen" |
| 170 | 177 | And I should be on /joaosilva/article-in-portuguese | ... | ... |
features/edit_block_of_links.feature
| ... | ... | @@ -14,9 +14,9 @@ Feature: edit_block_of_links |
| 14 | 14 | |
| 15 | 15 | @selenium |
| 16 | 16 | Scenario: show the icon selector |
| 17 | - And I follow "Edit sideboxes" | |
| 18 | - Given I follow "Edit" within ".link-list-block" | |
| 19 | - And I follow "New link" | |
| 20 | - And the ".icon-selector" should not be visible | |
| 17 | + Given I follow "Edit sideboxes" | |
| 18 | + And I follow "Edit" within ".link-list-block" | |
| 19 | + When I follow "New link" | |
| 20 | + Then the "css=div.icon-selector" should not be visible | |
| 21 | 21 | When I click ".icon" |
| 22 | - Then the ".icon-selector" should be visible | |
| 22 | + Then the "css=div.icon-selector" should be visible | ... | ... |
features/events.feature
| ... | ... | @@ -175,15 +175,16 @@ Feature: events |
| 175 | 175 | When I am on /assets/events |
| 176 | 176 | Then I should see "Colivre.net's events" |
| 177 | 177 | |
| 178 | + @selenium | |
| 178 | 179 | Scenario: published events should be listed in the agenda too |
| 179 | 180 | Given the following community |
| 180 | 181 | | identifier | name | |
| 181 | 182 | | sample-community | Sample Community | |
| 182 | 183 | And I am logged in as "josesilva" |
| 183 | 184 | And "josesilva" is a member of "Sample Community" |
| 184 | - And I am on josesilva's control panel | |
| 185 | - And I follow "Manage content" | |
| 186 | - And I follow "Another Conference" | |
| 185 | + And I go to josesilva's control panel | |
| 186 | + And I follow "Manage Content" | |
| 187 | + And I follow "Another Conference" and wait | |
| 187 | 188 | And I follow "Spread" |
| 188 | 189 | And I check "Sample Community" |
| 189 | 190 | And I press "Spread this" |
| ... | ... | @@ -212,19 +213,18 @@ Feature: events |
| 212 | 213 | And I am on josesilva's Event creation |
| 213 | 214 | Then I should see "Lead" |
| 214 | 215 | |
| 216 | + @selenium | |
| 215 | 217 | Scenario: events lead should be shown on blogs with short format |
| 216 | 218 | Given I am logged in as "josesilva" |
| 217 | 219 | And I am on josesilva's control panel |
| 218 | - And I follow "Configure blog" | |
| 220 | + And I follow "Configure blog" and wait | |
| 219 | 221 | And I select "First paragraph" from "How to display posts:" |
| 220 | 222 | And I press "Save" |
| 221 | 223 | And I follow "New post" |
| 222 | - And I follow "Event" | |
| 223 | - And I follow "Lead" | |
| 224 | - And I fill in the following: | |
| 225 | - | Title | Leaded event | | |
| 226 | - | Information about the event | This is the real text.| | |
| 227 | - | Lead | This is the abstract. | | |
| 224 | + And I follow "A calendar event" and wait | |
| 225 | + And I fill in "Title" with "Leaded event" | |
| 226 | + And I type "This is the abstract." in TinyMCE field "article_abstract" | |
| 227 | + And I type "This is the real text." in TinyMCE field "article_body" | |
| 228 | 228 | And I press "Save" |
| 229 | 229 | When I am on josesilva's blog |
| 230 | 230 | Then I should see "Leaded event" | ... | ... |
features/forum.feature
| ... | ... | @@ -10,13 +10,14 @@ Feature: forum |
| 10 | 10 | And "joaosilva" has no articles |
| 11 | 11 | And I am logged in as "joaosilva" |
| 12 | 12 | |
| 13 | + @selenium | |
| 13 | 14 | Scenario: create a forum |
| 14 | - Given I go to the Control panel | |
| 15 | + Given I am on Joao Silva's control panel | |
| 15 | 16 | And I follow "Manage Content" |
| 16 | 17 | And I follow "New content" |
| 17 | - When I follow "Forum" | |
| 18 | + When I follow "Forum" and wait | |
| 18 | 19 | And I fill in "Title" with "My Forum" |
| 19 | - And I press "Save" | |
| 20 | + And I press "Save" and wait | |
| 20 | 21 | Then I should see "Configure forum" |
| 21 | 22 | |
| 22 | 23 | Scenario: redirect to forum after create forum from cms |
| ... | ... | @@ -60,12 +61,13 @@ Feature: forum |
| 60 | 61 | When I follow "Cancel" within ".main-block" |
| 61 | 62 | Then I should be on /myprofile/joaosilva/cms |
| 62 | 63 | |
| 64 | + @selenium | |
| 63 | 65 | Scenario: configure forum when viewing it |
| 64 | 66 | Given the following forums |
| 65 | - | owner | name | | |
| 67 | + | owner | name | | |
| 66 | 68 | | joaosilva | Forum One | |
| 67 | - And I go to /joaosilva/forum-one | |
| 68 | - When I follow "Configure forum" | |
| 69 | + And I visit "/joaosilva/forum-one" and wait | |
| 70 | + When I follow "Configure forum" and wait | |
| 69 | 71 | Then I should be on edit "Forum One" by joaosilva |
| 70 | 72 | |
| 71 | 73 | Scenario: last topic update by unautenticated user should not link | ... | ... |
features/gallery_navigation.feature
| ... | ... | @@ -7,20 +7,23 @@ Feature: gallery_navigation |
| 7 | 7 | | login | |
| 8 | 8 | | marciopunk | |
| 9 | 9 | And the following galleries |
| 10 | - | owner | name | | |
| 11 | - | marciopunk | my-gallery | | |
| 10 | + | owner | name | | |
| 11 | + | marciopunk | my-gallery | | |
| 12 | + | marciopunk | other-gallery | | |
| 12 | 13 | And the following files |
| 13 | - | owner | file | mime | parent | | |
| 14 | - | marciopunk | rails.png | image/png | my-gallery | | |
| 15 | - | marciopunk | other-pic.jpg | image/jpeg | my-gallery | | |
| 14 | + | owner | file | mime | parent | | |
| 15 | + | marciopunk | rails.png | image/png | my-gallery | | |
| 16 | + | marciopunk | rails.png | image/png | other-gallery | | |
| 17 | + | marciopunk | other-pic.jpg | image/jpeg | my-gallery | | |
| 16 | 18 | |
| 17 | 19 | Scenario: provide link to go to next image |
| 18 | 20 | Given I am on /marciopunk/my-gallery/other-pic.jpg?view=true |
| 19 | 21 | Then I should see "Next »" |
| 20 | 22 | |
| 23 | + @selenium | |
| 21 | 24 | Scenario: view next image when follow next link |
| 22 | 25 | Given I am on /marciopunk/my-gallery/other-pic.jpg?view=true |
| 23 | - When I follow "Next »" | |
| 26 | + When I follow "Next »" and wait | |
| 24 | 27 | Then I should see "rails.png" within ".title" |
| 25 | 28 | |
| 26 | 29 | Scenario: not link to next when in last image |
| ... | ... | @@ -32,9 +35,10 @@ Feature: gallery_navigation |
| 32 | 35 | Given I am on /marciopunk/my-gallery/other-pic.jpg?view=true |
| 33 | 36 | Then I should see "« Previous" |
| 34 | 37 | |
| 38 | + @selenium | |
| 35 | 39 | Scenario: view previous image when follow previous link |
| 36 | 40 | Given I am on /marciopunk/my-gallery/rails.png?view=true |
| 37 | - When I follow "« Previous" | |
| 41 | + When I follow "« Previous" and wait | |
| 38 | 42 | Then I should see "other-pic.jpg" within ".title" |
| 39 | 43 | |
| 40 | 44 | Scenario: not link to previous when in first image |
| ... | ... | @@ -64,11 +68,11 @@ Feature: gallery_navigation |
| 64 | 68 | When I follow "Go back to my-gallery" |
| 65 | 69 | Then I should be on /marciopunk/my-gallery |
| 66 | 70 | |
| 71 | + @selenium | |
| 67 | 72 | Scenario: image title in window title |
| 68 | 73 | Given I am logged in as "marciopunk" |
| 69 | - And I go to /marciopunk/my-gallery/rails.png?view=true | |
| 70 | - When I follow "Edit" | |
| 74 | + When I visit "/marciopunk/other-gallery/rails.png?view=true" and wait | |
| 75 | + And I follow "Edit" and wait | |
| 71 | 76 | And I fill in "Title" with "Rails is cool" |
| 72 | - And I press "Save" | |
| 73 | - And I go to /marciopunk/my-gallery/rails.png?view=true | |
| 74 | - And The page title should contain "Rails is cool" | |
| 77 | + And I press "Save" and wait | |
| 78 | + Then The page title should contain "Rails is cool" | ... | ... |
features/manage_inputs.feature
| ... | ... | @@ -57,8 +57,8 @@ Feature: manage inputs |
| 57 | 57 | Given I am logged in as "joaosilva" |
| 58 | 58 | When I go to Rede Moinho's page of product Abbey Road |
| 59 | 59 | And I follow "Inputs" |
| 60 | - And I follow "Add the inputs or raw material used by this product" | |
| 61 | - When I follow "Cancel" | |
| 60 | + And I follow "Add the inputs or raw material used by this product" and wait until "#input-category-form" is present | |
| 61 | + And I click "css=a.cancel-add-input" | |
| 62 | 62 | Then I should see "Abbey Road" |
| 63 | 63 | And I should see "Add the inputs or raw material used by this product" |
| 64 | 64 | |
| ... | ... | @@ -182,12 +182,12 @@ Feature: manage inputs |
| 182 | 182 | And I am logged in as "joaosilva" |
| 183 | 183 | When I go to Rede Moinho's page of product Abbey Road |
| 184 | 184 | And I follow "Inputs" |
| 185 | - And I follow "Click here to add price and the amount used" | |
| 185 | + And I follow "Click here to add price and the amount used" and wait until ".input-details-form" is present | |
| 186 | 186 | Then I should see "Cancel" |
| 187 | 187 | And I should see "Amount used" |
| 188 | 188 | And I should see "Price" |
| 189 | 189 | And I should see "This input or raw material inpact on the final price of the product?" |
| 190 | - When I follow "Cancel" | |
| 190 | + When I click "css=a.cancel-edit-input" | |
| 191 | 191 | Then I should see "Click here to add price and the amount used" |
| 192 | 192 | |
| 193 | 193 | @selenium |
| ... | ... | @@ -215,6 +215,7 @@ Feature: manage inputs |
| 215 | 215 | Then I should see "Rock" |
| 216 | 216 | And I should not see "Add the inputs or raw material used by this product" |
| 217 | 217 | When I follow "Remove" |
| 218 | + And I confirm | |
| 218 | 219 | Then I should see "Add the inputs or raw material used by this product" |
| 219 | 220 | |
| 220 | 221 | @selenium | ... | ... |
features/manage_products.feature
| ... | ... | @@ -133,7 +133,7 @@ Feature: manage products |
| 133 | 133 | And I am on Rede Moinho's control panel |
| 134 | 134 | And I follow "Manage Products and Services" |
| 135 | 135 | When I follow "New product or service" |
| 136 | - And I select "Toplevel Product ... »" and wait for jquery | |
| 136 | + And I select "Toplevel Product Categories »" and wait for jquery | |
| 137 | 137 | And I select "Category Level 1" and wait for jquery |
| 138 | 138 | Then I should see "Toplevel Product Categories" link |
| 139 | 139 | And I should not see "Category Level 1" link |
| ... | ... | @@ -149,14 +149,14 @@ Feature: manage products |
| 149 | 149 | |
| 150 | 150 | @selenium |
| 151 | 151 | Scenario: enable save button when select one category |
| 152 | - Given the following product_category | |
| 152 | + Given I am logged in as "joaosilva" | |
| 153 | + And the following product_category | |
| 153 | 154 | | name | |
| 154 | 155 | | Browsers (accept categories) | |
| 155 | - Given I am logged in as "joaosilva" | |
| 156 | 156 | And I am on Rede Moinho's control panel |
| 157 | 157 | And I follow "Manage Products and Services" |
| 158 | 158 | When I follow "New product or service" |
| 159 | - And I select "Browsers (accept ..." and wait for jquery | |
| 159 | + And I select "Browsers (accept categories)" and wait for jquery | |
| 160 | 160 | Then the "Save and continue" button should be enabled |
| 161 | 161 | |
| 162 | 162 | @selenium |
| ... | ... | @@ -290,7 +290,7 @@ Feature: manage products |
| 290 | 290 | And I am logged in as "joaosilva" |
| 291 | 291 | When I go to Rede Moinho's page of product Bike |
| 292 | 292 | And I follow "Edit name" |
| 293 | - And I fill in "product_name" with "Red bicycle" | |
| 293 | + And I fill in "Red bicycle" for "product_name" | |
| 294 | 294 | And I press "Save" |
| 295 | 295 | Then I should see "Red bicycle" |
| 296 | 296 | And I should be on Rede Moinho's page of product Red bicycle |
| ... | ... | @@ -453,7 +453,7 @@ Feature: manage products |
| 453 | 453 | | Nanonote nanotech with long long name | |
| 454 | 454 | And the following product_category |
| 455 | 455 | | name | parent | |
| 456 | - | Netbook Quantum | Super Quantum Computers | | |
| 456 | + | Netbook Quantum | Super Quantum Computers with teraflops | | |
| 457 | 457 | And I am logged in as "joaosilva" |
| 458 | 458 | When I go to Rede Moinho's new product page |
| 459 | 459 | Then I should see "Nanonote nanotech with long lo..." |
| ... | ... | @@ -473,7 +473,7 @@ Feature: manage products |
| 473 | 473 | And I am logged in as "joaosilva" |
| 474 | 474 | When I go to Rede Moinho's page of product Bike |
| 475 | 475 | And I follow "Edit name and unit" |
| 476 | - And I fill in "product_name" with "Red bicycle" | |
| 476 | + And I fill in "Red bicycle" for "product_name" | |
| 477 | 477 | And I select "Kilo" |
| 478 | 478 | And I press "Save" |
| 479 | 479 | Then I should see "Red bicycle - kilo" |
| ... | ... | @@ -489,7 +489,7 @@ Feature: manage products |
| 489 | 489 | And I am logged in as "joaosilva" |
| 490 | 490 | When I go to Rede Moinho's page of product Bike |
| 491 | 491 | And I follow "Add price and other basic information" |
| 492 | - And I fill in "product_price" with "10" | |
| 492 | + And I fill in "10" for "product_price" | |
| 493 | 493 | And I choose "No" |
| 494 | 494 | And I press "Save" |
| 495 | 495 | Then I should see "Product not available!" | ... | ... |
features/my_network_block.feature
| ... | ... | @@ -13,30 +13,32 @@ Feature: my_network_block |
| 13 | 13 | | identifier | name | public_profile | |
| 14 | 14 | | public-community | Public Community | true | |
| 15 | 15 | |
| 16 | + @selenium | |
| 16 | 17 | Scenario: display how many public/private communities I am member |
| 17 | - Given the following communities | |
| 18 | + Given I am logged in as "joaosilva" | |
| 19 | + And the following communities | |
| 18 | 20 | | identifier | name | owner | public_profile | |
| 19 | 21 | | other-public-community | Other Public Community | joaosilva | true | |
| 20 | 22 | | private-community | Private Community | joaosilva | false | |
| 21 | - And I am logged in as "joaosilva" | |
| 22 | 23 | And I am on Joao Silva's homepage |
| 23 | - Then I should see "2 communities" | |
| 24 | + And I should see "2 communities" | |
| 24 | 25 | When I go to Public Community's homepage |
| 25 | 26 | And I follow "Join" |
| 26 | - When I go to Joao Silva's homepage | |
| 27 | + And I go to Joao Silva's homepage | |
| 27 | 28 | Then I should see "3 communities" |
| 28 | 29 | |
| 30 | + @selenium | |
| 29 | 31 | Scenario: not display how many invisible communities I am member |
| 30 | - Given the following communities | |
| 32 | + Given I am logged in as "joaosilva" | |
| 33 | + And the following communities | |
| 31 | 34 | | identifier | name | owner | visible | |
| 32 | 35 | | visible-community | Visible Community | joaosilva | true | |
| 33 | 36 | | not-visible-community | Not Visible Community | joaosilva | false | |
| 34 | - And I am logged in as "joaosilva" | |
| 35 | 37 | And I am on Joao Silva's homepage |
| 36 | - Then I should see "One community" | |
| 38 | + And I should see "One community" | |
| 37 | 39 | When I go to Public Community's homepage |
| 38 | 40 | And I follow "Join" |
| 39 | - When I go to Joao Silva's homepage | |
| 41 | + And I go to Joao Silva's homepage | |
| 40 | 42 | Then I should see "2 communities" |
| 41 | 43 | |
| 42 | 44 | Scenario: display how many public/private friends I have | ... | ... |
features/publish_article.feature
| ... | ... | @@ -42,11 +42,12 @@ Feature: publish article |
| 42 | 42 | Then I should see "Another name" |
| 43 | 43 | And I should not see "Sample Article" |
| 44 | 44 | |
| 45 | + @selenium | |
| 45 | 46 | Scenario: getting an error message when publishing article with same name |
| 46 | 47 | Given I am logged in as "joaosilva" |
| 47 | 48 | And "Joao Silva" is a member of "Sample Community" |
| 48 | 49 | And I am on Joao Silva's control panel |
| 49 | - And I follow "Manage Content" | |
| 50 | + And I follow "Manage Content" and wait | |
| 50 | 51 | And I follow "Spread" |
| 51 | 52 | And I check "Sample Community" |
| 52 | 53 | And I press "Spread this" |
| ... | ... | @@ -56,11 +57,11 @@ Feature: publish article |
| 56 | 57 | And I am on Maria Silva's control panel |
| 57 | 58 | And I follow "Manage Content" |
| 58 | 59 | And I follow "New content" |
| 59 | - And I follow "Text article with Textile markup language" | |
| 60 | + And I follow "Text article with Textile markup language" and wait | |
| 60 | 61 | And I fill in the following: |
| 61 | 62 | | Title | Sample Article | |
| 62 | 63 | | Text | this is Maria's first published article | |
| 63 | - And I press "Save" | |
| 64 | + And I press "Save" and wait | |
| 64 | 65 | And I follow "Spread" |
| 65 | 66 | And I check "Sample Community" |
| 66 | 67 | When I press "Spread this" | ... | ... |
features/step_definitions/custom_webrat_steps.rb
| 1 | 1 | When /^I should see "([^\"]+)" link$/ do |text| |
| 2 | - response.should have_selector("a:contains('#{text}')") | |
| 2 | + if response.class.to_s == 'Webrat::SeleniumResponse' | |
| 3 | + response.selenium.is_element_present("css=a:contains('#{text}')") | |
| 4 | + else | |
| 5 | + response.should have_selector("a:contains('#{text}')") | |
| 6 | + end | |
| 3 | 7 | end |
| 4 | 8 | |
| 5 | 9 | When /^I should not see "([^\"]+)" link$/ do |text| | ... | ... |
features/step_definitions/noosfero_steps.rb
| ... | ... | @@ -294,7 +294,11 @@ Given /^(.+) is disabled$/ do |enterprise_name| |
| 294 | 294 | end |
| 295 | 295 | |
| 296 | 296 | Then /^The page title should contain "(.*)"$/ do |text| |
| 297 | - response.should have_selector("title:contains('#{text}')") | |
| 297 | + if response.class.to_s == 'Webrat::SeleniumResponse' | |
| 298 | + response.selenium.text('css=title').should include(text) | |
| 299 | + else | |
| 300 | + response.should have_selector("title:contains('#{text}')") | |
| 301 | + end | |
| 298 | 302 | end |
| 299 | 303 | |
| 300 | 304 | Given /^the mailbox is empty$/ do | ... | ... |
features/step_definitions/selenium_steps.rb
| ... | ... | @@ -85,6 +85,24 @@ Then /^"([^\"]*)" should be (left|right) aligned$/ do |element_class, align| |
| 85 | 85 | response.selenium.get_xpath_count("//*[contains(@class,'#{element_class}') and contains(@style,'float: #{align}')]").to_i.should be(1) |
| 86 | 86 | end |
| 87 | 87 | |
| 88 | +When /^I confirm$/ do | |
| 89 | + selenium.get_confirmation | |
| 90 | +end | |
| 91 | + | |
| 92 | +When /^I type "([^\"]*)" in TinyMCE field "([^\"]*)"$/ do |value, field_id| | |
| 93 | + response.selenium.type("dom=document.getElementById('#{field_id}_ifr').contentDocument.body", value) | |
| 94 | +end | |
| 95 | + | |
| 96 | +When /^I answer the captcha$/ do | |
| 97 | + question = response.selenium.get_text("//label[@for='task_captcha_solution']").match(/What is the result of '(.+) = \?'/)[1] | |
| 98 | + answer = eval(question) | |
| 99 | + response.selenium.type("id=task_captcha_solution", answer) | |
| 100 | +end | |
| 101 | + | |
| 102 | +When /^I refresh the page$/ do | |
| 103 | + response.selenium.refresh | |
| 104 | +end | |
| 105 | + | |
| 88 | 106 | #### Noosfero specific steps #### |
| 89 | 107 | |
| 90 | 108 | Then /^the select for category "([^\"]*)" should be visible$/ do |name| | ... | ... |
features/step_definitions/webrat_steps.rb
| ... | ... | @@ -16,20 +16,49 @@ When /^I go to (.+)$/ do |page_name| |
| 16 | 16 | visit path_to(page_name) |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | +When /^I visit "([^\"]*)" and wait$/ do |page_name| | |
| 20 | + visit path_to(page_name) | |
| 21 | + selenium.wait_for_page_to_load(10000) | |
| 22 | +end | |
| 23 | + | |
| 19 | 24 | When /^I press "([^\"]*)"$/ do |button| |
| 20 | 25 | click_button(button) |
| 21 | 26 | end |
| 22 | 27 | |
| 28 | +When /^I press "([^\"]*)" and wait$/ do |button| | |
| 29 | + click_button(button) | |
| 30 | + selenium.wait_for_page_to_load(10000) | |
| 31 | +end | |
| 32 | + | |
| 23 | 33 | When /^I follow "([^\"]*)"$/ do |link| |
| 24 | 34 | click_link(link) |
| 25 | 35 | end |
| 26 | 36 | |
| 37 | +When /^I follow "([^\"]*)" and wait$/ do |link| | |
| 38 | + click_link(link) | |
| 39 | + selenium.wait_for_page_to_load(10000) | |
| 40 | +end | |
| 41 | + | |
| 42 | +When /^I follow "([^\"]*)" and wait until "([^\"]*)" is present$/ do |link, element| | |
| 43 | + click_link(link) | |
| 44 | + selenium.wait_for_element(string_to_element_locator(element)) | |
| 45 | +end | |
| 46 | + | |
| 27 | 47 | When /^I follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent| |
| 28 | 48 | click_link_within(parent, link) |
| 29 | 49 | end |
| 30 | 50 | |
| 51 | +When /^I follow "([^\"]*)" within "([^\"]*)" and wait$/ do |link, parent| | |
| 52 | + click_link_within(parent, link) | |
| 53 | + selenium.wait_for_page_to_load(10000) | |
| 54 | +end | |
| 55 | + | |
| 31 | 56 | When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value| |
| 32 | - fill_in(field, :with => value) | |
| 57 | + if response.class.to_s == 'Webrat::SeleniumResponse' | |
| 58 | + response.selenium.type("//*[@id=//label[contains(., '#{field}')]/@for]", value) | |
| 59 | + else | |
| 60 | + fill_in(field, :with => value) | |
| 61 | + end | |
| 33 | 62 | end |
| 34 | 63 | |
| 35 | 64 | When /^I fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field| |
| ... | ... | @@ -54,7 +83,11 @@ When /^I fill in the following:$/ do |fields| |
| 54 | 83 | end |
| 55 | 84 | |
| 56 | 85 | When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field| |
| 57 | - select(value, :from => field) | |
| 86 | + if response.class.to_s == 'Webrat::SeleniumResponse' | |
| 87 | + response.selenium.select("//*[@id=//label[contains(., '#{field}')]/@for]", value) | |
| 88 | + else | |
| 89 | + select(value, :from => field) | |
| 90 | + end | |
| 58 | 91 | end |
| 59 | 92 | |
| 60 | 93 | # Use this step in conjunction with Rail's datetime_select helper. For example: |
| ... | ... | @@ -173,7 +206,11 @@ Then /^I should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector| |
| 173 | 206 | end |
| 174 | 207 | |
| 175 | 208 | Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value| |
| 176 | - field_labeled(field).value.should =~ /#{value}/ | |
| 209 | + if response.class.to_s == 'Webrat::SeleniumResponse' | |
| 210 | + response.selenium.get_value("//*[@id=//label[contains(., '#{field}')]/@for]").should match(value) | |
| 211 | + else | |
| 212 | + field_labeled(field).value.should =~ /#{value}/ | |
| 213 | + end | |
| 177 | 214 | end |
| 178 | 215 | |
| 179 | 216 | Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value| |
| ... | ... | @@ -189,7 +226,11 @@ Then /^the "([^\"]*)" checkbox should not be checked$/ do |label| |
| 189 | 226 | end |
| 190 | 227 | |
| 191 | 228 | Then /^I should be on (.+)$/ do |page_name| |
| 192 | - URI.parse(current_url).path.should == path_to(page_name) | |
| 229 | + if response.class.to_s == 'Webrat::SeleniumResponse' | |
| 230 | + URI.parse(response.selenium.get_location).path.should == path_to(page_name) | |
| 231 | + else | |
| 232 | + URI.parse(current_url).path.should == path_to(page_name) | |
| 233 | + end | |
| 193 | 234 | end |
| 194 | 235 | |
| 195 | 236 | Then /^show me the page$/ do | ... | ... |
features/suggest_article.feature
| ... | ... | @@ -22,23 +22,25 @@ Feature: suggest article |
| 22 | 22 | And I should see "suggested the publication of the article" |
| 23 | 23 | Then I should see "Highlight this article" within ".task_box" |
| 24 | 24 | |
| 25 | + @selenium | |
| 25 | 26 | Scenario: an article is suggested and the admin approve it |
| 26 | 27 | Given I am on Sample Community's blog |
| 27 | - And I follow "Suggest an article" | |
| 28 | - And I fill in the following: | |
| 29 | - | Title | Suggestion | | |
| 30 | - | Your name | Some Guy | | |
| 31 | - | Email | someguy@somewhere.com | | |
| 32 | - | Lead | This is my suggestion's lead | | |
| 33 | - | Text | I like free software | | |
| 28 | + And I follow "Suggest an article" and wait | |
| 29 | + And I fill in "Title" with "Suggestion" | |
| 30 | + And I fill in "Your name" with "Some Guy" | |
| 31 | + And I fill in "Email" with "someguy@somewhere.com" | |
| 32 | + And I type "This is my suggestion's lead" in TinyMCE field "task_article_abstract" | |
| 33 | + And I type "I like free software" in TinyMCE field "task_article_body" | |
| 34 | + And I answer the captcha | |
| 34 | 35 | And I press "Save" |
| 35 | 36 | And I am logged in as "joaosilva" |
| 36 | 37 | And I go to Sample Community's control panel |
| 37 | - When I follow "Process requests" | |
| 38 | + When I follow "Process requests" and wait | |
| 38 | 39 | Then I should see "suggested the publication of the article: Suggestion." |
| 39 | 40 | When I choose "Accept" |
| 40 | 41 | And I select "sample-community/Blog" from "Select the folder where the article must be published" |
| 41 | 42 | And I press "Apply!" |
| 42 | 43 | And I go to Sample Community's blog |
| 44 | + And I refresh the page | |
| 43 | 45 | Then I should see "Suggestion" |
| 44 | 46 | Then I should see "I like free software" | ... | ... |
features/support/selenium.rb
lib/noosfero.rb
| ... | ... | @@ -66,7 +66,7 @@ module Noosfero |
| 66 | 66 | if ENV['RAILS_ENV'] == 'development' |
| 67 | 67 | development_url_options |
| 68 | 68 | elsif ENV['RAILS_ENV'] == 'cucumber' |
| 69 | - {:host => ''} | |
| 69 | + Webrat.configuration.mode == :rails ? { :host => '' } : { :port => Webrat.configuration.application_port } | |
| 70 | 70 | else |
| 71 | 71 | {} |
| 72 | 72 | end |
| ... | ... | @@ -76,7 +76,6 @@ module Noosfero |
| 76 | 76 | @development_url_options || {} |
| 77 | 77 | end |
| 78 | 78 | |
| 79 | - | |
| 80 | 79 | end |
| 81 | 80 | |
| 82 | 81 | require 'noosfero/constants' | ... | ... |
test/functional/content_viewer_controller_test.rb
| ... | ... | @@ -358,42 +358,42 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 358 | 358 | assert_equal profile, assigns(:profile) |
| 359 | 359 | end |
| 360 | 360 | |
| 361 | - should 'give link to edit the article for owner ' do | |
| 361 | + should 'give link to edit the article for owner' do | |
| 362 | 362 | login_as('testinguser') |
| 363 | - get :view_page, :profile => 'testinguser', :page => [] | |
| 364 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } } | |
| 363 | + xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true | |
| 364 | + assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } } | |
| 365 | 365 | end |
| 366 | 366 | should 'not give link to edit the article for non-logged-in people' do |
| 367 | - get :view_page, :profile => 'testinguser', :page => [] | |
| 368 | - assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } } | |
| 367 | + xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true | |
| 368 | + assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } } | |
| 369 | 369 | end |
| 370 | 370 | should 'not give link to edit article for other people' do |
| 371 | 371 | login_as(create_user('anotheruser').login) |
| 372 | 372 | |
| 373 | - get :view_page, :profile => 'testinguser', :page => [] | |
| 374 | - assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } } | |
| 373 | + xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true | |
| 374 | + assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{@profile.home_page.id}" } } | |
| 375 | 375 | end |
| 376 | 376 | |
| 377 | 377 | should 'give link to create new article' do |
| 378 | 378 | login_as('testinguser') |
| 379 | - get :view_page, :profile => 'testinguser', :page => [] | |
| 380 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } } | |
| 379 | + xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true | |
| 380 | + assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } } | |
| 381 | 381 | end |
| 382 | 382 | should 'give no link to create new article for non-logged in people ' do |
| 383 | - get :view_page, :profile => 'testinguser', :page => [] | |
| 384 | - assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } } | |
| 383 | + xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true | |
| 384 | + assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } } | |
| 385 | 385 | end |
| 386 | 386 | should 'give no link to create new article for other people' do |
| 387 | 387 | login_as(create_user('anotheruser').login) |
| 388 | - get :view_page, :profile => 'testinguser', :page => [] | |
| 389 | - assert_no_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } } | |
| 388 | + xhr :get, :view_page, :profile => 'testinguser', :page => [], :toolbar => true | |
| 389 | + assert_no_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new" } } | |
| 390 | 390 | end |
| 391 | 391 | |
| 392 | 392 | should 'give link to create new article inside folder' do |
| 393 | 393 | login_as('testinguser') |
| 394 | 394 | folder = Folder.create!(:name => 'myfolder', :profile => @profile) |
| 395 | - get :view_page, :profile => 'testinguser', :page => [ 'myfolder' ] | |
| 396 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } } | |
| 395 | + xhr :get, :view_page, :profile => 'testinguser', :page => [ 'myfolder' ], :toolbar => true | |
| 396 | + assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } } | |
| 397 | 397 | end |
| 398 | 398 | |
| 399 | 399 | should 'not give access to private articles if logged off' do |
| ... | ... | @@ -468,7 +468,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 468 | 468 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
| 469 | 469 | login_as(profile.identifier) |
| 470 | 470 | |
| 471 | - get :view_page, :profile => profile.identifier, :page => ['myarticle'] | |
| 471 | + xhr :get, :view_page, :profile => profile.identifier, :page => ['myarticle'], :toolbar => true | |
| 472 | 472 | |
| 473 | 473 | assert_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + profile.identifier + '/cms/publish/' + page.id.to_s)} |
| 474 | 474 | end |
| ... | ... | @@ -501,7 +501,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 501 | 501 | prof.affiliate(profile, Profile::Roles.all_roles(prof.environment.id)) |
| 502 | 502 | login_as(profile.identifier) |
| 503 | 503 | |
| 504 | - get :view_page, :profile => prof.identifier, :page => ['myarticle'] | |
| 504 | + xhr :get, :view_page, :profile => prof.identifier, :page => ['myarticle'], :toolbar => true | |
| 505 | 505 | |
| 506 | 506 | assert_no_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + prof.identifier + '/cms/publish/' + page.id.to_s)} |
| 507 | 507 | end |
| ... | ... | @@ -662,15 +662,15 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 662 | 662 | login_as('testinguser') |
| 663 | 663 | folder = Folder.create!(:name => 'myfolder', :profile => @profile) |
| 664 | 664 | folder.children << TextileArticle.new(:name => 'children-article', :profile => @profile) |
| 665 | - get :view_page, :profile => 'testinguser', :page => [ 'myfolder', 'children-article' ] | |
| 666 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } } | |
| 665 | + xhr :get, :view_page, :profile => 'testinguser', :page => [ 'myfolder', 'children-article' ], :toolbar => true | |
| 666 | + assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } } | |
| 667 | 667 | end |
| 668 | 668 | |
| 669 | 669 | should "display 'New article' when create children of folder" do |
| 670 | 670 | login_as(profile.identifier) |
| 671 | 671 | a = Folder.new(:name => 'article folder'); profile.articles << a; a.save! |
| 672 | 672 | Article.stubs(:short_description).returns('bli') |
| 673 | - get :view_page, :profile => profile.identifier, :page => [a.path] | |
| 673 | + xhr :get, :view_page, :profile => profile.identifier, :page => [a.path], :toolbar => true | |
| 674 | 674 | assert_tag :tag => 'a', :content => 'New article' |
| 675 | 675 | end |
| 676 | 676 | |
| ... | ... | @@ -678,7 +678,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 678 | 678 | login_as(profile.identifier) |
| 679 | 679 | a = Blog.create!(:name => 'article folder', :profile => profile) |
| 680 | 680 | Article.stubs(:short_description).returns('bli') |
| 681 | - get :view_page, :profile => profile.identifier, :page => [a.path] | |
| 681 | + xhr :get, :view_page, :profile => profile.identifier, :page => [a.path], :toolbar => true | |
| 682 | 682 | assert_tag :tag => 'a', :content => 'New post' |
| 683 | 683 | end |
| 684 | 684 | |
| ... | ... | @@ -687,21 +687,21 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 687 | 687 | a = Blog.create!(:name => 'article folder', :profile => profile) |
| 688 | 688 | Article.stubs(:short_description).returns('bli') |
| 689 | 689 | t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile) |
| 690 | - get :view_page, :profile => profile.identifier, :page => [t.path] | |
| 690 | + xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true | |
| 691 | 691 | assert_tag :tag => 'a', :content => 'New post' |
| 692 | 692 | end |
| 693 | 693 | |
| 694 | 694 | should 'display button to remove article' do |
| 695 | 695 | login_as(profile.identifier) |
| 696 | 696 | t = TextileArticle.create!(:name => 'article to destroy', :profile => profile) |
| 697 | - get :view_page, :profile => profile.identifier, :page => [t.path] | |
| 697 | + xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true | |
| 698 | 698 | assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"} |
| 699 | 699 | end |
| 700 | 700 | |
| 701 | 701 | should 'not display delete button for homepage' do |
| 702 | 702 | login_as(profile.identifier) |
| 703 | 703 | page = profile.home_page |
| 704 | - get :view_page, :profile => profile.identifier, :page => page.explode_path | |
| 704 | + xhr :get, :view_page, :profile => profile.identifier, :page => page.explode_path, :toolbar => true | |
| 705 | 705 | assert_no_tag :tag => 'a', :content => 'Delete', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/destroy/#{page.id}" } |
| 706 | 706 | end |
| 707 | 707 | |
| ... | ... | @@ -746,7 +746,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 746 | 746 | should "display 'Upload files' when create children of image gallery" do |
| 747 | 747 | login_as(profile.identifier) |
| 748 | 748 | f = Gallery.create!(:name => 'gallery', :profile => profile) |
| 749 | - get :view_page, :profile => profile.identifier, :page => f.explode_path | |
| 749 | + xhr :get, :view_page, :profile => profile.identifier, :page => f.explode_path, :toolbar => true | |
| 750 | 750 | assert_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{f.id}/} |
| 751 | 751 | end |
| 752 | 752 | |
| ... | ... | @@ -755,7 +755,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 755 | 755 | folder1 = Gallery.create!(:name => 'gallery1', :profile => profile) |
| 756 | 756 | folder1.children << folder2 = Folder.new(:name => 'gallery2', :profile => profile) |
| 757 | 757 | |
| 758 | - get :view_page, :profile => profile.identifier, :page => folder2.explode_path | |
| 758 | + xhr :get, :view_page, :profile => profile.identifier, :page => folder2.explode_path, :toolbar => true | |
| 759 | 759 | assert_tag :tag => 'a', :content => 'New article', :attributes => {:href =>/parent_id=#{folder2.id}/} |
| 760 | 760 | end |
| 761 | 761 | |
| ... | ... | @@ -763,7 +763,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 763 | 763 | login_as(profile.identifier) |
| 764 | 764 | folder = Gallery.create!(:name => 'gallery', :profile => profile) |
| 765 | 765 | file = UploadedFile.create!(:profile => profile, :parent => folder, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) |
| 766 | - get :view_page, :profile => profile.identifier, :page => file.explode_path, :view => true | |
| 766 | + xhr :get, :view_page, :profile => profile.identifier, :page => file.explode_path, :view => true, :toolbar => true | |
| 767 | 767 | |
| 768 | 768 | assert_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{folder.id}/} |
| 769 | 769 | end |
| ... | ... | @@ -863,7 +863,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 863 | 863 | should "not display 'Upload files' when viewing blog" do |
| 864 | 864 | login_as(profile.identifier) |
| 865 | 865 | b = Blog.create!(:name => 'article folder', :profile => profile) |
| 866 | - get :view_page, :profile => profile.identifier, :page => b.explode_path | |
| 866 | + xhr :get, :view_page, :profile => profile.identifier, :page => b.explode_path, :toolbar => true | |
| 867 | 867 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
| 868 | 868 | end |
| 869 | 869 | |
| ... | ... | @@ -871,7 +871,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 871 | 871 | login_as(profile.identifier) |
| 872 | 872 | b = Blog.create!(:name => 'article folder', :profile => profile) |
| 873 | 873 | blog_post = TextileArticle.create!(:name => 'children-article', :profile => profile, :parent => b) |
| 874 | - get :view_page, :profile => profile.identifier, :page => blog_post.explode_path | |
| 874 | + xhr :get, :view_page, :profile => profile.identifier, :page => blog_post.explode_path, :toolbar => true | |
| 875 | 875 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
| 876 | 876 | end |
| 877 | 877 | |
| ... | ... | @@ -913,7 +913,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 913 | 913 | login_as u.identifier |
| 914 | 914 | a = c.articles.create!(:name => 'test-article', :last_changed_by => profile, :published => true) |
| 915 | 915 | |
| 916 | - get :view_page, :profile => c.identifier, :page => a.explode_path | |
| 916 | + xhr :get, :view_page, :profile => c.identifier, :page => a.explode_path, :toolbar => true | |
| 917 | 917 | |
| 918 | 918 | assert_tag :tag => 'a', :content => 'New article' |
| 919 | 919 | end |
| ... | ... | @@ -963,8 +963,8 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 963 | 963 | should 'display link to edit blog for allowed' do |
| 964 | 964 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
| 965 | 965 | login_as(profile.identifier) |
| 966 | - get :view_page, :profile => profile.identifier, :page => blog.explode_path | |
| 967 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{blog.id}" }, :content => 'Configure blog' } | |
| 966 | + xhr :get, :view_page, :profile => profile.identifier, :page => blog.explode_path, :toolbar => true | |
| 967 | + assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{blog.id}" }, :content => 'Configure blog' } | |
| 968 | 968 | end |
| 969 | 969 | |
| 970 | 970 | # Forum |
| ... | ... | @@ -1054,7 +1054,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 1054 | 1054 | login_as(profile.identifier) |
| 1055 | 1055 | a = Forum.create!(:name => 'article folder', :profile => profile) |
| 1056 | 1056 | Article.stubs(:short_description).returns('bli') |
| 1057 | - get :view_page, :profile => profile.identifier, :page => [a.path] | |
| 1057 | + xhr :get, :view_page, :profile => profile.identifier, :page => [a.path], :toolbar => true | |
| 1058 | 1058 | assert_tag :tag => 'a', :content => 'New discussion topic' |
| 1059 | 1059 | end |
| 1060 | 1060 | |
| ... | ... | @@ -1063,7 +1063,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 1063 | 1063 | a = Forum.create!(:name => 'article folder', :profile => profile) |
| 1064 | 1064 | Article.stubs(:short_description).returns('bli') |
| 1065 | 1065 | t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile) |
| 1066 | - get :view_page, :profile => profile.identifier, :page => [t.path] | |
| 1066 | + xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true | |
| 1067 | 1067 | assert_tag :tag => 'a', :content => 'New discussion topic' |
| 1068 | 1068 | end |
| 1069 | 1069 | |
| ... | ... | @@ -1085,7 +1085,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 1085 | 1085 | should "not display 'Upload files' when viewing forum" do |
| 1086 | 1086 | login_as(profile.identifier) |
| 1087 | 1087 | b = Forum.create!(:name => 'article folder', :profile => profile) |
| 1088 | - get :view_page, :profile => profile.identifier, :page => b.explode_path | |
| 1088 | + xhr :get, :view_page, :profile => profile.identifier, :page => b.explode_path, :toolbar => true | |
| 1089 | 1089 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
| 1090 | 1090 | end |
| 1091 | 1091 | |
| ... | ... | @@ -1093,43 +1093,43 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 1093 | 1093 | login_as(profile.identifier) |
| 1094 | 1094 | b = Forum.create!(:name => 'article folder', :profile => profile) |
| 1095 | 1095 | forum_post = TextileArticle.create!(:name => 'children-article', :profile => profile, :parent => b) |
| 1096 | - get :view_page, :profile => profile.identifier, :page => forum_post.explode_path | |
| 1096 | + xhr :get, :view_page, :profile => profile.identifier, :page => forum_post.explode_path, :toolbar => true | |
| 1097 | 1097 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
| 1098 | 1098 | end |
| 1099 | 1099 | |
| 1100 | 1100 | should 'display link to edit forum for allowed' do |
| 1101 | 1101 | forum = fast_create(Forum, :profile_id => profile.id, :path => 'forum') |
| 1102 | 1102 | login_as(profile.identifier) |
| 1103 | - get :view_page, :profile => profile.identifier, :page => forum.explode_path | |
| 1104 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{forum.id}" }, :content => 'Configure forum' } | |
| 1103 | + xhr :get, :view_page, :profile => profile.identifier, :page => forum.explode_path, :toolbar => true | |
| 1104 | + assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{forum.id}" }, :content => 'Configure forum' } | |
| 1105 | 1105 | end |
| 1106 | 1106 | |
| 1107 | 1107 | should 'display add translation link if article is translatable' do |
| 1108 | 1108 | login_as @profile.identifier |
| 1109 | 1109 | textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') |
| 1110 | - get :view_page, :profile => @profile.identifier, :page => textile.explode_path | |
| 1110 | + xhr :get, :view_page, :profile => @profile.identifier, :page => textile.explode_path, :toolbar => true | |
| 1111 | 1111 | assert_tag :a, :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?article%5Btranslation_of_id%5D=#{textile.id}&type=#{TextileArticle}" } |
| 1112 | 1112 | end |
| 1113 | 1113 | |
| 1114 | 1114 | should 'not display add translation link if article is not translatable' do |
| 1115 | 1115 | login_as @profile.identifier |
| 1116 | 1116 | blog = fast_create(Blog, :profile_id => @profile.id, :path => 'blog') |
| 1117 | - get :view_page, :profile => @profile.identifier, :page => blog.explode_path | |
| 1117 | + xhr :get, :view_page, :profile => @profile.identifier, :page => blog.explode_path, :toolbar => true | |
| 1118 | 1118 | assert_no_tag :a, :attributes => { :content => 'Add translation', :class => /icon-locale/ } |
| 1119 | 1119 | end |
| 1120 | 1120 | |
| 1121 | 1121 | should 'not display add translation link if article hasnt a language defined' do |
| 1122 | 1122 | login_as @profile.identifier |
| 1123 | 1123 | textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile') |
| 1124 | - get :view_page, :profile => @profile.identifier, :page => textile.explode_path | |
| 1124 | + xhr :get, :view_page, :profile => @profile.identifier, :page => textile.explode_path, :toolbar => true | |
| 1125 | 1125 | assert_no_tag :a, :attributes => { :content => 'Add translation', :class => /icon-locale/ } |
| 1126 | 1126 | end |
| 1127 | 1127 | |
| 1128 | - should 'diplay translations link if article has translations' do | |
| 1128 | + should 'display translations link if article has translations' do | |
| 1129 | 1129 | login_as @profile.identifier |
| 1130 | 1130 | textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') |
| 1131 | 1131 | translation = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'translation', :language => 'es', :translation_of_id => textile) |
| 1132 | - get :view_page, :profile => @profile.identifier, :page => textile.explode_path | |
| 1132 | + xhr :get, :view_page, :profile => @profile.identifier, :page => textile.explode_path, :toolbar => true | |
| 1133 | 1133 | assert_tag :a, :attributes => { :class => /article-translations-menu/, :onclick => /toggleSubmenu/ } |
| 1134 | 1134 | end |
| 1135 | 1135 | |
| ... | ... | @@ -1377,9 +1377,15 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
| 1377 | 1377 | should 'suggest article link displayed into article-actions div' do |
| 1378 | 1378 | community = fast_create(Community) |
| 1379 | 1379 | blog = fast_create(Blog, :profile_id => community.id, :path => 'blog') |
| 1380 | - get :view_page, :profile => community.identifier, :page => [ 'blog' ] | |
| 1381 | - assert_tag :tag => 'div', :attributes => {:id => 'article-actions'}, | |
| 1382 | - :descendant => {:tag => 'a', :attributes => {:id => 'suggest-article-link'}} | |
| 1380 | + xhr :get, :view_page, :profile => community.identifier, :page => [ 'blog' ], :toolbar => true | |
| 1381 | + assert_tag :tag => 'a', :attributes => { :id => 'suggest-article-link' } | |
| 1382 | + end | |
| 1383 | + | |
| 1384 | + should 'render toolbar when it is an ajax request' do | |
| 1385 | + community = fast_create(Community) | |
| 1386 | + blog = fast_create(Blog, :profile_id => community.id, :path => 'blog') | |
| 1387 | + xhr :get, :view_page, :profile => community.identifier, :page => ['blog'], :toolbar => true | |
| 1388 | + assert_tag :tag => 'div', :attributes => { :id => 'article-header' } | |
| 1383 | 1389 | end |
| 1384 | 1390 | |
| 1385 | 1391 | end | ... | ... |
test/functional/profile_controller_test.rb
| ... | ... | @@ -174,8 +174,9 @@ class ProfileControllerTest < Test::Unit::TestCase |
| 174 | 174 | |
| 175 | 175 | should 'not show Leave This Community button for non-registered users' do |
| 176 | 176 | community = Community.create!(:name => 'my test community') |
| 177 | - get :index, :profile => community.identifier | |
| 178 | - assert_no_tag :tag => 'a', :attributes => { :href => "/profile/#{@profile.identifier}/leave" } | |
| 177 | + community.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 178 | + get :profile_info, :profile => community.identifier, :block_id => block.id | |
| 179 | + assert_no_match /\/profile\/#{@profile.identifier}\/leave/, @response.body | |
| 179 | 180 | end |
| 180 | 181 | |
| 181 | 182 | should 'check access before displaying profile' do |
| ... | ... | @@ -190,26 +191,29 @@ class ProfileControllerTest < Test::Unit::TestCase |
| 190 | 191 | should 'display add friend button' do |
| 191 | 192 | login_as(@profile.identifier) |
| 192 | 193 | friend = create_user_full('friendtestuser').person |
| 193 | - get :index, :profile => friend.identifier | |
| 194 | - assert_tag :tag => 'a', :content => 'Add friend' | |
| 194 | + friend.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 195 | + get :profile_info, :profile => friend.identifier, :block_id => block.id | |
| 196 | + assert_match /Add friend/, @response.body | |
| 195 | 197 | end |
| 196 | 198 | |
| 197 | 199 | should 'not display add friend button if user already request friendship' do |
| 198 | 200 | login_as(@profile.identifier) |
| 199 | 201 | friend = create_user_full('friendtestuser').person |
| 202 | + friend.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 200 | 203 | AddFriend.create!(:person => @profile, :friend => friend) |
| 201 | - get :index, :profile => friend.identifier | |
| 202 | - assert_no_tag :tag => 'a', :content => 'Add friend' | |
| 204 | + get :profile_info, :profile => friend.identifier, :block_id => block.id | |
| 205 | + assert_no_match /Add friend/, @response.body | |
| 203 | 206 | end |
| 204 | 207 | |
| 205 | 208 | should 'not display add friend button if user already friend' do |
| 206 | 209 | login_as(@profile.identifier) |
| 207 | 210 | friend = create_user_full('friendtestuser').person |
| 211 | + friend.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 208 | 212 | @profile.add_friend(friend) |
| 209 | 213 | @profile.friends.reload |
| 210 | 214 | assert @profile.is_a_friend?(friend) |
| 211 | - get :index, :profile => friend.identifier | |
| 212 | - assert_no_tag :tag => 'a', :content => 'Add friend' | |
| 215 | + get :profile_info, :profile => friend.identifier, :block_id => block.id | |
| 216 | + assert_no_match /Add friend/, @response.body | |
| 213 | 217 | end |
| 214 | 218 | |
| 215 | 219 | should 'show message for disabled enterprise' do |
| ... | ... | @@ -293,82 +297,91 @@ class ProfileControllerTest < Test::Unit::TestCase |
| 293 | 297 | |
| 294 | 298 | should 'display contact us for enterprises' do |
| 295 | 299 | ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise') |
| 296 | - get :index, :profile => 'my-test-enterprise' | |
| 297 | - assert_tag :tag => 'a', :attributes => { :href => "/contact/my-test-enterprise/new" }, :content => /Send/ | |
| 300 | + ent.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 301 | + get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id | |
| 302 | + assert_match /\/contact\/my-test-enterprise\/new/, @response.body | |
| 298 | 303 | end |
| 299 | 304 | |
| 300 | 305 | should 'not display contact us for non-enterprises' do |
| 301 | - get :index, :profile => @profile.identifier | |
| 302 | - assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{@profile.identifier}/new" }, :content => /Send/ | |
| 306 | + @profile.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 307 | + get :profile_info, :profile => @profile, :block_id => block.id | |
| 308 | + assert_no_match /\/contact\/#{@profile.identifier}\/new/, @response.body | |
| 303 | 309 | end |
| 304 | 310 | |
| 305 | 311 | should 'display contact us only if enabled' do |
| 306 | - ent = fast_create(Enterprise, :name => 'my test enterprise', :identifier => 'my-test-enterprise') | |
| 312 | + ent = Enterprise.create! :name => 'my test enterprise', :identifier => 'my-test-enterprise' | |
| 313 | + ent.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 307 | 314 | ent.update_attribute(:enable_contact_us, false) |
| 308 | - get :index, :profile => 'my-test-enterprise' | |
| 309 | - assert_no_tag :tag => 'a', :attributes => { :href => "/contact/my-test-enterprise/new" }, :content => /Send/ | |
| 315 | + get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id | |
| 316 | + assert_no_match /\/contact\/my-test-enterprise\/new/, @response.body | |
| 310 | 317 | end |
| 311 | 318 | |
| 312 | 319 | should 'display contact button only if friends' do |
| 313 | 320 | friend = create_user_full('friend_user').person |
| 321 | + friend.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 314 | 322 | @profile.add_friend(friend) |
| 315 | 323 | env = Environment.default |
| 316 | 324 | env.disable('disable_contact_person') |
| 317 | 325 | env.save! |
| 318 | 326 | login_as(@profile.identifier) |
| 319 | - get :index, :profile => friend.identifier | |
| 320 | - assert_tag :tag => 'a', :attributes => { :href => "/contact/#{friend.identifier}/new" } | |
| 327 | + get :profile_info, :profile => friend.identifier, :block_id => block.id | |
| 328 | + assert_match /\/contact\/#{friend.identifier}\/new/, @response.body | |
| 321 | 329 | end |
| 322 | 330 | |
| 323 | 331 | should 'not display contact button if no friends' do |
| 324 | 332 | nofriend = create_user_full('no_friend').person |
| 333 | + nofriend.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 325 | 334 | login_as(@profile.identifier) |
| 326 | - get :index, :profile => nofriend.identifier | |
| 327 | - assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{nofriend.identifier}/new" } | |
| 335 | + get :profile_info, :profile => nofriend.identifier, :block_id => block.id | |
| 336 | + assert_no_match /\/contact\/#{nofriend.identifier}\/new/, @response.body | |
| 328 | 337 | end |
| 329 | 338 | |
| 330 | 339 | should 'display contact button only if friends and its enable in environment' do |
| 331 | 340 | friend = create_user_full('friend_user').person |
| 341 | + friend.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 332 | 342 | env = Environment.default |
| 333 | 343 | env.disable('disable_contact_person') |
| 334 | 344 | env.save! |
| 335 | 345 | @profile.add_friend(friend) |
| 336 | 346 | login_as(@profile.identifier) |
| 337 | - get :index, :profile => friend.identifier | |
| 338 | - assert_tag :tag => 'a', :attributes => { :href => "/contact/#{friend.identifier}/new" } | |
| 347 | + get :profile_info, :profile => friend.identifier, :block_id => block.id | |
| 348 | + assert_match /\/contact\/#{friend.identifier}\/new/, @response.body | |
| 339 | 349 | end |
| 340 | 350 | |
| 341 | 351 | should 'not display contact button if friends and its disable in environment' do |
| 342 | 352 | friend = create_user_full('friend_user').person |
| 353 | + friend.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 343 | 354 | env = Environment.default |
| 344 | 355 | env.enable('disable_contact_person') |
| 345 | 356 | env.save! |
| 346 | 357 | @profile.add_friend(friend) |
| 347 | 358 | login_as(@profile.identifier) |
| 348 | - get :index, :profile => friend.identifier | |
| 349 | - assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{friend.identifier}/new" } | |
| 359 | + get :profile_info, :profile => friend.identifier, :block_id => block.id | |
| 360 | + assert_no_match /\/contact\/#{friend.identifier}\/new/, @response.body | |
| 350 | 361 | end |
| 351 | 362 | |
| 352 | 363 | should 'display contact button for community if its enable in environment' do |
| 353 | 364 | env = Environment.default |
| 354 | 365 | community = Community.create!(:name => 'my test community', :environment => env) |
| 366 | + community.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 355 | 367 | env.disable('disable_contact_community') |
| 356 | 368 | env.save! |
| 357 | 369 | community.add_member(@profile) |
| 358 | 370 | login_as(@profile.identifier) |
| 359 | - get :index, :profile => community.identifier | |
| 360 | - assert_tag :tag => 'a', :attributes => { :href => "/contact/#{community.identifier}/new" } | |
| 371 | + get :profile_info, :profile => community.identifier, :block_id => block.id | |
| 372 | + assert_match /\/contact\/#{community.identifier}\/new/, @response.body | |
| 361 | 373 | end |
| 362 | 374 | |
| 363 | 375 | should 'not display contact button for community if its disable in environment' do |
| 364 | 376 | env = Environment.default |
| 365 | 377 | community = Community.create!(:name => 'my test community', :environment => env) |
| 378 | + community.boxes.first.blocks << block = ProfileInfoBlock.create! | |
| 366 | 379 | env.enable('disable_contact_community') |
| 367 | 380 | env.save! |
| 368 | 381 | community.add_member(@profile) |
| 369 | 382 | login_as(@profile.identifier) |
| 370 | - get :index, :profile => community.identifier | |
| 371 | - assert_no_tag :tag => 'a', :attributes => { :href => "/contact/#{community.identifier}/new" } | |
| 383 | + get :profile_info, :profile => community.identifier, :block_id => block.id | |
| 384 | + assert_no_match /\/contact\/#{community.identifier}\/new/, @response.body | |
| 372 | 385 | end |
| 373 | 386 | |
| 374 | 387 | should 'actually join profile' do | ... | ... |
test/functional/themes_controller_test.rb
| ... | ... | @@ -145,7 +145,7 @@ class ThemesControllerTest < Test::Unit::TestCase |
| 145 | 145 | |
| 146 | 146 | should 'display dialog for creating new CSS' do |
| 147 | 147 | theme = Theme.create('mytheme', :owner => profile) |
| 148 | - @request.expects(:xhr?).returns(true) | |
| 148 | + @request.stubs(:xhr?).returns(true) | |
| 149 | 149 | get :add_css, :profile => 'testinguser', :id => 'mytheme' |
| 150 | 150 | |
| 151 | 151 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/testinguser/themes/add_css/mytheme', :method => /post/i} |
| ... | ... | @@ -204,7 +204,7 @@ class ThemesControllerTest < Test::Unit::TestCase |
| 204 | 204 | |
| 205 | 205 | should 'display the "add image" dialog' do |
| 206 | 206 | theme = Theme.create('mytheme', :owner => profile) |
| 207 | - @request.expects(:xhr?).returns(true) | |
| 207 | + @request.stubs(:xhr?).returns(true) | |
| 208 | 208 | |
| 209 | 209 | get :add_image, :profile => 'testinguser', :id => 'mytheme' |
| 210 | 210 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/testinguser/themes/add_image/mytheme', :method => /post/i, :enctype => 'multipart/form-data' }, :descendant => { :tag => 'input', :attributes => { :name => 'image', :type => 'file' } } |
| ... | ... | @@ -212,7 +212,7 @@ class ThemesControllerTest < Test::Unit::TestCase |
| 212 | 212 | |
| 213 | 213 | should 'be able to add new image to theme' do |
| 214 | 214 | theme = Theme.create('mytheme', :owner => profile) |
| 215 | - @request.expects(:xhr?).returns(false) | |
| 215 | + @request.stubs(:xhr?).returns(false) | |
| 216 | 216 | |
| 217 | 217 | post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary) |
| 218 | 218 | assert_redirected_to :action => "edit", :id => 'mytheme' | ... | ... |
test/unit/lightbox_helper_test.rb
| ... | ... | @@ -56,4 +56,10 @@ class LightboxHelperTest < Test::Unit::TestCase |
| 56 | 56 | assert lightbox? |
| 57 | 57 | end |
| 58 | 58 | |
| 59 | + should 'provide lightbox_remote_button' do | |
| 60 | + expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'remote-lbOn' })).returns('[button]') | |
| 61 | + | |
| 62 | + assert_equal '[button]', lightbox_remote_button('type', 'label', { :action => 'popup'}) | |
| 63 | + end | |
| 64 | + | |
| 59 | 65 | end | ... | ... |
vendor/plugins/noosfero_caching/init.rb
| ... | ... | @@ -17,7 +17,7 @@ module NoosferoHttpCaching |
| 17 | 17 | if request.path == '/' |
| 18 | 18 | n = environment.home_cache_in_minutes |
| 19 | 19 | else |
| 20 | - if params[:controller] != 'account' && request.path !~ /^\/admin/ | |
| 20 | + if params[:controller] != 'account' && !request.xhr? && request.path !~ /^\/admin/ | |
| 21 | 21 | n = environment.general_cache_in_minutes |
| 22 | 22 | end |
| 23 | 23 | end |
| ... | ... | @@ -28,7 +28,7 @@ module NoosferoHttpCaching |
| 28 | 28 | end |
| 29 | 29 | |
| 30 | 30 | def noosfero_session_check_before |
| 31 | - return if params[:controller] == 'account' | |
| 31 | + return if params[:controller] == 'account' || request.xhr? | |
| 32 | 32 | headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s |
| 33 | 33 | end |
| 34 | 34 | ... | ... |