Commit 7aa42ede6046e3730393cebf58188c7e12be2f85

Authored by Braulio Bhavamitra
1 parent 00c832e0

selenium: Speed up visibility checks

This improves selenium and plugins tasks by more than 10 minutes
See https://blog.codeship.com/faster-rails-tests/
features/admin_categories.feature
@@ -45,7 +45,7 @@ Feature: manage categories @@ -45,7 +45,7 @@ Feature: manage categories
45 And I should see "Steak" 45 And I should see "Steak"
46 When I follow "Hide" 46 When I follow "Hide"
47 Then I should not see "Vegetarian" 47 Then I should not see "Vegetarian"
48 - And "Steak" should not be visible within "div" 48 + And I should not see "Steak"
49 49
50 @selenium 50 @selenium
51 Scenario: the show link is available just for categories with category tree 51 Scenario: the show link is available just for categories with category tree
features/comment.feature
@@ -96,4 +96,4 @@ Feature: comment @@ -96,4 +96,4 @@ Feature: comment
96 Scenario: hide post a comment button when clicked 96 Scenario: hide post a comment button when clicked
97 Given I am on /booking/article-to-comment 97 Given I am on /booking/article-to-comment
98 And I follow "Post a comment" 98 And I follow "Post a comment"
99 - Then "Post a comment" should not be visible within "#article" 99 + Then "Post comment" should not be visible within "#article"
features/step_definitions/custom_web_steps.rb
1 Then /^"([^"]*)" should not be visible within "([^"]*)"$/ do |text, selector| 1 Then /^"([^"]*)" should not be visible within "([^"]*)"$/ do |text, selector|
2 - if page.has_content?(text)  
3 - page.should have_no_css(selector, :text => text, :visible => false)  
4 - end 2 + page.should have_no_css selector, text: text, visible: false
5 end 3 end
6 4
7 Then /^"([^"]*)" should be visible within "([^"]*)"$/ do |text, selector| 5 Then /^"([^"]*)" should be visible within "([^"]*)"$/ do |text, selector|
8 - if page.has_content?(text)  
9 - page.should have_css(selector, :text => text, :visible => false)  
10 - end 6 + page.should have_css selector, text: text, visible: false
11 end 7 end
12 8
13 Then /^I should see "([^"]*)" link$/ do |text| 9 Then /^I should see "([^"]*)" link$/ do |text|