Overview
This guide addresses common issues you may encounter when writing tests with Drama Finder, organized by category with practical solutions.Locator Issues
Element Not Found
Problem: Element not found or null
Problem: Element not found or null
Symptoms:
Error: Element not foundPlaywrightException: Timeout 15000ms exceeded- Locator returns null or empty
-
Incorrect Label or Text
-
Element Not Yet Rendered
-
Shadow DOM Not Pierced
- Verify the exact label/text in your application
- Ensure Vaadin Flow is ready before interactions
- Use CSS selectors, not XPath, for shadow DOM elements
- Check element visibility with
assertVisible()first
Multiple Elements Matched
Problem: Locator matches multiple elements
Problem: Locator matches multiple elements
Symptoms:
Error: Multiple elements found- Wrong element is selected
- Ambiguous locator warning
-
Missing
.first()Call -
Not Using Scoped Lookup
- Always use
.first()when creating elements from broad selectors - Use scoped lookups within containers
- Use more specific factory methods (
getByLabel,getByText) - Add unique labels or aria-labels to distinguish similar elements
Wrong Locator Type
Problem: Using wrong locator for operation
Problem: Using wrong locator for operation
Symptoms:
getAttribute()returns unexpected results- Actions don’t work (click, fill, etc.)
- State checks fail
-
Component vs. Input Locator Confusion
-
Focus Locator Mismatch
- Use
getInputLocator()for: value, maxlength, pattern, placeholder - Use
getLocator()for: theme, class, opened, component-level attributes - Use
getEnabledLocator()andgetFocusLocator()for state checks - Consult element documentation for which locator to use
Timing and Synchronization Issues
Flaky Tests Due to Timing
Problem: Tests pass sometimes and fail other times
Problem: Tests pass sometimes and fail other times
Symptoms:
- Tests fail intermittently
- “Element not visible” errors
- State assertions fail randomly
-
Not Using Auto-Retry Assertions
-
Hard Waits Instead of Smart Waits
-
Not Waiting for Vaadin Flow
- Use Playwright assertions that auto-retry
- Avoid
Thread.sleep()andpage.waitForTimeout() - Use element-specific assertion methods
- Ensure
WAIT_FOR_VAADIN_SCRIPTruns after navigation - Increase default timeouts if necessary
Actions Not Taking Effect
Problem: Click, fill, or other actions don't work
Problem: Click, fill, or other actions don't work
Symptoms:
click()does nothingsetValue()doesn’t change value- Form submission fails
-
Element Not Actionable
-
Missing Event Dispatch
-
Wrong Element Clicked
- Verify element is visible, enabled, and stable before actions
- Use element-specific action methods (
setValue,check,selectItem) - Dispatch events after programmatic changes
- Check for overlays or loading indicators covering elements
Assertion Failures
Unexpected Attribute Values
Problem: Assertions fail with unexpected values
Problem: Assertions fail with unexpected values
Symptoms:
- Expected attribute not present
- Attribute has different value than expected
nullwhen expecting a value
-
Attribute vs. Property Confusion
-
Boolean Attributes
-
Null Handling
- Use lowercase attribute names
- Boolean attributes: check for empty string or absence
- Handle null values in assertion helpers
- Use
hasJSPropertyfor DOM properties
State Check Failures
Problem: Element state doesn't match expectation
Problem: Element state doesn't match expectation
Symptoms:
assertEnabled()fails when element appears enabledassertChecked()fails for checked checkbox- Focus assertions fail
-
Checking Wrong Element
-
Invalid State Not Triggered
-
Async State Change
- Use correct locator for state checks (component vs. input)
- Trigger validation before checking invalid state
- Use assertions that auto-retry
- Check element documentation for state location
Setup and Configuration Issues
Browser Launch Failures
Problem: Browser fails to launch
Problem: Browser fails to launch
Symptoms:
Error: Executable doesn't exist- Browser crashes on startup
- Headless mode issues
-
Playwright Browsers Not Installed
-
Missing Dependencies (Linux)
-
Permissions Issues
- Install Playwright browsers before running tests
- Install system dependencies on Linux
- Check file permissions
- Use Docker with pre-installed browsers for CI
Port and Network Issues
Problem: Can't connect to test server
Problem: Can't connect to test server
Symptoms:
- Connection refused errors
- Tests can’t navigate to URL
- Blank pages
-
Port Not Available
-
Server Not Started
-
Wrong URL
- Use
RANDOM_PORTin Spring Boot tests - Inject
@LocalServerPortfor dynamic port - Verify application starts successfully
- Check for port conflicts
Vaadin-Specific Issues
Problem: Vaadin Flow not loading properly
Problem: Vaadin Flow not loading properly
Symptoms:
- White screen
- JavaScript errors
- Components not rendering
WAIT_FOR_VAADIN_SCRIPTtimes out
-
Dev Mode Bundle Not Built
-
Node Modules Missing
-
Frontend Resources Not Served
-
JavaScript Errors
- Build frontend before running tests
- Check for JavaScript errors in console
- Verify Vaadin resources are accessible
- Use production mode for faster tests (if applicable)
- Check network tab for failed resource loads
Performance Issues
Slow Test Execution
Problem: Tests are taking too long
Problem: Tests are taking too long
Symptoms:
- Individual tests take > 10 seconds
- Test suite takes very long
- Frequent timeouts
-
Long Default Timeouts
-
Not Using Production Mode
-
Redundant Navigation
-
Not Running in Parallel
- Use production mode for tests when possible
- Enable parallel test execution
- Reduce timeouts if tests don’t need long waits
- Avoid redundant navigation
- Profile tests to find bottlenecks
ARIA Role Issues
Wrong ARIA Role in Lookups
Problem: getByRole returns wrong elements or none
Problem: getByRole returns wrong elements or none
Symptoms:
getByLabelcan’t find element- Factory methods return null
- Multiple elements matched unexpectedly
-
Wrong ARIA Role for Component
-
Component Type Mismatch
- Text inputs:
TEXTBOX - Number inputs:
SPINBUTTON - Date/time pickers:
COMBOBOX - Buttons:
BUTTON - Checkboxes:
CHECKBOX - Radio buttons:
RADIO - ComboBox/Select:
COMBOBOX - Links:
LINK
- Use correct element type for component
- Check actual ARIA role in browser DevTools
- Refer to Vaadin documentation for component roles
- Use Drama Finder factory methods (they use correct roles)
Debugging Tips
Enable Visual Debugging
Console Logging
Screenshots on Failure
Slow Motion
Trace Recording
Getting Help
Check Documentation
Element Reference
Detailed API documentation
Best Practices
Writing maintainable tests
Common Patterns
Real-world examples
Setup Guide
Initial configuration
Community Resources
- Drama Finder GitHub: Report issues and request features
- Playwright Documentation: Official Playwright Java docs
- Vaadin Documentation: Component behavior and attributes
- Stack Overflow: Tag questions with
playwright,vaadin, anddrama-finder
Creating Bug Reports
When reporting issues, include:-
Minimal reproducible example
-
Environment details
- Java version
- Playwright version
- Vaadin version
- Drama Finder version
- OS and browser
- Error messages and stack traces
- Screenshots or videos if applicable
- Expected vs. actual behavior