learn-co-students / basic-sinatra-forms-lab-v-000 Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I was getting the following error:
Failure/Error: click_button "submit" Capybara::ElementNotFound: Unable to find button "submit"
Kind of strange. My button definitely was there.
I got it to pass by setting an id value of submit for the button.
Hello,
it "displays the shooting gaurd's name in the browser" do
visit '/newteam'
fill_in(:pg, :with => "Joe")
click_button "submit"
expect(page).to have_text("Shooting Guard: Joe")
end
fill_in :pg should be :sg
thanks!
Local tests don't properly recognize submit
button with either id or name attributes. However, it is properly recognized if labeled with the title attribute.
The following error was a result of missing require 'capybara/dsl'
/basic-sinatra-forms-lab-v-000/spec/spec_helper.rb:9:in
block in <top (required)>': uninitialized constant Capybara::DSL (NameError)
`
Once added learn
worked again
The test for the shooting guard in the spec file is incorrect. Currently, it's:
fill_in(:pg, :with => "Ralph")
It should be:
fill_in(:sg, :with => "Ralph")
The rspec test for the small forward is fixed in the solution branch but is not in the master branch.
Hi,
I had to come back to this lab, as there was something gnawing at me about Capybara and how it identifies "button" values in a later lab.
Here's the issue... the sentence containing the link to the explanation about how Capybara can see which button to hit for its click_button function is WRONG.
Here's the sentence from the lesson's README:
We're telling this to you now because our test frame work, Capybara, requires buttons to be findable either by an id or name attribute.
It's the name attribute that is incorrect.
If I assign name="" to my button in question, I'll fail every Capybara test that is looking at that button.
If you click the link in that sentence in the lesson, the page you go to even tells you how Capybara identifies which button to press:
All buttons can be found by their id, value, or title.
No mention of the "name" attribute anywhere, and I've confirmed it doesn't work in different labs now.
Can you fix that sentence asap?
I can see from the other issues raised in this lab, I'm not the only one who was confused at first.
Thanks!
get '/newteam' do
@team_members = %w(name coach pg sg pf sf c)
erb :newteam
end
post '/team' do
original_string = params['string']
@reversed_string = original_string.reverse
erb :newteam
Wanted to check my submission against solution however it looks like the app.rb portion of the solution was removed some time ago and never replaced.
In newteam.erb
, creating a form with <input type="submit" id="Submit">
produces error Capybara::ElementNotFound: Unable to find visible button "Submit"
This forces use of <button type="submit">
, which is not stated explicitly in README.md.
All prior lessons and examples show using <input type="submit">
rather than <button type="submit">
, leading to confusion. The fact that running shotgun
and checking result in browser returns a working model displaying correct HTML compounds confusion.
Regression to Capybara v. 2.17.0 has tests passing using standard <input type="submit">
element.
Suggest updating Gemfile to gem 'capybara', '2.17.0'
or updating README.md to include instruction on using button element.
Additionally, using id="Submit"
can mislead students such as myself to enter type="Submit"
as attribute for either button or input elements. Chrome defaults to type="submit"
when an invalid type is used, but is not reflected in Capybara, leading to a working model in browser, but non-passing tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.