This documentation is for a legacy version of Next.js Supabase. For the latest version, please visit the Next.js Supabase Turbo documentation

Running Tests

Learn how to run Cypress E2E tests for your Makerkit application

The Makerkit SaaS boilerplate comes with a set of predefined tests with the following goals:

  1. Verify that the boilerplate application works well
  2. Provide instructions for building your own tests

As your application grows, the tests will inevitably need to be updated and maintained. We hope that our tests will be simple to understand and to change when you will need them.

Running the Next.js development server

First, we have to run the following command to run Next.js with a testing environment (i.e. using .env.test):

npm run dev:test

This command will start a Next.js dev server at http://localhost:3000, so it's important to make sure you have no other Next.js server running at the same port.

Additionally, we have to start the Supabase local instance:

npm run supabase:start

Running Cypress in development mode

While you build your tests, it can be handy to use a windowed version of the Cypress testing suite, so that you can easily retry the tests without having to re-run the while tests suite.

To do that, run the following command:

npm run cypress

Running All Cypress tests

Whenever you want to run all your tests at once, you can use the following commands:

npm run cypress:headless

This will run all the tests and exit.

Running Cypress in CI mode

Whenever you want to run all your tests in a CI environment, you can use the following commands:

npm test

The command above will:

  1. Start the Supabase local instance
  2. Start the Next.js environment
  3. Run the tests in headless mode
  4. Exit and close all the processes

As you may have noticed, this is the command to run in your CI environment.


Subscribe to our Newsletter
Get the latest updates about React, Remix, Next.js, Firebase, Supabase and Tailwind CSS