Search code examples
symfonycodeceptionacceptance-testing

Codeception Symfony click issue


I am working on an acceptence test to see if I can go from homepage to categories however no matter what I try I does see the link but I can't click it.

<?php
 $I = new AcceptanceTester($scenario);
 $I->wantTo('I click category');
 $I->amOnPage('/');
 $I->seeLink('Categories', '/categories');
 $I->click('category');
 ?>

The HTML:

<div class="col s12 m4">
                <a href="/categories" >
                    <div class="card">
                        <div class="card-content">
                            <div class="teal-text center-align" name="category">      
                                Categories
                            </div>
                        </div>
                    </div>
                </a>
            </div>
        </div>

Solution

  • I don't know if Codeception is looking for the 'name' attribute of html tag. Rather than this, you should try other ways of use of click method: http://codeception.com/docs/03-AcceptanceTests#Click

    Also you can try this:

    $I->click(['name' => 'category']);