0
0
Ruby on Railsframework~5 mins

System tests with Capybara in Ruby on Rails - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of system tests in Rails using Capybara?
System tests check how the whole application works from the user's point of view by simulating browser actions like clicking links and filling forms.
Click to reveal answer
beginner
How do you tell Capybara to visit a page in a system test?
Use the visit method with the page path, for example: visit root_path.
Click to reveal answer
beginner
Which Capybara method simulates clicking a button or link?
The click_on method simulates clicking a button or link by its text or id.
Click to reveal answer
beginner
How do you fill in a form field using Capybara in a system test?
Use the fill_in method with the field label or id and the value, like fill_in 'Email', with: 'user@example.com'.
Click to reveal answer
beginner
What does the assert_text method do in a Capybara system test?
It checks that the given text appears somewhere on the current page, confirming expected content is visible to the user.
Click to reveal answer
Which method in Capybara is used to simulate a user visiting a page?
Aassert_text
Bclick_on
Cfill_in
Dvisit
How do you simulate clicking a button labeled 'Submit' in Capybara?
Aclick_on 'Submit'
Bclick_button 'Submit'
Cfill_in 'Submit'
Dvisit 'Submit'
Which Capybara method fills in a text field in a form?
Afill_in
Bclick_on
Cvisit
Dassert_text
What does assert_text 'Welcome' check in a system test?
AThat a button named 'Welcome' exists
BThat the page URL is 'Welcome'
CThat the page contains the text 'Welcome'
DThat the form field 'Welcome' is filled
In Rails system tests, which driver does Capybara use by default for JavaScript support?
ASelenium
BRack::Test
CPoltergeist
DWebkit
Explain how you would write a simple system test with Capybara to check that a user can visit the homepage and see a welcome message.
Think about what a user does first and what they expect to see.
You got /3 concepts.
    Describe the steps Capybara takes to simulate a user filling out and submitting a form in a system test.
    Imagine you are the user typing and clicking.
    You got /4 concepts.