Commit ab5acdb4bc47ba0bf39437a3d768024d0e116d2e

Authored by Antonio Terceiro
1 parent 1a6a459a

Solving DB timeout problem que Selenium and SQLite

It seems that the problem happens when selenium steps run before
non-selenium steps (e.g. settind up data for the test). Doing this also
seems to remove the need for the sleeps added to avoid the timeout.
features/comment.feature
@@ -40,15 +40,14 @@ Feature: comment @@ -40,15 +40,14 @@ Feature: comment
40 40
41 @selenium 41 @selenium
42 Scenario: redirect to right place after comment a picture 42 Scenario: redirect to right place after comment a picture
43 - Given I am logged in as "booking"  
44 - And the following files 43 + Given the following files
45 | owner | file | mime | 44 | owner | file | mime |
46 | booking | rails.png | image/png | 45 | booking | rails.png | image/png |
  46 + Given I am logged in as "booking"
47 And I am on /booking/rails.png?view=true 47 And I am on /booking/rails.png?view=true
48 And I fill in "Title" with "Hey ho, let's go!" 48 And I fill in "Title" with "Hey ho, let's go!"
49 And I fill in "Enter your comment" with "Hey ho, let's go!" 49 And I fill in "Enter your comment" with "Hey ho, let's go!"
50 When I press "Post comment" 50 When I press "Post comment"
51 - And I wait 2 seconds  
52 Then I should be exactly on /booking/rails.png?view=true 51 Then I should be exactly on /booking/rails.png?view=true
53 52
54 @selenium 53 @selenium
@@ -56,6 +55,5 @@ Feature: comment @@ -56,6 +55,5 @@ Feature: comment
56 Given I am logged in as "booking" 55 Given I am logged in as "booking"
57 And I am on /booking/article-to-comment 56 And I am on /booking/article-to-comment
58 When I press "Post comment" 57 When I press "Post comment"
59 - And I wait 2 seconds  
60 Then I should see "Title can't be blank" 58 Then I should see "Title can't be blank"
61 And I should see "Body can't be blank" 59 And I should see "Body can't be blank"
features/step_definitions/custom_webrat_steps.rb
@@ -6,10 +6,6 @@ When /^I should not see "([^\"]+)" link$/ do |link| @@ -6,10 +6,6 @@ When /^I should not see "([^\"]+)" link$/ do |link|
6 response.should_not have_selector("a", :content => link) 6 response.should_not have_selector("a", :content => link)
7 end 7 end
8 8
9 -When /^I wait (\d+) seconds$/ do |seconds|  
10 - sleep seconds.to_i  
11 -end  
12 -  
13 Then /^I should be exactly on (.+)$/ do |page_name| 9 Then /^I should be exactly on (.+)$/ do |page_name|
14 URI.parse(current_url).request_uri.should == path_to(page_name) 10 URI.parse(current_url).request_uri.should == path_to(page_name)
15 end 11 end