Updates environment config and test grep

Updates the environment configuration to correctly resolve the .env files path.
Also updates the test grep in README to use Alert tag.
This commit is contained in:
maguire-arman 2025-05-08 16:31:43 -04:00
parent 4047af0e96
commit 35e804e979
2 changed files with 13 additions and 5 deletions

View file

@ -215,7 +215,7 @@ npx playwright test
npx playwright test tests/0000__M.test.ts
### Run tests with specific tag (cognitive approach)
npx playwright test --grep "@smoke"
npx playwright test --grep "@Alert"
## Test Reports
Test results are available in:

View file

@ -1,18 +1,26 @@
import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv-safe';
import { OrtoniReportConfig } from "ortoni-report";
import path from 'path';
if (!process.env.CI) {
// Environment variables are present in CI environment, no need to read from file
const basePath = __dirname; // This gets the directory where the config file is located
if (process.env.NODE_ENV == 'undefined' || process.env.NODE_ENV == null) {
dotenv.config({ path: `playwright-tests/.env.dev`, example: 'playwright-tests/.env.example' });
dotenv.config({
path: path.join(basePath, '.env.dev'),
example: path.join(basePath, '.env.example')
});
}
else {
dotenv.config({ path: `playwright-tests/.env.${process.env.NODE_ENV}`, example: 'playwright-tests/.env.example' });
dotenv.config({
path: path.join(basePath, `.env.${process.env.NODE_ENV}`),
example: path.join(basePath, '.env.example')
});
}
}
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
@ -27,7 +35,7 @@ if (!process.env.CI) {
const reportConfig: OrtoniReportConfig = {
port: 1994,
open: "never",
folderPath: "playwright-tests/artifacts/test-results",
folderPath: "artifacts/test-results",
filename: "index.html",
logo: "../data/logo.png",
title: "Test Report",