0 Replies - 1438 Views - Last Post: 06 August 2013 - 02:03 PM Rate Topic: -----

#1 GolfyMcG   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 14
  • Joined: 22-November 11

Non-deterministic Cucumber Test Failures for Consecutive Ajax Requests

Posted 06 August 2013 - 02:03 PM

We have a standard cucumber integration test stack using

  • Ruby v.1.9.3,
  • Rails v.3.2.13
  • Capybara v.2.1.0
  • Capybara-Webkit v.1.0.0
  • FactoryGirl v.4.2.1

We have recently had problem where a collection of scenarios involving multiple consecutive ajax requests are failing sporadically with the following error:

Capybara::Webkit::NodeNotAttachedError (Capybara::Webkit::NodeNotAttachedError)
./features/step_definitions/patient_steps.rb:133:in `/^I should see the followin
g patient names in this order:$/'
features\searching_patients_index.feature:39:in `Then I should see the following
patient names in this order:'

The interesting part is that this error is only being thrown on a Windows machine.

The most typical responses to this problem have been:

  • enforcing some sort of sleep or wait_until (despite it's deprecation, we reverted to Capybara v.1.1.3 to try it still) but this has not helped.
  • we tried increasing the default Capybara wait time
  • we have tried a "wait until _ is visible" by checking if a particular piece of the DOM is visible (see below)

When(/^I wait until "(.*?)" is visible$/) do |selector|
  page.has_css?("#{selector}", :visible => true)

Here is an example of one of the failing features:

  Scenario: Searching and then sorting patients
    When I search for "J"
    And I wait until ".patient.odd" is visible
    And I click on the "Name" header in the "patients" table
    And I wait until ".patient.odd" is visible
    Then I should see the following patient names in this order:
      | names       |
      | Smith, John |
      | Schmo, Jill |
    Then the result content should not include "Drapper, Don"

We are using Ajax for both searching a table and sorting it by column, so we are testing if the searching persists when sorting, in this example.

Please let us know if we can provide any further context and thank you in advance for your help!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1