Skip to content

Instantly share code, notes, and snippets.

@Eseperio
Created October 2, 2025 11:12
Show Gist options
  • Save Eseperio/3cfd4f5382f5c78fbe7cdca635117e13 to your computer and use it in GitHub Desktop.
Save Eseperio/3cfd4f5382f5c78fbe7cdca635117e13 to your computer and use it in GitHub Desktop.
Common Problems in Codeception Acceptance Tests

Common Problems in Codeception Acceptance Tests

This guide covers several common issues you might encounter when running acceptance tests in Codeception, particularly when dealing with authentication flows and UI interactions.

1. Click Not Working After Login - Password Leak Warning

Problem

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.

Solution

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.

2. Difference Between I->see() and I->waitForText()

Understanding the Distinction

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.

Practical Example

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.

3. Element Must Be in Viewport for Click

Problem

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.

Solution

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

Example

// 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

Additional Resources


Happy Testing! 🧪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment