# Test buttons and forms

- Check 45.08 · UX and conversion · Important
- Source: https://checklist-seo-geo.com/en/ux-conversion/test-buttons-forms
- Test every button and form end to end: submission, email delivery, errors, spam protection, keyboard and tracking, then automate the check with Playwright.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/ux-conversion/test-buttons-forms.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

A form can display perfectly and send nothing: the email lands in spam, the destination address is out of date, spam protection blocks real visitors, a button breaks after a plugin update. Testing buttons and forms means checking end to end that every action succeeds, all the way to the person who has to handle the request, and that tracking counts each submission exactly once. The deliverable is a completed test grid, rerun at every release, and an automated test that raises an alert when a journey breaks.

## Why it matters

Form failures are silent. Nobody complains about a message that never arrived: the visitor thinks you do not reply, and you think the site no longer generates requests. The causes are mundane and common:

- **sending emails** from the web server without domain authentication, so they end up in spam or are rejected;
- **a destination address** belonging to a former employee or to a deleted mailbox;
- **an update** to a theme, plugin or JavaScript library that breaks a button;
- **badly configured spam protection** that also rejects humans;
- **the consent banner** blocking a script the form depends on;
- **a journey hosted by a third-party provider** (appointment booking, payment) that is changed without notice.

All the work on visibility in traditional search and in AI assistants is lost at this last step if it does not work.

## What it improves

- **Conversion**: no request or sale lost to a technical failure.
- **Response time**: requests reach the right person, not the spam folder.
- **Measurement**: one conversion event per real submission, no more, no less.
- **Accessibility**: forms usable with the keyboard and with a screen reader.
- **Compatibility with AI agents**: correctly named buttons and fields that can be operated without a mouse. A plausible effect, not measured.
- **Rankings**: no direct effect.

## How to check

**1. Compare submissions with the requests received.** Over a month, reconcile the number of conversion events in your analytics tool, the number of messages received in the destination mailbox or the CRM, and the number of entries recorded by the form if it stores them. Large gaps point to a failure or to skewed tracking.

**2. Look for clicks with no effect.** In Microsoft Clarity, filter sessions with dead clicks or JavaScript errors occurring after a click, on form pages.

**3. Make a real submission** with an identifiable address (`test-formulaire@example.com`) and check that it arrives, how long it takes and in which folder.

**4. Check the authentication of the sending domain**:

```bash
dig +short TXT example.com | grep -i spf
dig +short TXT _dmarc.example.com
```

An SPF record that does not include the service that actually sends the site's emails, or a missing DMARC record, often explains lost messages.

## How to implement

### Step 1 — List buttons and forms

| Element | Page(s) | Expected action | Recipient | Tracked event | Priority |
|---|---|---|---|---|---|
| Quote form | `/devis/` | Email to the team + acknowledgment to the customer | devis@example.com | `generate_lead` | 1 |
| “Add to cart” button | Product pages | Product added, cart counter updated | — | `add_to_cart` | 1 |
| Payment | `/commande/` | Order created, confirmation email | Customer + shop | `purchase` | 1 |
| Call link | Header | Dialer opens | — | `click_tel` | 2 |
| Newsletter sign-up | Footer | Contact added, confirmation email | Email marketing tool | `newsletter_signup` | 3 |

Sample values. Do not forget secondary forms (complaints, job applications, product returns) and journeys hosted by third-party providers.

### Step 2 — Test manually with a grid

On up-to-date Chrome, Firefox, Safari and Edge, on desktop, then on an iPhone and an Android phone (mobile details are in [test mobile forms and conversions](https://checklist-seo-geo.com/en/mobile-first-responsive-design/test-mobile-forms-conversions)):

| Check | Passes if |
|---|---|
| Valid submission | Visible confirmation message, as text, with what happens next (“Reply within 24 working hours”) |
| Delivery | Message received in the right mailbox, not in spam, in less than five minutes |
| Acknowledgment | Received by the visitor, with the right name, with no raw tag such as `[your-name]` |
| Empty required field | Text error next to the field, input preserved, focus on the first field in error |
| Invalid email | Explicit error, not just a red border |
| Double click on the button | Only one request sent |
| Keyboard only | All fields and the button reachable with Tab, submission with Enter. See [test keyboard navigation](https://checklist-seo-geo.com/en/semantic-html-accessibility/test-keyboard-navigation) |
| Cookies refused | The form works after “Reject all” |
| Spam protection | A human gets through without a difficult challenge; a crude automated submission is blocked |
| Tracking | A single conversion event, visible in GA4 DebugView |
| Links and buttons | No dead link or button without effect on the pages of the journey |

For tracking, turn on debug mode with Tag Assistant or Tag Manager's Preview mode, then open `Admin > Data display > DebugView` in Google Analytics 4: the event must appear once per submission. See [fix duplicate conversions](https://checklist-seo-geo.com/en/tracking-analytics-setup/fix-duplicate-conversions).

> **Warning:** tests in production create real requests and sometimes real orders. Warn the team, use an identifiable test address and cancel the orders, or test on a staging site identical to production.

### Step 3 — Make email sending reliable

- **Send through an authenticated service** (the SMTP server of your business email or a transactional email service), not through the server's default mail function.
- **A sender address on your domain** (`site@example.com`), with the visitor's address as Reply-To; a sender in the visitor's name (`visiteur@gmail.com`) fails authentication checks.
- **SPF, DKIM and DMARC** configured for the sending service, following its documentation.
- **A shared destination address** (`devis@example.com`) rather than a personal mailbox, checked by at least two people.
- **A copy of the requests** stored somewhere other than in email (database, CRM, storage plugin), so nothing is lost if the email system fails.

### Step 4 — Automate a regression test

A Playwright test replays the journey in Chromium, Firefox and WebKit at every release. File `tests/devis.spec.ts`, on a staging site:

```ts
import { test, expect } from '@playwright/test';

test('the quote form goes through', async ({ page }) => {
  await page.goto('https://preprod.example.com/devis/');

  await page.getByLabel('Name').fill('Automated test');
  await page.getByLabel('Email').fill('test-formulaire@example.com');
  await page.getByLabel('Postcode of the property').fill('44000');
  await page.getByRole('radio', { name: 'Servicing' }).check();
  await page.getByRole('button', { name: 'Get my quote' }).click();

  await expect(page.getByText('Thank you')).toBeVisible();
});

test('an error is shown if the email is invalid', async ({ page }) => {
  await page.goto('https://preprod.example.com/devis/');

  await page.getByLabel('Email').fill('adresse-invalide');
  await page.getByRole('button', { name: 'Get my quote' }).click();

  await expect(page.getByText('Check the email address')).toBeVisible();
});
```

`playwright.config.ts` configuration for the three browser engines:

```ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
    { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
    { name: 'webkit', use: { ...devices['Desktop Safari'] } },
  ],
});
```

Run it with `npx playwright test`. The `getByLabel` and `getByRole` locators fail if a label or a button name disappears: along the way, the test also checks part of the accessibility. To integrate it into deployment, see [integrate SEO, performance and accessibility tests into CI/CD](https://checklist-seo-geo.com/en/automation-quality-control/integrate-seo-performance-accessibility-tests-into-ci-cd).

Complete this with a regular broken-link crawl using Screaming Frog (free up to 500 URLs). See [fix broken links](https://checklist-seo-geo.com/en/internal-linking/fix-broken-links).

### Step 5 — Monitor continuously

- **A weekly control submission**, manual or automated, to a test address: if it does not arrive, an alert goes out.
- **An alert on falling conversions**: GA4 lets you create custom insights sent by email, for example when the count of a key event drops sharply from one week to the next. Labels change over time: refer to the Google Analytics Help Center.
- **A full test after every update** to the theme, a plugin, the CMS or the payment provider.

### WordPress

Versions: WordPress 6.4 and later, with the current versions of the plugins mentioned.

- **Contact Form 7**: in `Contact > Contact Forms`, Mail tab, check the recipient, put an address on your domain in From and the visitor's address in Additional Headers (`Reply-To: [your-email]`). Contact Form 7 does not store messages: the Flamingo plugin, by the same author, keeps them in the admin.
- **Gravity Forms**: entries are stored in `Forms > Entries`; emails are set in the form settings, under Notifications.
- **WPForms**: notifications are set in the form settings; entry storage depends on the plan.
- **Email sending**: WP Mail SMTP routes WordPress emails through an SMTP provider or a sending API, and offers an email test page in its free version.
- **Spam protection**: Contact Form 7, Gravity Forms and WPForms offer integrations with protections such as reCAPTCHA or Cloudflare Turnstile; after enabling one, make a human submission again, including with cookies refused.
- **WooCommerce**: place a test order using your payment gateway's test mode, then check the emails in `WooCommerce > Settings > Emails`.

### Shopify

Versions: Shopify admin, all plans, November 2026.

Messages from the theme's contact form are sent to the store's sender email address, which you can change in the notification settings (`Settings > Notifications`). Shopify filters spam based on message content and prefixes suspicious messages with `[SPAM]` in the subject: create a filter in your mailbox rather than deleting them unread. To test payment without charging, enable Shopify Payments test mode or the test gateway (Bogus Gateway) in `Settings > Payments`, then turn it off after the test.

### Laravel

Versions: Laravel 12 and 13; example written with Pest.

Test that the request is validated and stored and that the email goes out, without sending a real message. File `tests/Feature/QuoteFormTest.php`:

```php
<?php

use App\Mail\QuoteRequested;
use Illuminate\Support\Facades\Mail;

test('a valid quote request is stored and emailed', function () {
    Mail::fake();

    $this->post('/devis', [
        'type' => 'entretien',
        'code_postal' => '44000',
        'nom' => 'Test automatique',
        'email' => 'test-formulaire@example.com',
    ])->assertRedirect('/devis/merci');

    $this->assertDatabaseHas('quotes', ['email' => 'test-formulaire@example.com']);

    Mail::assertSent(QuoteRequested::class, 'devis@example.com');
});

test('an invalid email is rejected', function () {
    $this->post('/devis', ['email' => 'adresse-invalide'])
        ->assertSessionHasErrors(['email', 'code_postal', 'nom', 'type']);
});
```

Run it with `php artisan test`. In production, send emails through a queue and monitor failed jobs (`php artisan queue:failed`): an email that fails in the queue is a lost request if nobody looks.

### Next.js

Versions: Next.js 15 and 16 (App Router).

With a Server Action, return an explicit state (success or per-field errors) rather than a simple reload, and disable the button while submitting to avoid duplicates:

```tsx
'use client';

import { useActionState } from 'react';
import { requestQuote } from './actions';

export function QuoteForm() {
  const [state, formAction, pending] = useActionState(requestQuote, { ok: false, errors: {} });

  if (state.ok) {
    return <p role="status">Thank you, your request has been sent. Reply within 24 working hours.</p>;
  }

  return (
    <form action={formAction}>
      <label htmlFor="email">Email</label>
      <input id="email" name="email" type="email" autoComplete="email" aria-describedby="email-erreur" required />
      {state.errors.email && <p id="email-erreur">{state.errors.email}</p>}

      <button type="submit" disabled={pending}>Get my quote</button>
    </form>
  );
}
```

The same Playwright test from step 4 applies as is.

## Common mistakes

- **Testing the display, not the delivery**: the “Thank you” message appears, but the email never arrives.
- **Sending emails “on behalf of” the visitor**: they fail SPF and DMARC checks.
- **A single recipient**, who is away or has left the company.
- **No copy of the requests** outside the email system.
- **Enabling a CAPTCHA without testing again as a human**, on mobile and with cookies refused.
- **Testing only after the initial launch**, never after updates.
- **Leaving payment test mode on** after a test order, or forgetting to cancel test orders.

## Frequently asked questions

### Why do emails from my contact form go to spam?

Most often, the site sends emails through the server's default function, without domain authentication, or with the visitor's address as the sender. Mail providers then reject these messages or file them as spam. Send through an authenticated SMTP or transactional service, use an address on your domain as the sender, put the visitor's address in Reply-To, and configure SPF, DKIM and DMARC.

### How often should a site's forms be tested?

Test every important form after any update to the theme, a plugin, the CMS, the payment provider or the consent tool, and otherwise at least once a month. Ideally, run an automated test, for example with Playwright, at every release, plus a weekly control submission to a test address that triggers an alert if it does not arrive.

### How can I test a payment without paying?

Use your payment provider's test mode: Shopify Payments and Shopify's test gateway, or the test mode of WooCommerce gateways, accept test card numbers published by the provider. Place the order end to end, check the confirmation page, the emails and the purchase event, then turn off test mode and delete the test orders.

### How do I check that a conversion is not counted twice?

Turn on debug mode with Tag Assistant or Tag Manager's Preview mode, submit the form once, then open DebugView in the Google Analytics 4 admin. The event must appear only once. Then reload the confirmation page: no new event should appear. A duplicate often comes from a tag fired both on submission and on the thank-you page.

## Resources

- [Playwright: Installation](https://playwright.dev/docs/intro)
- [Google Analytics Help: Monitor events in DebugView](https://support.google.com/analytics/answer/7201382?hl=en)
- [Laravel: Testing mailable sending](https://laravel.com/docs/13.x/mail#testing-mailable-sending)
- [Shopify Help Center: Adding a contact page](https://help.shopify.com/en/manual/online-store/themes/customizing-themes/add-contact-page)
- [WP Mail SMTP on WordPress.org](https://wordpress.org/plugins/wp-mail-smtp/)
- [Cloudflare: Turnstile documentation](https://developers.cloudflare.com/turnstile/)
- [W3C WAI: Forms Tutorial](https://www.w3.org/WAI/tutorials/forms/)

Next steps: [test internal search](https://checklist-seo-geo.com/en/ux-conversion/test-internal-search) and [test purchase and booking journeys](https://checklist-seo-geo.com/en/ux-conversion/test-purchase-booking-journeys).
