Fix unreliable login form submission in Playwright UI smoke tests#146
Merged
vharseko merged 2 commits intoApr 7, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix login button click issue in Admin UI smoke test
Fix unreliable login form submission in Playwright UI smoke tests
Apr 7, 2026
64903b1
into
copilot/add-playwright-ui-smoke-tests
14 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
page.click("[type=submit], .btn-primary")selector was not reliably targeting the login button in the OpenIDM Admin UI, causing the form to never submit and leaving the#loginfield visible post-attempt.Changes
Admin UI login with openidm-admin succeeds,Admin UI - Dashboard page loads after login): replace button selector click withpage.press("#password", "Enter")to submit via native form submissionwaitForTimeout(2000)beforewaitForFunctionin both tests to allow the SPA to begin processing the login before asserting post-login stateOriginal prompt
Failing Job
The Playwright UI smoke test "Admin UI login with openidm-admin succeeds" is failing in CI (workflow run: https://github.com/OpenIdentityPlatform/OpenIDM/actions/runs/24074275491/job/70219158366, PR #145).
Error
At
e2e/ui-smoke-test.spec.mjs:33:The
#loginfield is still visible after the login attempt, meaning the login form didn't actually submit and the UI stayed on the login page.Root Cause
The login button click on line 23 is not reliably clicking the actual submit button:
The CSS selector list
[type=submit], .btn-primarymay not match the actual login button in the OpenIDM Admin UI, or may match a different element first.Required Fix
In
e2e/ui-smoke-test.spec.mjs, update both the "Admin UI login with openidm-admin succeeds" test (line 17) and the "Admin UI - Dashboard page loads after login" test (line 67) to use a more reliable form submission approach. Replace:with pressing Enter on the password field:
This submits the form directly via the password field, which is more reliable than trying to find and click the correct button element. The
page.press("#password", "Enter")approach works because the#passwordfield is inside a<form>element — pressing Enter on an input inside a form triggers form submission.Additionally, after pressing Enter, add a brief wait for the page to transition before checking login state. Use:
before the
waitForFunctioncall, to give the SPA time to start processing the login.Specifically, the changes needed are:
Test "Admin UI login with openidm-admin succeeds" (around line 23):
await page.click("[type=submit], .btn-primary");toawait page.press("#password", "Enter");waitForTimeout(2000)before thewaitForFunctionblockTest "Admin UI - Dashboard page loads after login" (around line 72):
await page.click("[type=submit], .btn-primary");toawait page.press("#password", "Enter");waitForTimeout(2000)before thewaitForFunctionblockNo other files need to change.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant:
I'll start by fetching the job logs and the workflow definition to understand the failure.
Assistant: The failing test is
Admin UI login with openidm-admin succeedsin the Playwright e2e test file. Let me look at the test file and the workflow definition.Assistant: ## Failing Test: "Admin UI login with openidm-admin succeeds"
The job fails in the Playwright UI Smoke Tests step. Specifically, the test at
e2e/ui-smoke-test.spec.mjs:17— "Admin UI login with openidm-admin succeeds" — fails on both the initial run and the retry with:This means the
#loginfield is still visible after the login attempt, indicating the login didn't actually succeed and the UI remained on the login page.Root Cause
The test (lines 21–33) fills in credentials, clicks submit, then waits for a post-login element (
#content,.navbar, or#wrapper) to appear. The issue is on line 23:The selector
[type=submit], .btn-primaryis a CSS selector list. Playwright'spage.click()may match the first element in the DOM that matches either selector — which might not be the actual login button. If the OpenIDM Admin UI login button doesn't match either of these selectors exactly (or if there's another element matching first), the click has no effect and the login form stays visible.Solution
Update the click selector to more precisely target the login button. Inspect what the actual Admin UI renders — it's typically an
inputorbuttoninside the login form. A more robust approach: