Skip to content

Add openidm-ui QUnit headless browser tests to CI workflow#144

Open
Copilot wants to merge 3 commits intomasterfrom
copilot/add-qunit-tests-openidm-ui
Open

Add openidm-ui QUnit headless browser tests to CI workflow#144
Copilot wants to merge 3 commits intomasterfrom
copilot/add-qunit-tests-openidm-ui

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

The build-maven CI job started OpenIDM and verified it was healthy, but never ran the compiled QUnit UI tests against the live instance. This adds headless Puppeteer/Chrome QUnit runs for both openidm-ui-admin (~170 test modules) and openidm-ui-enduser (~6 test modules) after the service-ready check.

Changes

  • build.yml — "Test on Unix": runs npx grunt qunit from each sub-project using subshells to guarantee working-directory restoration on failure
    (cd openidm-ui/openidm-ui-admin && npx grunt qunit)
    (cd openidm-ui/openidm-ui-enduser && npx grunt qunit)
  • build.yml — "Test on Windows": equivalent PowerShell using Push-Location/Pop-Location wrapped in try/finally
    Push-Location ..\openidm-ui\openidm-ui-admin
    try { npx grunt qunit } finally { Pop-Location }

Tests run against compiled artifacts already produced by the Maven build (target/qunit/index.html, node_modules populated via frontend-maven-plugin), using the existing grunt-contrib-qunit Puppeteer configuration (--headless=new, --no-sandbox).

Original prompt

Problem

In .github/workflows/build.yml, the build-maven job starts the OpenIDM service and verifies it's healthy via log checks, but there are no openidm-ui QUnit tests run against the live instance in a headless browser.

Requirements

Add QUnit browser tests for openidm-ui-admin and openidm-ui-enduser that run in a headless browser against the real running OpenIDM instance (port 8080). These tests must be added to the build.yml workflow after the service startup verification (after "OpenIDM ready" check succeeds).

How the existing QUnit test infrastructure works

Test structure

  • openidm-ui/openidm-ui-common/src/test/qunit/index.html — QUnit test runner HTML
  • openidm-ui/openidm-ui-common/src/test/qunit/testRunner.js — loads main.js, configures ServiceInvoker, initializes i18n, then loads test modules and calls QUnit.start()
  • openidm-ui/openidm-ui-admin/src/test/qunit/main.js — defines ~170 admin QUnit test modules
  • openidm-ui/openidm-ui-enduser/src/test/qunit/main.js — defines ~6 enduser QUnit test modules

Build pipeline

Maven build (mvn verify) already:

  1. Installs Node.js v20.12.2 and npm via frontend-maven-plugin
  2. Runs npm install in each sub-project (openidm-ui-admin, openidm-ui-enduser)
  3. Runs grunt build:prod which compiles sources, transpiles tests, and runs QUnit via Puppeteer headless Chrome

After Maven build, the compiled QUnit test artifacts are at:

  • openidm-ui/openidm-ui-admin/target/qunit/index.html — admin test runner
  • openidm-ui/openidm-ui-enduser/target/qunit/index.html — enduser test runner
  • openidm-ui/openidm-ui-admin/target/www/ — compiled admin UI (JS, CSS, libs)
  • openidm-ui/openidm-ui-enduser/target/www/ — compiled enduser UI (JS, CSS, libs)

Grunt QUnit config (from Gruntfile-common.js)

qunit: {
    test: [ testDirectory + '/index.html'],  // testDirectory = "target/qunit"
    options: {
        timeout: 20000,
        puppeteer: {
            ignoreDefaultArgs: true,
            args: [
                "--headless=new",
                "--allow-file-access-from-files",
                "--disable-dev-shm-usage",
                '--no-sandbox', '--disable-setuid-sandbox'
            ]
        }
    }
},

Package dependencies

Each sub-project (openidm-ui-admin, openidm-ui-enduser) has package.json with grunt-contrib-qunit: 10.1.1 which uses Puppeteer.

What to add in build.yml

For "Test on Unix" step (after the existing log checks on lines 43-46)

After OpenIDM is confirmed running, copy the compiled QUnit test files into the running OpenIDM's UI directory so they're served via HTTP, then run the tests using the existing grunt qunit task against the running instance. Alternatively, use npx to run grunt qunit directly since node_modules are already installed by Maven.

The key approach: run npx grunt qunit from each sub-project directory (openidm-ui/openidm-ui-admin and openidm-ui/openidm-ui-enduser). The grunt qunit task is already configured to run target/qunit/index.html in headless Puppeteer/Chrome. The test files are already compiled by the Maven build step. This runs the QUnit tests in a real headless browser.

Add these lines after the existing log checks in the "Test on Unix" step:

echo "Running openidm-ui-admin QUnit tests in headless browser..."
cd openidm-ui/openidm-ui-admin && npx grunt qunit && cd ../..
echo "Running openidm-ui-enduser QUnit tests in headless browser..."
cd openidm-ui/openidm-ui-enduser && npx grunt qunit && cd ../..

For "Test on Windows" step (after existing log checks on lines 54-57)

Add equivalent commands. Note: the Windows step uses PowerShell, and the current working directory changes with cd openidm at line 51. So paths need to account for being inside the openidm/ directory:

Write-Host "Running openidm-ui-admin QUnit tests in headless browser..."
Push-Location ..\openidm-ui\openidm-ui-admin
npx grunt qunit
Pop-Location
Write-Host "Running openidm-ui-enduser QUnit tests in headless browser..."
Push-Location ..\openidm-ui\openidm-ui-enduser
npx grunt qunit
Pop-Location

Important constraints

  • Only add QUnit browser tests — no curl/REST checks, no simple HTTP accessibility checks
  • Tests must run in a headless browser (Puppeteer/Chrome) — this is already configured in Gruntfile-common.js
  • Tests run against the real running OpenIDM instance on port 8080
  • Add tests inside the existing "Test on Unix" and "Test on Windows" steps (append to the run: block), NOT as separate steps
  • Keep all existing log checks intact — just append the QUnit test commands after them
  • The file to modify is only .github/workflows/build.yml
  • Tests should run for both admin and enduser UI sub-projects
  • Node.js and npm are already installed by the Maven build (via frontend-maven-plugin with Node v20.12.2)
  • node_modules are already populated in ...

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Add QUnit tests for openidm-ui-admin and openidm-ui-enduser Add openidm-ui QUnit headless browser tests to CI workflow Apr 3, 2026
Copilot AI requested a review from vharseko April 3, 2026 16:14
@vharseko vharseko requested a review from maximthomas April 3, 2026 16:25
@vharseko vharseko marked this pull request as ready for review April 3, 2026 16:26
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