test: refine E2E form verification with German error keyword support
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 10s
Build & Deploy / 🧪 QA (push) Successful in 2m23s
Build & Deploy / 🏗️ Build (push) Successful in 3m49s
Build & Deploy / 🚀 Deploy (push) Successful in 23s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 5m17s
Build & Deploy / 🔔 Notify (push) Successful in 2s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 10s
Build & Deploy / 🧪 QA (push) Successful in 2m23s
Build & Deploy / 🏗️ Build (push) Successful in 3m49s
Build & Deploy / 🚀 Deploy (push) Successful in 23s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 5m17s
Build & Deploy / 🔔 Notify (push) Successful in 2s
This commit is contained in:
@@ -143,11 +143,12 @@ async function main() {
|
||||
const alertText = await page.$eval('[role="alert"]', (el) => el.textContent);
|
||||
console.log(` Alert text: ${alertText}`);
|
||||
|
||||
if (alertText?.includes('Failed') || alertText?.includes('went wrong')) {
|
||||
throw new Error(`Form submitted but showed error: ${alertText}`);
|
||||
const errorKeywords = ['Failed', 'went wrong', 'fehlgeschlagen', 'schief gelaufen'];
|
||||
if (errorKeywords.some((kw) => alertText?.toLowerCase().includes(kw.toLowerCase()))) {
|
||||
throw new Error(`Form submitted but showed error state: ${alertText}`);
|
||||
}
|
||||
|
||||
console.log(`✅ Contact Form submitted successfully! (Success state verified)`);
|
||||
console.log(`✅ Contact Form submitted successfully! (Success state verified via alert text)`);
|
||||
} catch (err: any) {
|
||||
console.error(`❌ Contact Form Test Failed: ${err.message}`);
|
||||
hasErrors = true;
|
||||
@@ -196,11 +197,14 @@ async function main() {
|
||||
const alertText = await page.$eval('[role="alert"]', (el) => el.textContent);
|
||||
console.log(` Alert text: ${alertText}`);
|
||||
|
||||
if (alertText?.includes('Failed') || alertText?.includes('went wrong')) {
|
||||
throw new Error(`Form submitted but showed error: ${alertText}`);
|
||||
const errorKeywords = ['Failed', 'went wrong', 'fehlgeschlagen', 'schief gelaufen'];
|
||||
if (errorKeywords.some((kw) => alertText?.toLowerCase().includes(kw.toLowerCase()))) {
|
||||
throw new Error(`Product Quote Form submitted but showed error state: ${alertText}`);
|
||||
}
|
||||
|
||||
console.log(`✅ Product Quote Form submitted successfully! (Success state verified)`);
|
||||
console.log(
|
||||
`✅ Product Quote Form submitted successfully! (Success state verified via alert text)`,
|
||||
);
|
||||
} catch (err: any) {
|
||||
console.error(`❌ Product Quote Form Test Failed: ${err.message}`);
|
||||
hasErrors = true;
|
||||
|
||||
Reference in New Issue
Block a user