When creating a JHipster blueprint you usually start with an application and modify it to your needs.
Afterwards you can start to modify existing templates or creating new ones if needed.
As JHipster offers a lot of different options you might need to modify multiple applications in order to get the templates right.
In this post we will integrate Playwright into an existing JHipster application.
You can find the example code on github.
Generate JHipster Application
After installing JHipster you can create an application with default options and Gradle as build system by using the jhipster cli:
jhipster jdl default-gradle
By default no end-2-end testing framework is configured.
As the Playwright blueprint is supposed to replace Cypress as end-2-end testing framework it is a good idea to add it.
To add Cypress to you application you need to modify .yo-rc.json and run the generator again.
As a starting point we look at the existing login-page.spec and try to create the same test with Playwright.
To structure the test the Page Object Model Pattern is used.
All page objects will be stored under src/test/javasript/playwright/models.
The specification files will be located e.g. under src/test/playwright/account.
To avoid really e.g. really changing the password within a test some requests are mocked and replaced with a fixed responses.
This also helps to test failure handling.
With this approach and techniques each Cypress test can be replaced with a corresponding Playwright test.
In the next part we will have a look at how to write Playwright tests for generated entities.