问题
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?
回答1:
Change class_name: WebGuy
to class_name: AcceptanceTester
回答2:
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);
}
来源:https://stackoverflow.com/questions/36093658/codeception-runtimeexception-call-to-undefined-method-acceptancetesterwait