Add Playwright e2e generator foundation - #33355
Conversation
b9cc9c3 to
09c44fc
Compare
|
Hi, I opened a focused implementation for #13755 adding a new Playwright generator, prompt/namespace wiring, generated config/scripts/docs, and smoke specs for JWT/session login/logout. Local validation passed: check-types, focused eslint, focused esmocha, build, prettier check, and git diff --check. Happy to adjust scope if maintainers prefer a smaller first pass. |
There was a problem hiding this comment.
Pull request overview
Adds an initial Playwright-based end-to-end testing generator to generator-jhipster, integrating it as a selectable client e2e framework alongside Cypress and wiring up the generated project scaffolding (config, linting, scripts, and smoke specs).
Changes:
- Introduces a new
jhipster:playwrightgenerator with templates for Playwright config, ESLint fragment, TS config, support helpers, and account login/logout smoke specs. - Extends client prompting/selection + composition so Playwright can be chosen and composed like Cypress.
- Updates shared typings/options + internal namespace lookup/build-matrix change detection to recognize the new generator.
Reviewed changes
Copilot reviewed 22 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib/types/command-all.d.ts |
Adds Playwright generator config/options types to the aggregated CLI type surface. |
lib/jhipster/test-framework-types.ts |
Introduces PLAYWRIGHT as a recognized test framework type. |
lib/jhipster/application-options.ts |
Adds Playwright to testFrameworks option values so it’s accepted/serialized consistently. |
generators/types.d.ts |
Registers playwright / jhipster:playwright namespaces for generator typing. |
generators/playwright/types.d.ts |
Defines the Playwright generator’s Application/Config/Options types (mirroring Cypress patterns). |
generators/playwright/templates/src/test/javascript/playwright/tsconfig.json.ejs |
Generates a Playwright-specific TS project for specs/support code. |
generators/playwright/templates/src/test/javascript/playwright/support/selectors.ts.ejs |
Provides shared data-cy selectors for Playwright specs. |
generators/playwright/templates/src/test/javascript/playwright/support/login.ts.ejs |
Adds API-assisted login helper and credential defaults for specs. |
generators/playwright/templates/src/test/javascript/playwright/e2e/account/logout.spec.ts.ejs |
Adds a logout smoke spec using navbar/account menu locators. |
generators/playwright/templates/src/test/javascript/playwright/e2e/account/login-page.spec.ts.ejs |
Adds login page smoke specs (happy path + bad password). |
generators/playwright/templates/README.md.jhi.playwright.ejs |
Documents how to run Playwright e2e scripts and current scope. |
generators/playwright/templates/playwright.config.ts.ejs |
Generates Playwright config including baseURL selection and CI reporter setup. |
generators/playwright/templates/eslint.config.ts.jhi.playwright.ejs |
Adds Playwright ESLint flat-config fragment with type-aware linting. |
generators/playwright/index.ts |
Exposes generator entrypoint/command/types for the new namespace. |
generators/playwright/generator.ts |
Implements generator logic: defaults, scripts, dependency merge, template writes, Maven profile hook. |
generators/playwright/generator.spec.ts |
Adds focused tests verifying emitted files and package.json wiring (incl. OAuth2 skip behavior). |
generators/playwright/files.ts |
Declares template sections and conditional inclusion of account specs for non-OAuth2 apps. |
generators/playwright/command.ts |
Adds the Playwright generator command definition stub for command/type plumbing. |
generators/generate-blueprint/internal/lookup-namespaces.spec.ts |
Ensures blueprint namespace lookup includes playwright. |
generators/client/resources/package.json |
Adds Playwright + eslint-plugin-playwright versions to the client resource dependency source. |
generators/client/prompts.spec.ts |
Adds coverage for persisting Playwright selection to testFrameworks in .yo-rc.json. |
generators/client/generator.ts |
Composes with jhipster:playwright when Playwright is selected in testFrameworks. |
generators/client/generator.spec.ts |
Adds composition test coverage for Playwright selection. |
generators/client/command.ts |
Extends client test framework prompt choices to include Playwright. |
.blueprint/github-build-matrix/support/git-changes.ts |
Expands e2e change detection patterns to include generators/playwright/**. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "compilerOptions": { | ||
| <%_ if (clientFrameworkVue || clientFrameworkReact) { _%> | ||
| "ignoreDeprecations": "6.0", | ||
| <%_ } _%> |
|
|
||
| const response = await responsePromise; | ||
| expect(response.status()).toBe(200); | ||
| await expect(page.locator(accountMenuSelector)).toBeVisible(); |
09c44fc to
55d8bbd
Compare
55d8bbd to
e0ef0b5
Compare
|
Hi! I reproduced the failing The red path looks like snapshot drift after adding the new I have a small local patch that:
Focused validation passes locally:
Result: Happy to open this as a small follow-up PR or share the patch if useful. |
|
@Mykidzou Can you please fix the conflict? |
Summary
Contributes to #13755 (
$$ bug-bounty $$,$500) by adding a first-pass Playwright e2e implementation to generator-jhipster.This PR adds:
playwrightas a selectable client e2e test framework alongside Cypressjhipster:playwrightgeneratorValidation
Passed locally on Windows:
npm run check-typesnpm run eslint -- generators/playwright generators/client/command.ts generators/client/generator.ts generators/client/generator.spec.ts generators/client/prompts.spec.ts lib/jhipster/test-framework-types.ts lib/jhipster/application-options.ts lib/types/command-all.d.ts generators/types.d.tsnpx esmocha generators/playwright/generator.spec.ts generators/generate-blueprint/internal/lookup-namespaces.spec.ts --forbid-onlynpm run buildnpm run prettier:check -- generators/playwright generators/client/command.ts generators/client/generator.ts generators/client/generator.spec.ts generators/client/prompts.spec.ts lib/jhipster/test-framework-types.ts lib/jhipster/application-options.ts lib/types/command-all.d.ts generators/types.d.ts .blueprint/github-build-matrix/support/git-changes.ts generators/generate-blueprint/internal/lookup-namespaces.spec.tsgit diff --checkNotes:
generators/client/prompts.spec.tsand the client composition spec currently hit the existing Windows ESM loader path issue (Received protocol 'c:') before reaching the Playwright assertions. The new Playwright generator spec and typecheck cover the added behavior directly.Scope
Intentionally in scope for this first increment:
Intentionally out of scope for this increment: