Note that there are some explanatory texts on larger screens.

plurals
  1. POCapybara issue when trying to click form submit button
    primarykey
    data
    text
    <p>I'm pretty new to Ruby/Rails and especially to Capybara and the whole process, so please bear with me as I've spent a lot of time on this already and I finally decided to ask because I'm sure it's something simple that I just am as-of-yet unaware of.</p> <p>So I have a form that has several checkboxes that are designed to filter the results displayed (ie, you select one or more and submit and thew page reloads with the list filtered). In my features file, I have the following scenarios (the button to submit the form has a value="Refresh"):</p> <pre><code>Scenario: no ratings selected When I uncheck the following ratings: G, PG, PG-13, NC-17, R And I press "Refresh" Then show me the page And I should see none of the movies Scenario: all ratings selected When I check the following ratings: G, PG, PG-13, NC-17, R And I press "Refresh" Then show me the page And I should see all of the movies </code></pre> <p>When I run this with rake features, it gives the following output:</p> <pre><code> And I press "Refresh" # features/step_definitions/web_steps.rb:61 xprop: unable to open display '' </code></pre> <p>I am using page.body a little later in the scenario and I believe this is the reason I then get the following errors:</p> <pre><code>Deprecated: please use #source_tags instead. Warning: program returned non-zero exit code #1 WARNING: You don't seem to have any mimeinfo.cache files. Try running the update-desktop-database command. If you don't have this command you should install the desktop-file-utils package. This package is available from &lt;link&gt; No applications found for mimetype: text/html /usr/bin/xdg-open: 563: links2: not found /usr/bin/xdg-open: 563: links: not found /usr/bin/xdg-open: 563: lynx: not found Error occured while reset 800b: errno=5 xdg-open: no method available for opening '/home/ubuntu/hw3_rottenpotatoes/tmp/capybara /capybara-201203260037535403047955.html' Error occured: errno=5 Warning: program returned non-zero exit code #1 WARNING: You don't seem to have any mimeinfo.cache files. Try running the update-desktop-database command. If you don't have this command you should install the desktop-file-utils package. This package is available from &lt;link&gt; No applications found for mimetype: text/html /usr/bin/xdg-open: 563: links2: not found /usr/bin/xdg-open: 563: links: not found /usr/bin/xdg-open: 563: lynx: not found Error occured while reset 800b: errno=5 xdg-open: no method available for opening '/home/ubuntu/hw3_rottenpotatoes/tmp/capybara /capybara-201203260037534847572739.html' Error occured: errno=5 Warning: program returned non-zero exit code #1 WARNING: You don't seem to have any mimeinfo.cache files. Try running the update-desktop-database command. If you don't have this command you should install the desktop-file-utils package. This package is available from &lt;link&gt; No applications found for mimetype: text/html /usr/bin/xdg-open: 563: links2: not found /usr/bin/xdg-open: 563: links: not found /usr/bin/xdg-open: 563: lynx: not found Error occured while reset 800b: errno=5 xdg-open: no method available for opening '/home/ubuntu/hw3_rottenpotatoes/tmp/capybara /capybara-20120326003754980186501.html' </code></pre> <p>Here are the relevant step definitions</p> <pre><code>When /I (un)?check the following ratings: (.*)/ do |unc, rating_list| rating_list.split(", ").each do |r| if(unc) uncheck("ratings_#{r}") else check("ratings_#{r}") end end assert true, "Implemented checking function" end Then /I should (not )?see movies with the following ratings: (.*)/ do |nt, rating_list| flag = true rating_list.split(", ").each do |r| if(nt) if(page.body =~ /&lt;td&gt;#{r}/) flag = false; end else if(page.body !~ /&lt;td&gt;#{r}/) flag = false end end end assert flag, "Seeing (or not) movies of ratings list - implemented" end Then /I should see all of the movies/ do tot = Movie.all.count assert page.have_selector('tbody tr', :count =&gt; tot) end Then /I should see none of the movies/ do num = page.body.scan(/00:00:00 UTC/m).length assert size == 0, "Showing no movies - implemented" end When /^(?:|I )press "([^"]*)"$/ do |button| click_button(button) end Then /^show me the page$/ do save_and_open_page end </code></pre> <p>I have been researching for days when I have time and there is just so much I don't know. Any help or insights would be greatly appreciated. Thank you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload