test: Fix form E2E timeouts by using JS native click to bypass overlays
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 26s
Build & Deploy / 🧪 QA (push) Failing after 2m24s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 6s

This commit is contained in:
2026-03-11 14:54:21 +01:00
parent 678ca784a1
commit 040809812a

View File

@@ -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);