diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8a053fa..c86b40f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1119,11 +1119,11 @@ module ApplicationHelper pending_tasks_count = link_to(user.all_pending_tasks.count.to_s, '/myprofile/{login}/tasks', :id => 'pending-tasks-count', :title => _("Manage your pending tasks")) end - (_('Welcome, %s') % link_to('{login}', '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + + (_('Welcome, %s') % link_to('{login}', @environment.top_url + '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + render_environment_features(:usermenu) + link_to('' + _('Administration') + '', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + manage_enterprises.to_s + - link_to('' + _('Control panel') + '', '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + + link_to('' + _('Control panel') + '', @environment.top_url + '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + pending_tasks_count + link_to('' + _('Logout') + '', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) end diff --git a/app/views/blocks/profile_image.rhtml b/app/views/blocks/profile_image.rhtml index 465635a..5c5194d 100644 --- a/app/views/blocks/profile_image.rhtml +++ b/app/views/blocks/profile_image.rhtml @@ -20,5 +20,5 @@ diff --git a/app/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml index 527bd16..012ffc8 100644 --- a/app/views/blocks/profile_info.rhtml +++ b/app/views/blocks/profile_info.rhtml @@ -41,5 +41,5 @@ diff --git a/app/views/shared/not_found.rhtml b/app/views/shared/not_found.rhtml index 4dd44d1..6edbe37 100644 --- a/app/views/shared/not_found.rhtml +++ b/app/views/shared/not_found.rhtml @@ -6,6 +6,6 @@

<% button_bar do %> <%= button :back, _('Go back'), :back %> - <%= button :home, _('Go to %s home page') % environment.name, :controller => 'home' %> + <%= button :home, _('Go to the home page'), '/' %> <% end %> diff --git a/features/profile_domain.feature b/features/profile_domain.feature new file mode 100644 index 0000000..f2dbc1b --- /dev/null +++ b/features/profile_domain.feature @@ -0,0 +1,66 @@ +Feature: domain for profile + As a user + I want access a profile by its own domain + + Background: + Given the following user + | login | name | + | joaosilva | Joao Silva | + And the following communities + | identifier | name | domain | + | sample-community | Sample Community | localhost | + And the following blocks + | owner | type | + | sample-community | ProfileImageBlock | + | sample-community | ProfileInfoBlock | + And the environment domain is "127.0.0.1" + And "Joao Silva" is admin of "Sample Community" + + @selenium + Scenario: access profile control panel through profile blocks + Given I am logged in as "joaosilva" + When I visit "/" and wait + And I follow "Control panel" within "div.profile-info-block" and wait + Then I should see "Sample Community" within "span.control-panel-title" + When I visit "/" and wait + And I follow "Control panel" within "div.profile-image-block" and wait + Then I should see "Sample Community" within "span.control-panel-title" + + @selenium + Scenario: access user control panel + Given I am logged in as "joaosilva" + When I visit "/" and wait + And I follow "joaosilva" and wait + And I follow "Login" + And I fill in "joaosilva" for "Username" + And I fill in "123456" for "Password" + And I press "Log in" and wait + And I follow "Control panel" within "div#user" and wait + Then I should see "Joao Silva" within "span.control-panel-title" + + @selenium + Scenario: access user page + Given I am logged in as "joaosilva" + When I visit "/" and wait + And I follow "joaosilva" and wait + Then The page title should contain "Joao Silva" + + @selenium + Scenario: access community by domain + When I go to the homepage + Then The page title should contain "Sample Community" + + @selenium + Scenario: Go to profile homepage after clicking on home button on not found page + Given I am on the homepage + When I go to /something-that-does-not-exist + And I follow "Go to the home page" + Then the page title should be "Sample Community - Colivre.net" + + @selenium + Scenario: Go to environment homepage after clicking on home button on not found page + Given I am on the homepage + And I click on the logo + When I open /something-that-does-not-exist + And I follow "Go to the home page" + Then the page title should be "Colivre.net" diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 93f2ade..db51f8d 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -20,10 +20,15 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | klass = kind.singularize.camelize.constantize table.hashes.each do |row| owner = row.delete("owner") + domain = row.delete("domain") organization = klass.create!(row) if owner organization.add_admin(Profile[owner]) end + if domain + d = Domain.new :name => domain, :owner => organization + d.save(false) + end end end @@ -392,3 +397,7 @@ Given /^"([^\"]*)" asked to join "([^\"]*)"$/ do |person, organization| AddMember.create!(:person => person, :organization => organization) end +Given /^the environment domain is "([^\"]*)"$/ do |domain| + d = Domain.new :name => domain, :owner => Environment.default + d.save(false) +end diff --git a/features/step_definitions/selenium_steps.rb b/features/step_definitions/selenium_steps.rb index e6acceb..b2a3779 100644 --- a/features/step_definitions/selenium_steps.rb +++ b/features/step_definitions/selenium_steps.rb @@ -103,6 +103,19 @@ When /^I refresh the page$/ do response.selenium.refresh end +When /^I click on the logo$/ do + selenium.click("css=h1#site-title a") + selenium.wait_for_page_to_load(10000) +end + +When /^I open (.*)$/ do |url| + selenium.open(URI.join(response.selenium.get_location, url)) +end + +Then /^the page title should be "([^"]+)"$/ do |text| + selenium.get_text("//title").should == text +end + #### Noosfero specific steps #### Then /^the select for category "([^\"]*)" should be visible$/ do |name| -- libgit2 0.21.2