@arghajit/playwright-pulse-report 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -3
- package/dist/pulse.d.ts +12 -0
- package/dist/pulse.js +24 -0
- package/dist/reporter/index.d.ts +2 -0
- package/dist/reporter/index.js +5 -1
- package/dist/reporter/playwright-pulse-reporter.d.ts +1 -0
- package/dist/reporter/playwright-pulse-reporter.js +27 -10
- package/dist/types/index.d.ts +3 -0
- package/package.json +7 -7
- package/scripts/config-reader.mjs +100 -52
- package/scripts/generate-email-report.mjs +60 -10
- package/scripts/generate-report.mjs +491 -52
- package/scripts/generate-static-report.mjs +768 -371
- package/scripts/sendReport.mjs +74 -14
package/scripts/sendReport.mjs
CHANGED
|
@@ -252,15 +252,38 @@ const sendEmail = async (credentials, reportDir) => {
|
|
|
252
252
|
try {
|
|
253
253
|
console.log("Starting the sendEmail function...");
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
255
|
+
let secureTransporter;
|
|
256
|
+
const mailHost = credentials.host
|
|
257
|
+
? credentials.host.toLowerCase()
|
|
258
|
+
: "gmail";
|
|
259
|
+
|
|
260
|
+
if (mailHost === "gmail") {
|
|
261
|
+
secureTransporter = nodemailer.createTransport({
|
|
262
|
+
service: "gmail",
|
|
263
|
+
auth: {
|
|
264
|
+
user: credentials.username,
|
|
265
|
+
pass: credentials.password,
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
} else if (mailHost === "outlook") {
|
|
269
|
+
secureTransporter = nodemailer.createTransport({
|
|
270
|
+
host: "smtp.outlook.com",
|
|
271
|
+
port: 587,
|
|
272
|
+
secure: false,
|
|
273
|
+
auth: {
|
|
274
|
+
user: credentials.username,
|
|
275
|
+
pass: credentials.password,
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
} else {
|
|
279
|
+
// Should be caught in main, but safety check here
|
|
280
|
+
console.log(
|
|
281
|
+
chalk.red(
|
|
282
|
+
"Pulse report currently do not support provided mail host, kindly use either outlook mail or, gmail"
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
process.exit(1);
|
|
286
|
+
}
|
|
264
287
|
|
|
265
288
|
const reportData = getPulseReportSummary(reportDir);
|
|
266
289
|
const htmlContent = generateHtmlTable(reportData);
|
|
@@ -399,13 +422,50 @@ const main = async () => {
|
|
|
399
422
|
);
|
|
400
423
|
}
|
|
401
424
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
425
|
+
// --- MODIFIED: Credentials Selection Logic ---
|
|
426
|
+
let credentials;
|
|
427
|
+
|
|
428
|
+
// Check if custom environment variables are provided
|
|
429
|
+
if (
|
|
430
|
+
process.env.PULSE_MAIL_HOST &&
|
|
431
|
+
process.env.PULSE_MAIL_USERNAME &&
|
|
432
|
+
process.env.PULSE_MAIL_PASSWORD
|
|
433
|
+
) {
|
|
434
|
+
const host = process.env.PULSE_MAIL_HOST.toLowerCase();
|
|
435
|
+
|
|
436
|
+
// Validate host immediately
|
|
437
|
+
if (host !== "gmail" && host !== "outlook") {
|
|
438
|
+
console.log(
|
|
439
|
+
chalk.red(
|
|
440
|
+
"Pulse report currently do not support provided mail host, kindly use either outlook mail or, gmail."
|
|
441
|
+
)
|
|
442
|
+
);
|
|
443
|
+
process.exit(1);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
console.log(
|
|
447
|
+
chalk.blue(
|
|
448
|
+
`Using custom credentials from environment variables for ${host}.`
|
|
449
|
+
)
|
|
406
450
|
);
|
|
407
|
-
|
|
451
|
+
credentials = {
|
|
452
|
+
username: process.env.PULSE_MAIL_USERNAME,
|
|
453
|
+
password: process.env.PULSE_MAIL_PASSWORD,
|
|
454
|
+
host: host,
|
|
455
|
+
};
|
|
456
|
+
} else {
|
|
457
|
+
// Fallback to existing fetch mechanism
|
|
458
|
+
credentials = await fetchCredentials(reportDir);
|
|
459
|
+
if (!credentials) {
|
|
460
|
+
console.warn(
|
|
461
|
+
"Skipping email sending due to missing or failed credential fetch"
|
|
462
|
+
);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
// Mark fetched credentials as gmail by default for compatibility
|
|
466
|
+
credentials.host = "gmail";
|
|
408
467
|
}
|
|
468
|
+
// --- END MODIFICATION ---
|
|
409
469
|
// Removed await delay(10000); // If not strictly needed, remove it.
|
|
410
470
|
try {
|
|
411
471
|
await sendEmail(credentials, reportDir);
|