-
Notifications
You must be signed in to change notification settings - Fork 140
Description
- Setup Test Environment
Create virtual environment
python -m venv venv-hercules
source venv-hercules/bin/activate
Install TestZeus-Hercules
pip install testzeus-hercules
2. Create Feature File (features/modal_login_test.feature)
Feature: Modal Login Test
Test login functionality with modal dialog
Background:
Given I am on a login page with modal dialog authentication
@modal @login
Scenario: Login with modal dialog
When I enter email "test@example.com"
And I click the "Next" button
- Create Python Runner Script (run_test.py)
import subprocess
from pathlib import Path
cmd = [
"testzeus-hercules",
"--input-file", "features/modal_login_test.feature",
"--output-path", "reports/output",
"--project-base", ".",
"--llm-model", "gpt-4o",
"--llm-model-api-key", "your-openai-api-key",
"--llm-model-api-type", "openai",
"--browser-channel", "chrome"
]
Disable headless mode for proper rendering
import os
env = os.environ.copy()
env["HEADLESS"] = "false"
subprocess.run(cmd, env=env)
4. Test Website Requirements
- Any website with modal/popup login dialog
- Modal should contain email input field
- Modal should overlay main page content
5. Run the Test
python run_test.py
Expected Behavior
- Framework should detect the email input field in the modal dialog
- Framework should maintain focus on the modal dialog during text input
- Email should be successfully entered into the input field
- Test should proceed to next step
Actual Behavior
- Framework correctly detects email input field ✅
- Framework loses focus during text input operation ❌
- Text input is attempted on main page content instead of modal ❌
- Email field remains empty ❌
- Test fails silently or proceeds with empty field ❌
Evidence
-
Element Detection Success:
[
{"md":"2105","tag":"input","role":"textbox","name":"Email"},
{"md":"2107","tag":"button","role":"button","name":"Next Button"}
] -
Screenshots Pattern:
- entertext_start_*.png: Shows modal dialog visible and focused
- entertext_end_*.png: Shows main page content (focus lost)
- Console Logs Pattern:
[INFO] Registered tool: bulk_enter_text
[INFO] get_input_fields detected modal elements correctly
[WARNING] Failed to wait for networkidle: Timeout exceeded
Root Cause Analysis
The framework's bulk_enter_text tool appears to lose DOM focus when
interacting with elements inside modal dialogs or popup overlays. The
element detection works correctly, but the actual text input operation
targets the wrong DOM context.
Impact
- Critical: Prevents testing of any login flows using modal dialogs
- Widespread: Affects any test scenario with popup/overlay/modal elements
- Silent Failure: Framework doesn't report the focus loss as an error
Workaround
None found. The issue appears to be in the core element interaction
mechanism.
Additional Notes
- Issue only occurs with modal/popup elements
- Standard page elements work correctly
- Framework successfully detects elements but fails during interaction
- Disabling headless mode doesn't resolve the issue
- Problem persists across different browser channels
Test Case for Verification
This issue can be reproduced with any website that uses modal dialogs for
authentication. Common examples include:
- Login modals that overlay the main page
- Popup authentication forms
- Any overlay dialog with input fields