test: enhance console error logging with type tags

This commit is contained in:
Carlos Santos 2025-05-14 16:06:10 +02:00
parent 39beed3172
commit 16d9a0e205

View File

@ -23,9 +23,9 @@ test.describe('Web Component E2E Tests', () => {
test.beforeEach(async ({ page }) => {
if (!subscribedToAppErrors) {
page.on('console', (msg) => {
if (msg.type() === 'error') {
console.error(`Console Error: ${msg.text()}`);
}
const type = msg.type();
const tag = type === 'error' ? 'ERROR' : type === 'warning' ? 'WARNING' : 'LOG';
console.log('[' + tag + ']', msg.text());
});
subscribedToAppErrors = true;
}