End-to-end Tests
End-to-end tests are tests that ensure the application is behaving as expected through the lens of the consumer.
For a web application, this would be tests that interact via a web browser (either simulated or through a web "driver"); for an API, this would be tests that interact with application endpoints by using the appropriate HTTP verb and request headers and body.
In both of these cases, tests will assert against what a user would be able to interact with: often the HTML available on the page for a web application, or the response of an API call. Depending on the test path through the application, the test may assert that email delivery occurred, a third-party API was hit, etc.
These tests are often the most time-intensive, as they're testing multiple pieces of the application stack in concert.
Example
require "rails_helper"
RSpec.describe "Member manages their profile data" do
it "by updating their email" do
sign_in
click_on "Manage Profile"
new_email = generate(:email)
fill_in "Email", with: new_email
click_on "Update Profile"
expect(page).to have_pending_email_notification
open_email_for(new_email)
expect(current_email).to have_subject("Confirm your updated email address")
click_first_link_in_email(current_email)
expect(page).to have_thanks_for_confirming_notification
end
end