Loading Data into a Route
SvelteKit is very much about routing: figuring out what to display once your browser requests a page at a specific location. For example, the /birthdays
route that we’ll work on in this chapter. Part of that routing is ensuring that the route has the data available to it. In this chapter, you’ll see how you can test-drive SvelteKit’s load
function for pulling that data into a component.
You’ll also see how Playwright can be used to build an end-to-end test that proves all the various components of this system.
This chapter covers the following:
- Using Playwright to specify end-to-end behavior
- Deciding an approach to make the end-to-end test pass
- Test-driving the load function
- Test-driving the page component
By the end of the chapter, you’ll have test-driven a functioning SvelteKit route that you can view in your web browser, and you’ll have learned the key differences between Playwright...