Codeception - Acceptance tests work, but the functional test does not

I am using the latest version of Codeception on the WAMP platform. My adoption is very simple, but works fine (see below):

$I = new WebGuy($scenario); $I->wantTo('Log in to the website'); $I->amOnPage('/auth/login'); $I->fillField('identity','admin@admin.com'); $I->fillField('password','password'); $I->click('Login'); 

In a nutshell - he checks that the "auth / login" page fills in 2 form fields and presses the login button. This works without a problem.

Here is my identical functional test:

 $I = new TestGuy($scenario); $I->wantTo('perform actions and see result'); $I->amOnPage('/auth/login'); $I->fillField('identity','admin@admin.com'); $I->fillField('password','password'); $I->click('Login'); 

When I run this from the command line, I get the following error (not a complete error, but enough to understand the problem):

 1) Couldn't <-[35;1mperform actions and see result<- [0m in <-[37;1LoginCept.php<-[0m <-41;37mRuntimeException: Call to undefined method TestGuy::amOnPage<-[0m....... 

The phpBrowser and WebHelper modules are included in my receiving package, the functional package includes FileSystem and TestHelper (in the files accept.suite.yml and functional.suite.yml).

Obviously, the amOnPage () function is a problem - however, am I convinced that amOnPage () should work on acceptance and functional testing? Or am I mistaken - also - can someone explain what numbers mean, for example '<- [35; 1m 'that appear

UPDATE: I tried adding the "WebHelper" module to the functional.suite.yml function, but I don’t see that amOnPage () was automatically generated in the TestGuy.php file - any ideas?

My configuration files are below:

Webguy

 class_name: WebGuy modules: enabled: - PhpBrowser - WebHelper config: PhpBrowser: url: 'http://v3.localhost/' 

Testguy

 class_name: TestGuy modules: enabled: [Filesystem, TestHelper, WebHelper] 
+8
command-line unit-testing functional-testing acceptance-testing codeception
source share
2 answers

Well, this is because TestGuy does not have these methods. All these methods are in the modules PhpBrowser, Selenium2 or others, which are inherited from the MRC implementation of the Codeception implementation. Therefore, you need to add PhpBrowser to your functional package in the modules section, and then run the codecept build .

Also note that it is better to use the Selenium2 module for the acceptance test and PhpBrowser for functional tests. The main idea is that Accept tests (Selenium2) should cover those parts of your application that cannot be covered by functional (PhpBrowser) tests, for example, some js interactions.

+9
source share

O '<-[35;1m' start script codecept run --no-colors to remove '<-[35;1m' from console output

-one
source share

All Articles