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