🔧 Update Playwright config and tests to use env variables (#1266)

This commit is contained in:
Alejandra
2024-07-23 14:59:39 -05:00
committed by GitHub
parent aff2146d7e
commit 06a2ec8a2b
7 changed files with 54 additions and 9 deletions

21
frontend/tests/config.ts Normal file
View File

@@ -0,0 +1,21 @@
import dotenv from 'dotenv';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
dotenv.config({ path: path.join(__dirname, '../../.env') });
const { FIRST_SUPERUSER, FIRST_SUPERUSER_PASSWORD } = process.env;
if (typeof FIRST_SUPERUSER !== "string") {
throw new Error("Environment variable FIRST_SUPERUSER is undefined");
}
if (typeof FIRST_SUPERUSER_PASSWORD !== "string") {
throw new Error("Environment variable FIRST_SUPERUSER_PASSWORD is undefined");
}
export const firstSuperuser = FIRST_SUPERUSER as string;
export const firstSuperuserPassword = FIRST_SUPERUSER_PASSWORD as string;