feat: implement new feature for enhanced user experience

This commit is contained in:
2026-02-11 16:36:56 +00:00
parent 62f1906276
commit dc00d24899
75 changed files with 2456 additions and 35 deletions

37
tests/global-teardown.ts Normal file
View File

@@ -0,0 +1,37 @@
/**
* Playwright Global Teardown
*
* Runs once after all tests. Use this to:
* - Clean up test data
* - Dispose singleton API contexts
*
* Customize for your project's cleanup needs.
*/
import { cleanupAllTestData, disposeAdminApi } from "./api/helpers/admin-api"
import { deleteAllEmails, disposeMailDev } from "./api/helpers/maildev"
async function globalTeardown() {
const baseURL = process.env.CODING_URL || "https://localhost:3000"
// Clean up test users
try {
const result = await cleanupAllTestData(baseURL)
if (result.users > 0) {
console.log(`🧹 Cleanup: ${result.users} test users deleted`)
}
} catch (err) {
console.warn("⚠️ Test data cleanup failed:", err)
}
// Clean up MailDev emails (optional)
try {
await deleteAllEmails()
} catch {
// MailDev cleanup is optional
}
// Dispose singleton API contexts
await Promise.all([disposeAdminApi(), disposeMailDev()])
}
export default globalTeardown