undefined

Testing

Japa is a powerful first-party integration for testing by the AdonisJS Core Team. It comes packaged with everything you need for testing NodeJS applications including plugins for API, OpenAPI, browser tests and more.

0 Series
33 Lessons
AdonisJS Testing
Video preview
Browser Authentication
Video preview

Authentication in Browser Tests

In this final lesson, we'll learn how to use AdonisJS Authentication with the Browser Client. We'll install and configure the Session and Auth browser plugins and visit an auth-protected page to show how it all works.

Video preview
Subitting Forms
Video preview

Testing Browser Form Submissions & Validation Feedback

In this lesson, we'll learn how to test form submissions and validation using Japa's Browser Client and Playwright. We'll programmatically fill and submit our form and assert the visibility and contents of our validation errors.

Video preview
The Browser Client
Video preview

The Browser Client

In this lesson, we'll softly introduce Browser Testing, which allows powerful DOM assertions, in AdonisJS using Japa's Browser Client and Playwright. We'll get everything installed and configured and write our first simple test.

Video preview
Piecing it all together
Video preview

Piecing It All Together

In this lesson, we'll piece everything we've learned thus far together and create functional tests for a route allowing the authenticated user to change their email. This encompasses authentication, email sending, database records, and more

Video preview
Testing Authorization with Bouncer
Video preview

Testing Authorization with Bouncer

In this lesson, we'll learn to test AdonisJS Authentication with Bouncer for actions like deleting a post. We'll cover happy paths where authorization is granted and sad paths where authorization is denied and the action is forbidden.

Video preview
Testing Auth Protected Routes
Video preview

Testing Auth Protected Routes

In this lesson, we'll learn how to test auth-protected routes via the auth middleware and non-auth-protected routes via the guest middleware. We'll ensure our user is redirected appropriately and shown a flash message where applicable

Video preview
The Japa Auth Plugin
Video preview

The Auth Plugin

In this lesson, we'll learn how to test authenticated routes in AdonisJS/Japa. First, we'll install and register the Auth API Client plugin. Then, we'll learn how to use our User Factory to create a user and login as them for our test's request.

Video preview
Testing Model Logic
Video preview

Testing Model Logic

In this lesson, we'll learn how to Unit Test AdonisJS Model logic using Japa. We'll test a password reset token's validity to show instance-level tests. Then, we'll test its generate and verify methods to show static methods.

Video preview
Testing with Lucid Model Factories
Video preview

Testing with Lucid Model Factories

In this lesson, we'll learn about AdonisJS Model Factories and how we can use them to create realistic, yet fake, test data. We'll create a few factories we'll use in this series and learn how we can stub or create data with them in tests.