Render <a>
containing "Share a Note"
This commit resolves the previous error:
Error:
UserSharesAMessageTest#test_visiting_the_index:
Capybara::ElementNotFound: Unable to find link or button "Share a Note"
test/system/user_shares_a_message_test.rb:8:in `block in <class:UserSharesAMessageTest>'
The click_on
Capybara helper (an alias of
click_link_or_button
) expects the corresponding element to be an <a>
element or a <button>
element. The test is invoking click_on
with
"Share a Note"
as an argument. According to the documentation, the
click_link
:
Finds a link by
id
,Capybara.test_id
attribute, text or title
To advance our test to the next failure, we declare an <a>
element
with "Share a Note"
as its text. Since our system tests are executed
within the context of a web browser, the <a>
element declares
href="#"
to ensure that it is interactive and clickable.
When we run the system test again, it raises a new error:
Error:
UserSharesAMessageTest#test_visiting_the_index:
Capybara::ElementNotFound: Unable to find field "Message"
test/system/user_shares_a_message_test.rb:9:in `block in <class:UserSharesAMessageTest>'