Codeception default test error: ID already defined

Hello everyone,

I installed with composer Yii2 basic.

Everything ok in localhost Yii2 run!.

Then I installed and configured Codeception following the steps of the file:

/tests/README.md

But by starting tests of default I have the following errors:




[simone@Freecosmo1 tests]$ codecept run acceptance

Codeception PHP Testing Framework v2.0.13

Powered by PHPUnit 4.6.4 by Sebastian Bergmann and contributors.


Acceptance Tests (4) --------------------------------------------------------------------

Ensure that about works (AboutCept)                                                Ok

Ensure that contact works (ContactCept)                                            Error

Ensure that home page works (HomeCept)                                             Ok

Ensure that login works (LoginCept)                                                Error

-----------------------------------------------------------------------------------------




Time: 432 ms, Memory: 13.75Mb


There were 2 errors:


---------

1) Failed to ensure that contact works in ContactCept (/home/simone/www/crmapp/tests/codeception/acceptance/ContactCept.php)

Couldn't click "contact-button":

yii\base\ErrorException: Codeception\Lib\InnerBrowser::getFormFromCrawler(): ID contact-form already defined


Scenario Steps:

4. I click "contact-button"

3. I am going to submit contact form with no data

2. I see "Contact","h1"

1. I am on page "/index-test.php?r=site%2Fcontact"


#1  Codeception\Lib\InnerBrowser->click

#2  /home/simone/www/crmapp/tests/codeception/acceptance/AcceptanceTester.php:221

#3  /home/simone/www/crmapp/tests/codeception/_pages/ContactPage.php:24

#4  /home/simone/www/crmapp/tests/codeception/acceptance/ContactCept.php:15

#5  Codeception\TestCase\Cept->testCodecept


---------

2) Failed to ensure that login works in LoginCept (/home/simone/www/crmapp/tests/codeception/acceptance/LoginCept.php)

Couldn't fill field "input[name="LoginForm[username]"]","":

yii\base\ErrorException: Codeception\Lib\InnerBrowser::getFormFromCrawler(): ID login-form already defined


Scenario Steps:

4. I fill field "input[name="LoginForm[username]"]",""

3. I am going to try to login with empty credentials

2. I see "Login","h1"

1. I am on page "/index-test.php?r=site%2Flogin"


#1  Codeception\Lib\InnerBrowser->fillField

#2  /home/simone/www/crmapp/tests/codeception/acceptance/AcceptanceTester.php:1207

#3  /home/simone/www/crmapp/tests/codeception/_pages/LoginPage.php:21

#4  /home/simone/www/crmapp/tests/codeception/acceptance/LoginCept.php:15

#5  Codeception\TestCase\Cept->testCodecept

                                   

FAILURES!                          

Tests: 4, Assertions: 6, Errors: 2.




In README.md file in step 3 it is impossible to execute the command. Why?

I followed the steps described in the file but do not understand why the test included by default (installed by composer) generate errors in command FillField test.

Thanks for your help.

Codeception 2.0.13 don’t work with fillField().

Revert my codeception with:

>composer global require "codeception/codeception=<2.0.12"

Composer revert to codeception2.0.9 and now the test passed!




[simone@Freecosmo1 tests]$ codecept run acceptance

Codeception PHP Testing Framework v2.0.9

Powered by PHPUnit 4.6.4 by Sebastian Bergmann and contributors.


Acceptance Tests (4) -------------------------------------------------------------------------------------------------

Trying to ensure that about works (AboutCept)                                                                    Ok

Trying to ensure that contact works (ContactCept)                                                                Ok

Trying to ensure that home page works (HomeCept)                                                                 Ok

Trying to ensure that login works (LoginCept)                                                                    Ok

----------------------------------------------------------------------------------------------------------------------




Time: 710 ms, Memory: 14.00Mb


OK (4 tests, 23 assertions)