mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
* feat(tests): First test from torture to meet.
* squash: Fixes logging as per comments.
* squash: Fixes some eslint errors.
* squash: Drop no needed await and async declarations.
* squash: Simplify syntax.
* squash: Disable blur everywhere not only FF.
* squash: Use allSettled.
* squash: Prettify intervals and timeouts.
* squash: Use uuids for torture rooms.
* squash: Introduce helper methods in Participant for toolbar and filmstrip.
* squash: Changes headless resolution to a standard 720p.
* squash: Adds env BASE_URL.
* squash: Fix some eslint errors.
* squash: Fix js error.
* squash: Fix participant logs.
* squash: Move bag to Promise.all.
* squash: More types thing.
* squash: Fix more ts errors.
* squash: Bumps version to include 6d146cd332
* squash: More ts stuff.
* squash: Fixes last ts errors.
* squash: Drop eslint rule.
* squash: Update default configs.
* squash: Drop and docs eslint.
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import fs from 'node:fs';
|
|
|
|
/**
|
|
* A prefix to use for all messages we add to the console log.
|
|
*/
|
|
export const LOG_PREFIX = '[MeetTest] ';
|
|
|
|
/**
|
|
* Initialize logger for a driver.
|
|
*
|
|
* @param {WebdriverIO.Browser} driver - The driver.
|
|
* @param {string} name - The name of the participant.
|
|
* @param {string} folder - The folder to save the file.
|
|
* @returns {void}
|
|
*/
|
|
export function initLogger(driver: WebdriverIO.Browser, name: string, folder: string) {
|
|
// @ts-ignore
|
|
driver.logFile = `${folder}/${name}.log`;
|
|
driver.sessionSubscribe({ events: [ 'log.entryAdded' ] });
|
|
|
|
driver.on('log.entryAdded', (entry: any) => {
|
|
try {
|
|
// @ts-ignore
|
|
fs.appendFileSync(driver.logFile, `${entry.text}\n`);
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Returns the content of the log file.
|
|
*
|
|
* @param {WebdriverIO.Browser} driver - The driver which log file is requested.
|
|
* @returns {string} The content of the log file.
|
|
*/
|
|
export function getLogs(driver: WebdriverIO.Browser) {
|
|
// @ts-ignore
|
|
if (!driver.logFile) {
|
|
return;
|
|
}
|
|
|
|
// @ts-ignore
|
|
return fs.readFileSync(driver.logFile, 'utf8');
|
|
}
|
|
|
|
/**
|
|
* Logs a message in the logfile.
|
|
*
|
|
* @param {WebdriverIO.Browser} driver - The participant in which log file to write.
|
|
* @param {string} message - The message to add.
|
|
* @returns {void}
|
|
*/
|
|
export function logInfo(driver: WebdriverIO.Browser, message: string) {
|
|
// @ts-ignore
|
|
if (!driver.logFile) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
// @ts-ignore
|
|
fs.appendFileSync(driver.logFile, `${new Date().toISOString()} ${LOG_PREFIX} ${message}\n`);
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
}
|
|
|