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:
parent
4047af0e96
commit
35e804e979
2 changed files with 13 additions and 5 deletions
|
|
@ -215,7 +215,7 @@ npx playwright test
|
||||||
npx playwright test tests/0000__M.test.ts
|
npx playwright test tests/0000__M.test.ts
|
||||||
|
|
||||||
### Run tests with specific tag (cognitive approach)
|
### Run tests with specific tag (cognitive approach)
|
||||||
npx playwright test --grep "@smoke"
|
npx playwright test --grep "@Alert"
|
||||||
|
|
||||||
## Test Reports
|
## Test Reports
|
||||||
Test results are available in:
|
Test results are available in:
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,26 @@
|
||||||
import { defineConfig, devices } from '@playwright/test';
|
import { defineConfig, devices } from '@playwright/test';
|
||||||
import dotenv from 'dotenv-safe';
|
import dotenv from 'dotenv-safe';
|
||||||
import { OrtoniReportConfig } from "ortoni-report";
|
import { OrtoniReportConfig } from "ortoni-report";
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
if (!process.env.CI) {
|
if (!process.env.CI) {
|
||||||
// Environment variables are present in CI environment, no need to read from file
|
// 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) {
|
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 {
|
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.
|
* Read environment variables from file.
|
||||||
* https://github.com/motdotla/dotenv
|
* https://github.com/motdotla/dotenv
|
||||||
|
|
@ -27,7 +35,7 @@ if (!process.env.CI) {
|
||||||
const reportConfig: OrtoniReportConfig = {
|
const reportConfig: OrtoniReportConfig = {
|
||||||
port: 1994,
|
port: 1994,
|
||||||
open: "never",
|
open: "never",
|
||||||
folderPath: "playwright-tests/artifacts/test-results",
|
folderPath: "artifacts/test-results",
|
||||||
filename: "index.html",
|
filename: "index.html",
|
||||||
logo: "../data/logo.png",
|
logo: "../data/logo.png",
|
||||||
title: "Test Report",
|
title: "Test Report",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue