Fix Playwright BASE_URL handling and failed UAT report tests

This commit is contained in:
A R R R Associates
2026-06-26 20:38:14 +05:30
parent 21c90749fb
commit ce9935c684
21 changed files with 98 additions and 53 deletions
+26
View File
@@ -0,0 +1,26 @@
require('dotenv').config();
const DEFAULT_BASE_URL = 'https://erp-test.vavalam.com';
function normalizeBaseURL(value) {
const raw = (value || '').trim() || DEFAULT_BASE_URL;
return raw.replace(/\/+$/, '');
}
const BASE_URL = normalizeBaseURL(
process.env.BASE_URL ||
process.env.APP_BASE_URL ||
process.env.PLAYWRIGHT_BASE_URL ||
DEFAULT_BASE_URL
);
function absoluteUrl(route = '/') {
if (/^https?:\/\//i.test(route)) return route;
return new URL(route, `${BASE_URL}/`).toString();
}
module.exports = {
BASE_URL,
DEFAULT_BASE_URL,
absoluteUrl,
};