Files
supabase/playwright-tests
Ivan Vasilov 5847ad54cf fix: Test the playwright tests in Github actions (#26799)
* Add an API page for run-lints endpoint.

* Fix the playwright test.

* Make the check mandatory in the github action.

* Fix a console.log.

* Use a more stable way of waiting for buttons before clicking them.

* Add helper method for dismissing toasts.

* Wait for the other toast.

* Try and fix the flakiness of the toasts.

* Minor fix.

* Upload artifacts at the end of the github action run.

* Fix yaml stuff.

* Use the newer action for uploading. Shorten the retention period to 7 days.

* Add waitForResponse for the entity types API call.

* snapshot.

* Wait for the page to be loaded.

* Make the timeout bigger when waiting for response.

* Try to fix the timeouts.

* Minor restructuring of the test.

* Add another test and few minor todo tests.

* Fix the table names.

* Don't render hcaptcha in test mode.

* Expand the test to include sorting and filtering.

* Add a test for checking if the other schemas are can be listed.

* Make the sort popover button more stable.

* Fix a unused forward ref in the NavMenuItem component.

* Don't render the Toaster container when in test mode.

* Simplify starting the dev server when testing.

* Fix all inputs to have proper test ids.

* Fix the command for testing.
2024-06-07 17:44:28 +02:00
..
2024-02-19 12:12:54 +01:00
2024-02-19 12:12:54 +01:00
2024-02-19 12:12:54 +01:00
2024-02-19 12:12:54 +01:00
2024-02-19 12:12:54 +01:00

Local studio tests

In an effort to make the local studio more stable, we've added tests which test features which are commonly used in local development. Built with Playwright.

How to run tests

Before running the tests, make sure you've done the following:

  • Run npm install in the root folder of this repo
  • docker or orbstack is currently running
  • supabase CLI is already installed
  • no other supabase local environment is running (infrastructure environment is ok)

You can run the tests by running npm run test in this folder.

When you run the command, it includes:

  1. Setting up the local environment using the supabase CLI
  2. Extracting the environment variables and saving them into a .env.test file in the studio app
  3. Running the studio app in dev mode (npm run dev)
  4. Running the tests
  5. Stopping the studio app and the local environment

If the environment does't stop for some reason, you'll see supabase start is already running on the next run. In this case, just run supabase stop between test runs.

How to write tests

Playwright has a nice Codegen tool which you can use to record your actions:

npm run codegen:setup
# in a separate terminal
npm run codegen

How to debug/fix tests

If you've run the tests locally and you want to see the results, Playwright has a UI mode which you can use to run and replay specific tests:

npm run test -- --ui

It will also record any failing tests when running npm run test in this folder.