Skip to content

Use npx for Playwright browser installation in CI workflow#29

Merged
macintorsten merged 3 commits into
mainfrom
copilot/add-exec-maven-plugin
Dec 20, 2025
Merged

Use npx for Playwright browser installation in CI workflow#29
macintorsten merged 3 commits into
mainfrom
copilot/add-exec-maven-plugin

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 20, 2025

CI workflow fails at Playwright browser installation step. This PR fixes the issue by using npx to install Playwright browsers, aligning with the devcontainer approach.

Changes

  • .github/workflows/ci.yml: Updated Playwright browser installation command (line 36)
    • Changed from Maven-based approach to npx playwright install --with-deps chromium
    • Matches devcontainer setup at .devcontainer/devcontainer.json:15
    • Leverages existing Node.js setup (lines 24-27 in CI workflow)
npx playwright install --with-deps chromium

Why This Approach

  • Consistency: Aligns with devcontainer's Playwright installation method
  • Simplicity: Uses existing Node.js setup already configured in CI
  • Reliability: Avoids Maven classloading issues entirely
  • Maintainability: No additional Maven plugin configuration needed

This unblocks the CI step at .github/workflows/ci.yml:36 that installs Chromium for frontend E2E tests.

Original prompt

Problem

The CI workflow is failing when trying to install Playwright browsers with the following error:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.6.2:java (default-cli) on project my-app: 
An exception occurred while executing the Java class. com.microsoft.playwright.CLI

The workflow step at .github/workflows/ci.yml:36 runs:

mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps chromium"

However, the pom.xml is missing the exec-maven-plugin configuration needed to execute the Playwright CLI.

Solution

Add the exec-maven-plugin to the pom.xml in the <build><plugins> section with proper configuration to allow running the Playwright CLI for browser installation.

Add this plugin configuration after the maven-compiler-plugin (around line 154):

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
        <mainClass>com.microsoft.playwright.CLI</mainClass>
    </configuration>
</plugin>

Validation

After making this change:

  1. The CI workflow should successfully run the Playwright browser installation step
  2. The command mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps chromium" should work correctly
  3. All existing tests should continue to pass

Files to Modify

  • pom.xml - Add the exec-maven-plugin configuration in the build plugins section

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@macintorsten
Copy link
Copy Markdown
Owner

The better solution would be to change the CI workflow to use npx playwright install --with-deps chromium instead of the Maven approach, since:

Your devcontainer already uses npx (line 15 of .devcontainer/devcontainer. json)
Your CI workflow already has Node.js set up (lines 24-27 of .github/workflows/ci.yml)
This avoids the Maven classloading issues entirely

Co-authored-by: macintorsten <18098382+macintorsten@users.noreply.github.com>
@macintorsten
Copy link
Copy Markdown
Owner

@copilot Can you adjust and use npx and is done in .devcontainer

Copilot AI changed the title [WIP] Add exec-maven-plugin configuration for Playwright Add exec-maven-plugin for Playwright CLI browser installation Dec 20, 2025
Copilot AI requested a review from macintorsten December 20, 2025 22:11
- Remove exec-maven-plugin from pom.xml (not needed)
- Update CI workflow to use npx playwright install (matches devcontainer approach)
- This avoids Maven classloading issues and aligns with existing Node.js setup

Co-authored-by: macintorsten <18098382+macintorsten@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 20, 2025

@copilot Can you adjust and use npx and is done in .devcontainer

Done! Changed to use npx playwright install --with-deps chromium in the CI workflow (commit ea90014). The exec-maven-plugin has been removed from pom.xml. This now matches the devcontainer approach and leverages the existing Node.js setup.

Copilot AI changed the title Add exec-maven-plugin for Playwright CLI browser installation Use npx for Playwright browser installation in CI workflow Dec 20, 2025
@macintorsten macintorsten marked this pull request as ready for review December 20, 2025 22:15
@macintorsten macintorsten merged commit b49546a into main Dec 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants