Files
cyberyan_linkedin_search/frontend/e2e/support/env.ts
T
mobiniqow 212074c5f5
CI / Backend (lint, types, tests) (push) Has been cancelled
CI / Frontend (lint, types, build) (push) Has been cancelled
CI / Docker images build (push) Has been cancelled
start project
2026-09-04 12:52:21 +03:30

27 lines
916 B
TypeScript

import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
/**
* Reads the demo analyst credentials straight out of the repo's `.env`
* (created by `make env` from `.env.example`) instead of hard-coding them, so
* the e2e suite keeps working if the seeded demo password ever changes.
*/
function readDotEnv(): Record<string, string> {
const path = fileURLToPath(new URL('../../../.env', import.meta.url));
const text = readFileSync(path, 'utf-8');
const values: Record<string, string> = {};
for (const line of text.split('\n')) {
const match = /^([A-Z0-9_]+)=(.*)$/.exec(line.trim());
const key = match?.[1];
if (key !== undefined) values[key] = match?.[2] ?? '';
}
return values;
}
const env = readDotEnv();
export const DEMO_ANALYST = {
email: env.DEMO_ANALYST_EMAIL ?? 'analyst@example.com',
password: env.DEMO_ANALYST_PASSWORD ?? 'Analyst-Passw0rd!',
};