Debugging cucumber feature with javascript + firefox vnc

Updated . Posted . Visible to the public. Deprecated.

We don't use VNC anymore and some of the mentioned geordi commands don't exist anymore

TL;DR Debugging problems with javascript errors in cucumber tests is sometimes easier in the browser. Run the test, stop at the problematic point (with Then pause from Spreewald Show archive.org snapshot 1.7+) and open VNC for Firefox.

Features:


Given there is a cucumber scenario which looks like this (many of the steps are part of the spreewald gem Show archive.org snapshot ):

@javascript
Scenario: Autocomplete city for station

Given there is a city with the name "Munich"
  And there is a station with the name "Munich main train station"

When I go to the form for the station above
  And I fill "City" with "Mun"
  And I click on "Munich"
  And I press "Save"

Then I should see a success flash
  And I should be on the page for the station above
  And I should see "City Munich"

Lets say, the autocomplete is not working. It will fail, as there is no element with the text "Munich". When the screenshot doesn't help you, here is what you can do, to debug the problem in the browser.

Add this step to your step definitions (it is extracted from spreewald's internal steps):

Then(/^wait for a enter key stroke$/) do
  print 'Press enter to continue...'
  STDIN.getc
end

Change your Scenario:

@javascript
Scenario: Autocomplete city for station

Given there is a city with the name "Munich"
  And there is a station with the name "Munich main train station"

When I go to the form for the station above
  Then I wait for a enter key stroke
  And I fill "City" with "Mun"
  And I click on "Munich"
  And I press "Save"

Then I should see a success flash
  And I should be on the page for the station above
  And I should see "City Munich"

Open you vnc with geordi: geordi vnc

Now you can dig in deeper and figure out what's wrong with your autocomplete.

Last edit
Daniel Straßner
License
Source code in this card is licensed under the MIT License.
Posted by Emanuel to makandra dev (2016-12-06 07:34)