E2E Tests for a Sign-Up Scenario
Learn how to write end-to-end tests for sign-up scenarios.
We'll cover the following...
We'll cover the following...
With the configuration set up, let’s write our E2E tests for the sign-up scenario.
Test: Successful registration
In this test, we’ll verify if a new user can successfully sign up. We’ll send a request with a unique email and password and expect the system to create a new user account.
DATABASE_USER=postgres
DATABASE_PASSWORD=pwd123
DATABASE_PORT=5432
DATABASE_HOST=localhost
DATABASE_NAME=test_database
JWT_SECRET=*3:DX*5,M2`j_q{n>je6
JWT_EXPIRES_IN=3600E2E test for successful user registration
We’re using request to send a POST request to the /auth/signup endpoint. The .send method includes the new user credentials. We expect a 201 Created status, indicating successful registration, as seen in lines 26–31.
Press the “Run” button to launch the test.
As we can see, ...