agent-js-playwright
agent-js-playwright copied to clipboard
Console log is flooded with report portal events
Console log is flooded with report portal events like follwing
{"type":"rp:addLog","data":{"level":"TRACE","message":"[7/7/2023 1:08:19 PM] WARNING: Not logged out"}}
can it be disabled?
We have the same issues because these messages are sent to the logging system and are redundant.
I noticed that ReportingApi sends commands (addLog
, setTestCaseId
, etc.) to the stdout
src/reportingApi.ts
log: (
level: LOG_LEVELS = LOG_LEVELS.INFO,
message = '',
file?: Attachment,
suite?: string,
): void => sendEventToReporter(EVENTS.ADD_LOG, { level, message, file }, suite),
src/utils.ts
export const sendEventToReporter = (type: string, data: any, suite?: string): void => {
process.stdout.write(JSON.stringify({ type, data, suite }));
};
And then there's this method in src/reporter.ts that reads stdout:
onStdOut(chunk: string | Buffer, test?: TestCase): void {
try {
const { type, data, suite: suiteName } = JSON.parse(String(chunk));
switch (type) {
...
case EVENTS.SET_TEST_CASE_ID:
this.setTestCaseId(data, test, suiteName);
break;
...
case EVENTS.ADD_LOG:
this.sendTestItemLog(data, test, suiteName);
break;
...
}
} catch (e) {
if (test) {
this.sendTestItemLog({ message: String(chunk) }, test);
}
}
}
I wonder why the events should be printed to the stdout. Maybe @AmsterGet can provide some details
Hi @viktor-maksymenko ! Please check this comment. At the moment attachments and logs are already available through the native Playwright API. We are going to implement attaching the rest of the additional data via testInfo.annotations to avoid this kind of flooding in the near future (ETA is ~1 month). I'll post it in this thread as soon as it's ready.