Playwright Testing for French Public Services and FranceConnect SSO
Test FranceConnect OAuth authentication, French public administration forms, and DNUM digital identity verification in French government apps.
playwright-v1-49-matrix
Playwright Testing for French Public Services and FranceConnect SSO
Region Focus: This guide includes examples specifically relevant to France-based applications.
Test FranceConnect OAuth authentication, French public administration forms, and DNUM digital identity verification in French government apps. This guide provides step-by-step Playwright patterns to handle this scenario reliably.
Introduction
Robust automation requires handling domain-specific patterns effectively. This article covers playwright testing for french public services and franceconnect sso with production-ready Playwright code.
Architecture Overview
graph TD
Service["French Gov Service"] --> FC["FranceConnect"]
FC --> IdP["impots.gouv / ameli"]
IdP --> Token["JWT Token"]
Token --> Data["Pre-filled Data"]Implementation Guide
test('FranceConnect authentication flow works', async ({ page }) => {
await page.goto('/login');
await page.getByRole('button', { name: 'Se connecter avec FranceConnect' }).click();
await page.route('/api.franceconnect.gouv.fr/', route =>
route.fulfill({ status: 302, headers: { location: '/callback?code=FC_CODE' } })
);
await expect(page.getByText('Connecté via FranceConnect')).toBeVisible();
});Run Your Tests
npx playwright test --grep "Playwright Testing for"
npx playwright test --uiReference Table
| FranceConnect IdP | Data Provided | Authentication |
|---|---|---|
| impots.gouv.fr | Tax data | Username/Password |
| ameli.fr | Health data | Card + Code |
| info-retraite.fr | Pension data | Username/Password |
Best Practices
getByRole() and getByLabel() for resilient locators that survive UI changes.await expect(locator).toBeVisible() instead of waitForTimeout()Common Mistakes
| Anti-Pattern | Solution |
| Hardcoded wait times | Use auto-waiting assertions |
| Shared mutable test data | Create unique data per test |
| Testing 3rd party UIs directly | Mock external services |
Frequently Asked Questions
How to test FranceConnect in staging?
Use FranceConnect's sandbox environment at fca.integ01.dev-franceconnect.fr with test credentials.
How to test French administrative form validation?
Test NIR (French social security number) format validation: 13 digits + 2 control digits.
Can Playwright test RGPD (French GDPR) consent?
Yes, test the CNIL-compliant consent banner and verify refusal doesn't block page access.
How to test French address format?
Verify address input accepts N° Rue, Lieu-dit, Code Postal, Commune format.
How to test impots.gouv.fr tax return pre-fill?
Mock the tax API and verify that income and employer details pre-populate the tax form.
Summary
Test FranceConnect OAuth authentication, French public administration forms, and DNUM digital identity verification in French government apps. Apply these patterns to build a reliable, maintainable automation suite for your specific use case.
Related Articles
About The Author
PlaywrightPad Editorial reports on Chromium engines, E2E test optimizations, and AI integration specifications.
Newsletter
Get weekly browser reports sent directly to your inbox.