Strategies for testing Fillin Forge forms in automated environments.
Playwright E2E Tests
// tests/form-forge-contact.spec.js
const { test, expect } = require( '@playwright/test' );
test( 'contact form submits successfully', async ( { page } ) => {
await page.goto( 'http://localhost:8888/contact/' );
// Fill in form fields
await page.fill( '#formforge_field_field_1', 'Test User' );
await page.fill( '#formforge_field_field_2', '[email protected]' );
await page.fill( '#formforge_field_field_3', 'This is a test message.' );
// The timing check refuses a form sent less than 2 seconds after the page was built
await page.waitForTimeout( 2500 );
// Submit
await page.click( '.formforge-submit-btn' );
// Wait for success message
await expect( page.locator( '.formforge-message' ) ).toBeVisible();
await expect( page.locator( '.formforge-message' ) ).toContainText( 'Thank you' );
} );PHP Unit Tests for Your Own Listeners
Fillin Forge has no hook that runs before a submission is saved, so there is nothing to simulate there. What you can test is your own listener of formforge/submission_created, by calling the action with a payload of the same shape. This does not run Fillin Forge itself.
class FormForge_Listener_Test extends WP_UnitTestCase {
public function test_listener_receives_the_payload() {
$seen = null;
add_action( 'formforge/submission_created', function ( $submission_id, $payload ) use ( &$seen ) {
$seen = [ $submission_id, $payload['form_id'] ];
}, 10, 2 );
do_action( 'formforge/submission_created', 108, [
'form_id' => 42,
'form_title' => 'Contact',
'fields' => [ 'field_1' => 'Test User' ],
'user_id' => 0,
'ip_hash' => '',
'created_at' => '2026-10-11 09:30:00',
] );
$this->assertSame( [ 108, 42 ], $seen );
}
}Testing Webhooks
There is no PHP or WP-CLI function that submits a form. Submit the real form on the page, as in the Playwright test above, with the webhook URL pointing at a request inspector, and read the result of the call in the log:
wp option get formforge_webhook_log --format=jsonThe Send a test submission button of the form builder sends the notification email only. It does not call webhooks or integrations and does not fire formforge/submission_created.
Checking Submission Counts via WP-CLI
wp db query "SELECT form_id, COUNT(*) as total FROM wp_formforge_submissions WHERE status NOT IN ('abandoned', 'test') GROUP BY form_id"