In this episode, we start building a simple task list application that we'll use throughout the course to learn about E2E (end-to-end) testing. We set up the basics: creating a Task
model with a migration, factory, and seeder, and making sure our tasks belong to users. Next, we wire up the database and add fake data for our tasks using the factory.
We move on to creating the controller and Inertia page to actually render a list of tasks for a user. To keep things neat, we break each task into its own component. Once that's sorted, we discuss how to organize our Dusk (browser) tests, including naming conventions and structuring them according to the user actions we're testing.
The main focus here is on visibility checks: making sure that tasks actually show up on the page. We start by writing a basic "smoke test" that just makes sure the title renders. Then things get more interesting as we generate multiple tasks with factories, and check that all of them appear on the page.
You'll see how to use Dusk selectors like the dusk
attribute to grab groups of elements (like all the task items), making it easy to count them and verify their contents. We also show why iterating over your created data (like looping over tasks and asserting their titles are visible) is more flexible and less brittle than hardcoding assertions for each item.
By the end of this video, you'll have a good approach for seeding test data and making reliable assertions about lists in your UI—a crucial building block for E2E tests!