fix: glitchtip errors (locale, email) + E2E submission cleanup
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 10s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 10s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
- Add fallback 'de' locale to toLocaleDateString() to prevent RangeError - Skip sending emails for submissions from 'testing@mintel.me' - Update check-forms.ts to automatically delete test submissions via Payload API - (Manual) Configured MAIL_FROM and MAIL_RECIPIENTS on alpha.mintel.me
This commit is contained in:
@@ -168,9 +168,38 @@ async function main() {
|
||||
hasErrors = true;
|
||||
}
|
||||
|
||||
// 5. Cleanup: Delete test submissions from Payload CMS
|
||||
console.log(`\n🧹 Starting cleanup of test submissions...`);
|
||||
try {
|
||||
const apiUrl = `${targetUrl.replace(/\/$/, '')}/api/form-submissions`;
|
||||
const searchUrl = `${apiUrl}?where[email][equals]=testing@mintel.me`;
|
||||
|
||||
// Fetch test submissions
|
||||
const searchResponse = await axios.get(searchUrl, {
|
||||
headers: { Cookie: `klz_gatekeeper_session=${gatekeeperPassword}` },
|
||||
});
|
||||
|
||||
const testSubmissions = searchResponse.data.docs || [];
|
||||
console.log(` Found ${testSubmissions.length} test submissions to clean up.`);
|
||||
|
||||
for (const doc of testSubmissions) {
|
||||
try {
|
||||
await axios.delete(`${apiUrl}/${doc.id}`, {
|
||||
headers: { Cookie: `klz_gatekeeper_session=${gatekeeperPassword}` },
|
||||
});
|
||||
console.log(` ✅ Deleted submission: ${doc.id}`);
|
||||
} catch (delErr: any) {
|
||||
console.error(` ❌ Failed to delete submission ${doc.id}: ${delErr.message}`);
|
||||
}
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error(`❌ Cleanup failed: ${err.message}`);
|
||||
// Don't mark the whole test as failed just because cleanup failed
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
|
||||
// 5. Evaluation
|
||||
// 6. Evaluation
|
||||
if (hasErrors) {
|
||||
console.error(`\n🚨 IMPORTANT: Form E2E checks failed. The CI build is failing.`);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user