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?
✗ Incorrect
The
visit method tells Capybara to open a specific page URL.How do you simulate clicking a button labeled 'Submit' in Capybara?
✗ Incorrect
Both
click_on and click_button methods can be used to click buttons by their text.Which Capybara method fills in a text field in a form?
✗ Incorrect
Use
fill_in to enter text into form fields.What does
assert_text 'Welcome' check in a system test?✗ Incorrect
assert_text verifies visible text on the page.In Rails system tests, which driver does Capybara use by default for JavaScript support?
✗ Incorrect
Capybara uses Selenium by default to support JavaScript in system tests.
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.