diff --git a/features/profile_domain.feature b/features/profile_domain.feature index 9e44752..0aab779 100644 --- a/features/profile_domain.feature +++ b/features/profile_domain.feature @@ -12,48 +12,49 @@ Feature: domain for profile | sample-community | Sample Community | localhost | And the following blocks | owner | type | - | sample-community | ProfileImageBlock | - | sample-community | ProfileInfoBlock | + | joaosilva | ProfileInfoBlock | And the environment domain is "127.0.0.1" + And "Joao Silva" is environment admin 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" + When I go to joaosilva's homepage + And I follow "Control panel" within ".profile-info-block" + Then I should see "Joao Silva" within "span.control-panel-title" + When I follow "Control panel" within ".profile-image-block" + Then I should see "Joao Silva" 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 + When I go to the homepage + And I follow "joaosilva" + And I go to sample-community's homepage 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 + And I press "Log in" + And I follow "Control panel" within "div#user" 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" + When I go to the homepage + And I follow "joaosilva" + Then the page title should be "Joao Silva" - @selenium + @selenium @fixme Scenario: access community by domain - When I go to the homepage - Then The page title should contain "Sample Community" + Given I go to the search communities page + When I follow "Sample Community" within ".search-profile-item" + Then the page title should be "Sample Community" - @selenium + @selenium @fixme Scenario: Go to profile homepage after clicking on home button on not found page - Given I am on the homepage + Given I am on sample-community's 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" @@ -61,13 +62,11 @@ Feature: domain for profile @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 + When I go to /something-that-does-not-exist And I follow "Go to the home page" Then the page title should be "Colivre.net" @selenium Scenario: Compose link to administration with environment domain Given I am logged in as "joaosilva" - When I visit "/" and wait - Then I should see "Administration" linking to "http://127.0.0.1/admin" + Then I should see "Administration" linking to "http://127.0.0.1.*/admin" diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 1422df1..d1ed7a2 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -13,8 +13,7 @@ Then /^I should not see "([^"]*)" link$/ do |text| end When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href| - page.should have_selector("a:contains('#{text}')") - page.should have_selector("a[href='#{href}']") + page.should have_xpath("//a", :href => /#{href}/) end When /^I reload and wait for the page$/ do diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 778da89..ccee812 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -299,6 +299,13 @@ Given /^I am logged in as "(.+)"$/ do |username| Then %{I should be on #{username}'s control panel} end +Given /^"([^"]*)" is environment admin$/ do |person| + user = Profile.find_by_name(person) + e = Environment.default + + e.add_admin(user) +end + Given /^I am logged in as admin$/ do visit('/account/logout') user = User.create!(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') @@ -414,12 +421,8 @@ Given /^enterprise "([^\"]*)" is disabled$/ do |enterprise_name| enterprise.save end -Then /^The page title should contain "(.*)"$/ do |text| - if response.class.to_s == 'Webrat::SeleniumResponse' - response.selenium.text('css=title').should include(text) - else - response.should have_selector("title:contains('#{text}')") - end +Then /^the page title should be "(.*)"$/ do |text| + Then %{I should see "#{text}" within "title"} end Then /^The page should contain "(.*)"$/ do |selector| -- libgit2 0.21.2