Skip to content

Add Playwright e2e generator foundation - #33355

Open
Mykidzou wants to merge 1 commit into
jhipster:mainfrom
Mykidzou:codex/playwright-e2e-foundation
Open

Add Playwright e2e generator foundation#33355
Mykidzou wants to merge 1 commit into
jhipster:mainfrom
Mykidzou:codex/playwright-e2e-foundation

Conversation

@Mykidzou

Copy link
Copy Markdown

Summary

Contributes to #13755 ($$ bug-bounty $$, $500) by adding a first-pass Playwright e2e implementation to generator-jhipster.

This PR adds:

  • playwright as a selectable client e2e test framework alongside Cypress
  • a new jhipster:playwright generator
  • generated Playwright config, npm scripts, TypeScript config, ESLint fragment, and README notes
  • generated JWT/session account login and logout smoke specs using Playwright locators/API helpers
  • focused generator coverage for emitted files, package scripts/dependencies, OAuth2 scoping, namespace lookup, prompt, and composition plumbing

Validation

Passed locally on Windows:

  • npm run check-types
  • npm 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.ts
  • npx esmocha generators/playwright/generator.spec.ts generators/generate-blueprint/internal/lookup-namespaces.spec.ts --forbid-only
  • npm run build
  • npm 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.ts
  • git diff --check

Notes:

  • generators/client/prompts.spec.ts and 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:

  • generator selection/composition
  • runnable Playwright project setup
  • account login/logout smoke coverage for JWT and session apps
  • lint/type/test coverage for the generator output

Intentionally out of scope for this increment:

  • OAuth2 browser flow generation
  • generated entity CRUD Playwright specs
  • replacing or removing Cypress
  • CI provider-specific Playwright wiring

@github-actions github-actions Bot added theme: jhipster-internals theme: front theme: dependencies Pull requests that update a dependency file labels May 11, 2026
@Mykidzou
Mykidzou force-pushed the codex/playwright-e2e-foundation branch from b9cc9c3 to 09c44fc Compare May 11, 2026 20:18
@Mykidzou

Copy link
Copy Markdown
Author

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:playwright generator 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();
@Mykidzou
Mykidzou force-pushed the codex/playwright-e2e-foundation branch from 09c44fc to 55d8bbd Compare May 11, 2026 21:03
@Mykidzou
Mykidzou force-pushed the codex/playwright-e2e-foundation branch from 55d8bbd to e0ef0b5 Compare May 11, 2026 21:07
@iHateThisGameSo

Copy link
Copy Markdown

Hi! I reproduced the failing check-npm-test from this PR locally.

The red path looks like snapshot drift after adding the new jhipster:playwright namespace, plus the generated generators/types.d.ts ordering from update-generators.

I have a small local patch that:

  • updates the affected generator/helper snapshots,
  • adds the missing git-changes snapshot for generators/playwright/index.ts,
  • refreshes generators/types.d.ts via update-generators.

Focused validation passes locally:

npx esmocha --no-insight --no-parallel generators/angular/generators/bootstrap/generator.spec.ts generators/client/generators/bootstrap/generator.spec.ts generators/ci-cd/generator.spec.ts generators/angular/generator.spec.ts generators/react/generator.spec.ts generators/react/generators/bootstrap/generator.spec.ts generators/spring-boot/generator.spec.ts generators/vue/generator.spec.ts generators/vue/generators/bootstrap/generator.spec.ts .blueprint/github-build-matrix/support/git-chages.spec.ts lib/testing/helpers.spec.ts .blueprint/update-generators/generator.spec.ts --forbid-only

Result: 4372 passing, 110 pending.

Happy to open this as a small follow-up PR or share the patch if useful.

@mraible

mraible commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@Mykidzou Can you please fix the conflict?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme: dependencies Pull requests that update a dependency file theme: front theme: jhipster-internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants