diff --git a/scripts/check-forms.ts b/scripts/check-forms.ts index 7449fb78..b26851bf 100644 --- a/scripts/check-forms.ts +++ b/scripts/check-forms.ts @@ -147,7 +147,9 @@ async function main() { // Explicitly click submit and wait for success state (using the success Card role="alert") await Promise.all([ page.waitForSelector('[role="alert"]', { timeout: 15000 }), - page.click('form#contact-form button[type="submit"]'), + page.$eval('form#contact-form button[type="submit"]', (el) => + (el as HTMLButtonElement).click(), + ), ]); const alertText = await page.$eval('[role="alert"]', (el) => el.textContent); @@ -161,6 +163,7 @@ async function main() { console.log(`✅ Contact Form submitted successfully! (Success state verified via alert text)`); } catch (err: any) { console.error(`❌ Contact Form Test Failed: ${err.message}`); + await page.screenshot({ path: 'contact-form-error.png', fullPage: true }); hasErrors = true; } @@ -204,7 +207,9 @@ async function main() { // Submit and wait for success state await Promise.all([ page.waitForSelector('[role="alert"]', { timeout: 15000 }), - page.click('form#quote-request-form button[type="submit"]'), + page.$eval('form#quote-request-form button[type="submit"]', (el) => + (el as HTMLButtonElement).click(), + ), ]); const alertText = await page.$eval('[role="alert"]', (el) => el.textContent);