Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeception: [RuntimeException] Call to undefined method AcceptanceTester::wait

I'm making my first acceptance test with Codeception.

When I run my test with wait() or waitForElement(), I get this message:

[RuntimeException] Call to undefined method AcceptanceTester::wait  

Here is my acceptance.yml

# Codeception Test Suite Configuration
#
# Suite for acceptance tests.
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate     suite.

class_name: WebGuy
modules:
enabled:
    - WebDriver
    - \Helper\Acceptance
config:
    WebDriver:
        url: 'http://rh.dev'
        browser: 'firefox'

And here is my test:

$I = new AcceptanceTester($scenario);
$I->wantTo('Register my profile for the first time');
$I->amOnPage('/register');
$I->fillField('name', $person->name);
$I->wait(3); // secs
$I->fillField('lastName', $person->lastName);

I got it from official doc

I also made sure to execute:

vendor/bin/codecept build

What's the problem?

like image 380
Juliatzin Avatar asked Mar 18 '16 20:03

Juliatzin


2 Answers

I had a similar problem with the missing wait() method. The problem was I was using PhpBrowser instead of WebDriver, and PhpBrowser doesn't provide that method. It is trivial to implement it yourself in your tester class:

public function wait($seconds) {
    sleep($seconds);
}
like image 127
gvlasov Avatar answered Sep 20 '22 15:09

gvlasov


Change class_name: WebGuy to class_name: AcceptanceTester

like image 38
Naktibalda Avatar answered Sep 18 '22 15:09

Naktibalda