7

I am running the latest version of Codeception on a WAMP platform - My acceptance is very basic however 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 - it checks the page is 'auth/login' fills out 2 form fields and clicks the login button. This works without any problems.

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 the full 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.......

My Acceptance suite has 'PhpBrowser' & 'WebHelper' modules enabled, the Functional suite has 'FileSystem' & 'TestHelper' enabled (within the acceptance.suite.yml & functional.suite.yml files)

Obviously the amOnPage() function is the problem - however I am led to believe amOnPage() should work in acceptance and functional test? Or I am wrong - also - can someone explain what the numbers mean e.g '<-[35;1m' that appear

UPDATE: I tried adding the 'WebHelper' module to the functional.suite.yml but I do not see the amOnPage() being auto-generated in the TestGuy.php file - any ideas?

My config 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]
Zabs
  • 13,852
  • 45
  • 173
  • 297

2 Answers2

9

Well, this is so, because of TestGuy don't have those methods. All of those methods are in the PhpBrowser, Selenium2 modules or other that inherits from Codeception Mink implementation. So you need to add PhpBrowser in your functional suite in modules section, and then run codecept build command.

Also note that it is better to use Selenium2 module for acceptance test and PhpBrowser for functional tests. The main idea is that acceptance(Selenium2) tests must cover those part of your application, that can not be covered by functional (PhpBrowser) tests, for example some js-interactions.

FaizFizy
  • 459
  • 5
  • 15
  • Thanks @Elkan I've added 'PhpBrowser' to my functional.suite.yml file and run the 'codecept build' command and receive an "PhpBrower module is not configured! Module PhpBrowser is not configured. Please check out it's required fields. Any ideas on what I do from here? – Zabs Jun 14 '13 at 11:26
  • Note.. I am using CodeIgniter.. and I have found out there isn't a module for this yet at this moment in time :( – Zabs Jun 14 '13 at 11:27
  • yes, no module for CI available for now, but use then PhpBrowser for functional tests, speed difference is not that much when you use PhpBrowser(based on curl) and framework native module (based on symfony browser-kit). Back to error, you need to configure PhpBrowser, see module docs on codeception site :) –  Jun 14 '13 at 11:51
  • 1
    For anyone else having the same issue - here is the link to PhpBrowser http://codeception.com/docs/modules/PhpBrowser – Zabs Jun 14 '13 at 11:56
  • If it helps anyone else: http://pastebin.com/afSnMPpT http://pastebin.com/CiVmmaH8 – Zabs Jun 14 '13 at 12:10
-1

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

opare
  • 11