This guide covers several common issues you might encounter when running acceptance tests in Codeception, particularly when dealing with authentication flows and UI interactions.
If your acceptance tests require login and clicks stop working after authentication, the issue might be Chrome's password leak detection. When you log in with a password that has been found in a data breach, Chrome displays a warning bubble ("Password found in data leak") that can prevent subsequent click interactions from working properly.
Change your test passwords to unique, non-leaked values. This is the only reliable solution.
Many online resources suggest using Chrome flags to disable this warning, but these flags do not actually disable the password leak bubble. The warning will still appear regardless of configuration attempts.
The root cause is that simple, common passwords (like "password123", "test123", etc.) trigger Chrome's built-in password leak detection. Use randomly generated or sufficiently complex passwords for your test accounts to avoid this issue entirely.
These two methods check for text in fundamentally different ways:
$I->see(): Searches for text in the raw HTML source. It looks at the actual text content in the DOM.$I->waitForText(): Searches for text in the visually rendered output. It looks at what the user actually sees on screen.
Consider an HTML element with CSS transformation:
<div style="text-transform: uppercase;">hello world</div>$I->see('hello world')→ ✅ PASSES (checks HTML source: "hello world")$I->see('HELLO WORLD')→ ❌ FAILS (HTML source contains lowercase)$I->waitForText('HELLO WORLD')→ ✅ PASSES (visually rendered as uppercase)$I->waitForText('hello world')→ ❌ FAILS (rendered text is uppercase)
Always consider CSS transformations, visibility rules, and visual rendering when choosing between these methods.
Codeception requires that an element be visible within the browser viewport before it can be clicked. If an element is outside the visible area (below the fold, for example), click operations will fail.
Scroll the element into view before attempting to click.
Codeception provides several scroll methods:
$I->scrollTo($selector)- Scrolls to a specific element$I->scrollTo($selector, $offsetX, $offsetY)- Scrolls to an element with offset$I->executeJS('window.scrollTo(0, document.body.scrollHeight);')- Custom JavaScript scrolling
// Instead of this:
$I->click('Submit Button');
// Do this:
$I->scrollTo('Submit Button');
$I->click('Submit Button');This is especially important for:
- Long forms with submit buttons at the bottom
- Lazy-loaded content
- Modal dialogs with scrollable content
- Footer links
Happy Testing! 🧪