✨ feat: implement new feature for enhanced user experience
This commit is contained in:
37
tests/global-teardown.ts
Normal file
37
tests/global-teardown.ts
Normal 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
|
||||
Reference in New Issue
Block a user