Fix Playwright BASE_URL handling and failed UAT report tests
This commit is contained in:
@@ -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,
|
||||
};
|
||||
Reference in New Issue
Block a user