Commit 4a10fc12891228c5a8c5093f4b58a296f70a6761

Authored by Rodrigo Souto
1 parent 2ceaba7c

Partially fixed test: features/profile_domain.feature

features/profile_domain.feature
@@ -39,28 +39,33 @@ Feature: domain for profile @@ -39,28 +39,33 @@ Feature: domain for profile
39 And I follow "Control panel" within "div#user" 39 And I follow "Control panel" within "div#user"
40 Then I should see "Joao Silva" within "span.control-panel-title" 40 Then I should see "Joao Silva" within "span.control-panel-title"
41 41
  42 + # Looking for page title is problematic on selenium since it considers the
  43 + # title to be invibible. Checkout some information about this:
  44 + # * https://github.com/jnicklas/capybara/issues/863
  45 + # * https://github.com/jnicklas/capybara/pull/953
42 @selenium 46 @selenium
43 Scenario: access user page 47 Scenario: access user page
44 Given I am logged in as "joaosilva" 48 Given I am logged in as "joaosilva"
45 When I go to the homepage 49 When I go to the homepage
46 And I follow "joaosilva" 50 And I follow "joaosilva"
47 Then I should be on joaosilva's profile 51 Then I should be on joaosilva's profile
48 - And the page title should be "Joao Silva" 52 + And I should see "Joao Silva" within any "h1"
  53 + #And the page title should be "Joao Silva"
49 54
50 - @selenium-fixme  
51 Scenario: access community by domain 55 Scenario: access community by domain
52 Given I go to the search communities page 56 Given I go to the search communities page
53 When I follow "Sample Community" within ".search-profile-item" 57 When I follow "Sample Community" within ".search-profile-item"
54 Then the page title should be "Sample Community" 58 Then the page title should be "Sample Community"
55 59
56 - @selenium-fixme 60 + # This test is not working because the community domain isn't at all different
  61 + # from the environment (localhost / 127.0.0.1)
  62 + @fixme
57 Scenario: Go to profile homepage after clicking on home button on not found page 63 Scenario: Go to profile homepage after clicking on home button on not found page
58 Given I am on sample-community's homepage 64 Given I am on sample-community's homepage
59 When I go to /something-that-does-not-exist 65 When I go to /something-that-does-not-exist
60 And I follow "Go to the home page" 66 And I follow "Go to the home page"
61 Then the page title should be "Sample Community - Colivre.net" 67 Then the page title should be "Sample Community - Colivre.net"
62 68
63 - @selenium  
64 Scenario: Go to environment homepage after clicking on home button on not found page 69 Scenario: Go to environment homepage after clicking on home button on not found page
65 Given I am on the homepage 70 Given I am on the homepage
66 When I go to /something-that-does-not-exist 71 When I go to /something-that-does-not-exist
features/step_definitions/web_steps.rb
@@ -114,6 +114,15 @@ Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| @@ -114,6 +114,15 @@ Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
114 end 114 end
115 end 115 end
116 116
  117 +
  118 +Then /^(?:|I )should see "([^"]*)" within any "([^"]*)"?$/ do |text, selector|
  119 + if page.respond_to? :should
  120 + page.should have_css(selector, :content => text)
  121 + else
  122 + assert page.has_css?(selector, :content => text)
  123 + end
  124 +end
  125 +
117 Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| 126 Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
118 regexp = Regexp.new(regexp) 127 regexp = Regexp.new(regexp)
119 with_scope(selector) do 128 with_scope(selector) do