Files
supabase/playwright-tests/scripts/generate-env.js
T
Ivan Vasilov 66ae36e005 feat: Playwright tests (#21083)
* initial commit for testing the github action.

* Improvements to the Github action.

* Add docker caching.

* Fix an issue in the github action.

* Another fix for the action.

* Just delete the db after the tests.

* Add a supabase app to the playwright-tests.

* Delete .env.testing.

* Remove the docker image caching from the Playwright github action.

* Add a README.md.

* Add an example test for the table editor.

* Ignore the generated keys.json.

* Add commands for running and writing tests.

* Remove Auth tests.

* Only show the react-query tool when not in test mode.

* Add data-testids to the buttons and use them in the test.

* Handle a case where SUPABASE_URL isn't defined.

* Fix the button test id.

* Remove some dependency.

* Try setting a timeout for an action.

* Add timeout to another action.

* Add some timeouts before the save button.

* Add some timeout before clicking save.

* Enable the video recording only during local testing.

* Minor fixes.

* Expand the README.
2024-02-19 12:12:54 +01:00

38 lines
1.3 KiB
JavaScript

const fs = require('fs')
const generatedEnv = require('../keys.json')
/**
* This script takes the API keys from the local environment, merges them with some predefined variables and saves them
* to a env.test file in the studio app. This is needed to prepare the studio so that it can be run with the local
* environment as the backend.
*/
const defaultEnv = {
// POSTGRES_PASSWORD: 'postgres',
// NEXT_ANALYTICS_BACKEND_PROVIDER: 'postgres',
// SUPABASE_REST_URL: 'http://127.0.0.1:54321/rest/v1/',
// NEXT_PUBLIC_ENABLE_LOGS: 'false',
// NEXT_PUBLIC_IS_PLATFORM: 'false',
SUPABASE_ANON_KEY: '$ANON_KEY',
SUPABASE_SERVICE_KEY: '$SERVICE_ROLE_KEY',
SUPABASE_URL: '$API_URL',
STUDIO_PG_META_URL: '$API_URL/pg',
SUPABASE_PUBLIC_URL: '$API_URL',
SENTRY_IGNORE_API_RESOLUTION_ERROR: '1',
LOGFLARE_URL: 'http://localhost:54329',
LOGFLARE_API_KEY: 'api-key',
NEXT_PUBLIC_SITE_URL: 'http://localhost:3000',
NEXT_PUBLIC_GOTRUE_URL: '$SUPABASE_PUBLIC_URL/auth/v1',
NEXT_PUBLIC_HCAPTCHA_SITE_KEY: '10000000-ffff-ffff-ffff-000000000001',
NEXT_PUBLIC_NODE_ENV: 'test',
}
const environment = { ...generatedEnv, ...defaultEnv }
fs.writeFileSync(
'../apps/studio/.env.test',
Object.keys(environment)
.map((key) => `${key}=${environment[key]}`)
.join('\n')
)