mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-26 19:04:36 +08:00
Co-authored-by: PiX <69745008+pixincreate@users.noreply.github.com> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
/* eslint-disable no-console */
|
|
import { exec } from "child_process";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
import { promisify } from "util";
|
|
|
|
const execAsync = promisify(exec);
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
// This script runs after Cypress tests complete
|
|
async function runPostTestTasks() {
|
|
console.log("🔄 Running post-test tasks...");
|
|
|
|
try {
|
|
// Generate the report
|
|
console.log("📊 Generating test report...");
|
|
const reportGeneratorPath = path.join(__dirname, "report-generator.js");
|
|
await execAsync(`node ${reportGeneratorPath}`);
|
|
|
|
// Open the dashboard in the default browser (optional)
|
|
const dashboardPath = path.join(__dirname, "../dashboard/index.html");
|
|
const openCommand =
|
|
process.platform === "darwin"
|
|
? `open ${dashboardPath}`
|
|
: process.platform === "win32"
|
|
? `start ${dashboardPath}`
|
|
: `xdg-open ${dashboardPath}`;
|
|
|
|
console.log("🌐 Opening dashboard...");
|
|
await execAsync(openCommand);
|
|
|
|
console.log("✅ Post-test tasks completed successfully!");
|
|
} catch (error) {
|
|
console.error("❌ Error in post-test tasks:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the tasks
|
|
runPostTestTasks();
|