Days 2025 Sven Liebert Presentation scope • Short introduction into TYPO3 headless • Introduction into Playwright • Setting up Playwright • Write simple and advanced tests • Quick look into CI integration • ”Best practices” • Challenges/Problems
Days 2025 Sven Liebert Introduction Since beginning 2025 we develop a large headless project, which had the need to be tested. We had to gain knowledge and onboard our colleagues.
Days 2025 Sven Liebert But why not only Functional Tests?! Problem: No real HTTP requests • mocking errors • not checking network access ways • no possibility to run E2E-tests
Days 2025 Sven Liebert Why playwright? Supports UI and API testing Powerful features Tracing Mocking Authentication Parallelization Developer experience Multiple languages Simple setup Good debug tools Native Cross-Browser Testing Use native Browser APIs iFrame & Shadow-DOM-Support Is that the solution of all our problems? Unfortunately, no
Days 2025 Sven Liebert Setting up Playwright local machine • Needs NodeJS and NPM locally • Just follow the Playwright docs Docker • use official image from Microsoft • use same image in local and CI ddev extension • ddev extension from Julien Loizelet • provides an easy ddev wrapper for playwright cli commands
Days 2025 Sven Liebert More advanced scenarios • test features with multiple roles/user groups/states with fixtures • usage of setup/teardown logic (e.g. delete all mailpit mails before starting the tests run)
Days 2025 Sven Liebert Quick look into CI integration Short answer: Do it like locally. Grab the docker image, install the npm packages and run your tests
Days 2025 Sven Liebert Isolate your tests „Best practices“ Avoid things like • use result of other tests before • rely on data changed it in tests before • rely on data you not imported before in general
Days 2025 Sven Liebert Write tests with AI, but check the value „Best practices“ You can let AI write your tests, but … • is it worth to have a test for this? • what is the AI leaves missing? • what is maybe a wrong developed test?
Days 2025 Sven Liebert Run the tests. Not manually. Automatically „Best practices“ Nothing is more useless than tests, that are not executed automatically. Run and review your tests
Days 2025 Sven Liebert Isolate your tests „Best practices“ Use the power of parallel execution Reuse authentication states Write tests with AI, but check the value Run the tests. Not manually. Automatically
Days 2025 Sven Liebert Challenges with Playwright Concurrency of session related stuff e.g. log in into external application with OAuth concurrent Prepare your data for API tests No easy way to configure database fixtures Steep learning curve Can be complex to handle multiple user roles and states → Use different users or use authentication session per worker → Adjust the tests or export/import the database → Just try it! ☺
Days 2025 Sven Liebert Further resources • TYPO3 Headless Extension: https://github.com/TYPO3-Initiatives/headless • Playwright Documentation: https://playwright.dev/ • Playwright API Testing Documentation: https://playwright.dev/docs/api-testing • Just write your first test and try it out: https://playwright.dev/docs/writing- tests#first-test Demo Repo from this talk