Commit 2f6997edb05ae729149c5ff6c8a500f01233ff37
Committed by
Daniela Feitosa
1 parent
a1e6092f
Exists in
master
and in
29 other branches
Fixing some problems with domain for profiles.
I've made a selenium test suite for all the problems I've noticed so far, that are the following: * Profile control panel links in profile image block and profile information block * Link to user profile in user bar * Link to user control panel in user bar * 'Go to the home page' button on not found page, that should link to profile home page or to environment home page So I've made the tests, ran them, fixed the problems, and ran the tests again. (ActionItem1465)
Showing
7 changed files
with
93 additions
and
5 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1119,11 +1119,11 @@ module ApplicationHelper | @@ -1119,11 +1119,11 @@ module ApplicationHelper | ||
1119 | pending_tasks_count = link_to(user.all_pending_tasks.count.to_s, '/myprofile/{login}/tasks', :id => 'pending-tasks-count', :title => _("Manage your pending tasks")) | 1119 | pending_tasks_count = link_to(user.all_pending_tasks.count.to_s, '/myprofile/{login}/tasks', :id => 'pending-tasks-count', :title => _("Manage your pending tasks")) |
1120 | end | 1120 | end |
1121 | 1121 | ||
1122 | - (_('Welcome, %s') % link_to('<i></i><strong>{login}</strong>', '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + | 1122 | + (_('Welcome, %s') % link_to('<i></i><strong>{login}</strong>', @environment.top_url + '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + |
1123 | render_environment_features(:usermenu) + | 1123 | render_environment_features(:usermenu) + |
1124 | link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + | 1124 | link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + |
1125 | manage_enterprises.to_s + | 1125 | manage_enterprises.to_s + |
1126 | - link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + | 1126 | + link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', @environment.top_url + '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + |
1127 | pending_tasks_count + | 1127 | pending_tasks_count + |
1128 | link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) | 1128 | link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) |
1129 | end | 1129 | end |
app/views/blocks/profile_image.rhtml
@@ -20,5 +20,5 @@ | @@ -20,5 +20,5 @@ | ||
20 | 20 | ||
21 | </div><!-- end class="vcard" --> | 21 | </div><!-- end class="vcard" --> |
22 | <script type="text/javascript"> | 22 | <script type="text/javascript"> |
23 | - <%= remote_function :url => { :controller => 'profile', :action => 'profile_info', :block_id => block.id } %> | 23 | + <%= remote_function :url => { :controller => 'profile', :profile => profile.identifier, :action => 'profile_info', :block_id => block.id } %> |
24 | </script> | 24 | </script> |
app/views/blocks/profile_info.rhtml
@@ -41,5 +41,5 @@ | @@ -41,5 +41,5 @@ | ||
41 | 41 | ||
42 | </div><!-- end class="vcard" --> | 42 | </div><!-- end class="vcard" --> |
43 | <script type="text/javascript"> | 43 | <script type="text/javascript"> |
44 | - <%= remote_function :url => { :controller => 'profile', :action => 'profile_info', :block_id => block.id } %> | 44 | + <%= remote_function :url => { :controller => 'profile', :profile => profile.identifier, :action => 'profile_info', :block_id => block.id } %> |
45 | </script> | 45 | </script> |
app/views/shared/not_found.rhtml
@@ -6,6 +6,6 @@ | @@ -6,6 +6,6 @@ | ||
6 | </p> | 6 | </p> |
7 | <% button_bar do %> | 7 | <% button_bar do %> |
8 | <%= button :back, _('Go back'), :back %> | 8 | <%= button :back, _('Go back'), :back %> |
9 | - <%= button :home, _('Go to %s home page') % environment.name, :controller => 'home' %> | 9 | + <%= button :home, _('Go to the home page'), '/' %> |
10 | <% end %> | 10 | <% end %> |
11 | </div> | 11 | </div> |
@@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
1 | +Feature: domain for profile | ||
2 | + As a user | ||
3 | + I want access a profile by its own domain | ||
4 | + | ||
5 | + Background: | ||
6 | + Given the following user | ||
7 | + | login | name | | ||
8 | + | joaosilva | Joao Silva | | ||
9 | + And the following communities | ||
10 | + | identifier | name | domain | | ||
11 | + | sample-community | Sample Community | localhost | | ||
12 | + And the following blocks | ||
13 | + | owner | type | | ||
14 | + | sample-community | ProfileImageBlock | | ||
15 | + | sample-community | ProfileInfoBlock | | ||
16 | + And the environment domain is "127.0.0.1" | ||
17 | + And "Joao Silva" is admin of "Sample Community" | ||
18 | + | ||
19 | + @selenium | ||
20 | + Scenario: access profile control panel through profile blocks | ||
21 | + Given I am logged in as "joaosilva" | ||
22 | + When I visit "/" and wait | ||
23 | + And I follow "Control panel" within "div.profile-info-block" and wait | ||
24 | + Then I should see "Sample Community" within "span.control-panel-title" | ||
25 | + When I visit "/" and wait | ||
26 | + And I follow "Control panel" within "div.profile-image-block" and wait | ||
27 | + Then I should see "Sample Community" within "span.control-panel-title" | ||
28 | + | ||
29 | + @selenium | ||
30 | + Scenario: access user control panel | ||
31 | + Given I am logged in as "joaosilva" | ||
32 | + When I visit "/" and wait | ||
33 | + And I follow "joaosilva" and wait | ||
34 | + And I follow "Login" | ||
35 | + And I fill in "joaosilva" for "Username" | ||
36 | + And I fill in "123456" for "Password" | ||
37 | + And I press "Log in" and wait | ||
38 | + And I follow "Control panel" within "div#user" and wait | ||
39 | + Then I should see "Joao Silva" within "span.control-panel-title" | ||
40 | + | ||
41 | + @selenium | ||
42 | + Scenario: access user page | ||
43 | + Given I am logged in as "joaosilva" | ||
44 | + When I visit "/" and wait | ||
45 | + And I follow "joaosilva" and wait | ||
46 | + Then The page title should contain "Joao Silva" | ||
47 | + | ||
48 | + @selenium | ||
49 | + Scenario: access community by domain | ||
50 | + When I go to the homepage | ||
51 | + Then The page title should contain "Sample Community" | ||
52 | + | ||
53 | + @selenium | ||
54 | + Scenario: Go to profile homepage after clicking on home button on not found page | ||
55 | + Given I am on the homepage | ||
56 | + When I go to /something-that-does-not-exist | ||
57 | + And I follow "Go to the home page" | ||
58 | + Then the page title should be "Sample Community - Colivre.net" | ||
59 | + | ||
60 | + @selenium | ||
61 | + Scenario: Go to environment homepage after clicking on home button on not found page | ||
62 | + Given I am on the homepage | ||
63 | + And I click on the logo | ||
64 | + When I open /something-that-does-not-exist | ||
65 | + And I follow "Go to the home page" | ||
66 | + Then the page title should be "Colivre.net" |
features/step_definitions/noosfero_steps.rb
@@ -20,10 +20,15 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | | @@ -20,10 +20,15 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | | ||
20 | klass = kind.singularize.camelize.constantize | 20 | klass = kind.singularize.camelize.constantize |
21 | table.hashes.each do |row| | 21 | table.hashes.each do |row| |
22 | owner = row.delete("owner") | 22 | owner = row.delete("owner") |
23 | + domain = row.delete("domain") | ||
23 | organization = klass.create!(row) | 24 | organization = klass.create!(row) |
24 | if owner | 25 | if owner |
25 | organization.add_admin(Profile[owner]) | 26 | organization.add_admin(Profile[owner]) |
26 | end | 27 | end |
28 | + if domain | ||
29 | + d = Domain.new :name => domain, :owner => organization | ||
30 | + d.save(false) | ||
31 | + end | ||
27 | end | 32 | end |
28 | end | 33 | end |
29 | 34 | ||
@@ -392,3 +397,7 @@ Given /^"([^\"]*)" asked to join "([^\"]*)"$/ do |person, organization| | @@ -392,3 +397,7 @@ Given /^"([^\"]*)" asked to join "([^\"]*)"$/ do |person, organization| | ||
392 | AddMember.create!(:person => person, :organization => organization) | 397 | AddMember.create!(:person => person, :organization => organization) |
393 | end | 398 | end |
394 | 399 | ||
400 | +Given /^the environment domain is "([^\"]*)"$/ do |domain| | ||
401 | + d = Domain.new :name => domain, :owner => Environment.default | ||
402 | + d.save(false) | ||
403 | +end |
features/step_definitions/selenium_steps.rb
@@ -103,6 +103,19 @@ When /^I refresh the page$/ do | @@ -103,6 +103,19 @@ When /^I refresh the page$/ do | ||
103 | response.selenium.refresh | 103 | response.selenium.refresh |
104 | end | 104 | end |
105 | 105 | ||
106 | +When /^I click on the logo$/ do | ||
107 | + selenium.click("css=h1#site-title a") | ||
108 | + selenium.wait_for_page_to_load(10000) | ||
109 | +end | ||
110 | + | ||
111 | +When /^I open (.*)$/ do |url| | ||
112 | + selenium.open(URI.join(response.selenium.get_location, url)) | ||
113 | +end | ||
114 | + | ||
115 | +Then /^the page title should be "([^"]+)"$/ do |text| | ||
116 | + selenium.get_text("//title").should == text | ||
117 | +end | ||
118 | + | ||
106 | #### Noosfero specific steps #### | 119 | #### Noosfero specific steps #### |
107 | 120 | ||
108 | Then /^the select for category "([^\"]*)" should be visible$/ do |name| | 121 | Then /^the select for category "([^\"]*)" should be visible$/ do |name| |