when I use the AcceptanceHelper generated by codeception (_support/AcceptanceHelper.php), how can I access the Actor / AcceptanceTester ($I). And how can I access my functions from StepObjects?
I have:
acceptance/_steps/MyStepObject.php
namespace AcceptanceTester;
class MyStepObject extends \AcceptanceTester
{
public function deleteCookies(){
$I = $this;
$I->amGoingTo("delete all cookies...");
$I->executeInSelenium(function(\WebDriver $webdriver) {$webdriver->manage()->deleteAllCookies(); });
$I->reloadPage();
}
public function loginUser($user,$password,$language = 'Untranslated')
{
$I = $this;
$I->amOnPage(\LoginPage::$URL);
$I->deleteCookies();
$I->amGoingTo('fill the fields...');
$I->fillField(\LoginPage::$usernameField, $user);
$I->fillField(\LoginPage::$passwordField, $password);
$I->click(\LoginPage::$loginButton);
}
}
In the class _support/AcceptanceHelper.php
I want to call methods from the AcceptanceTester like $I->canSee('something')
and I want to call my own methods (like 'login'
) from my StepObject.
I know I can get a specific module (e.g. the WebDriver) with $this->getModule('WebDriver')
. But how can I get the AcceptanceTester / my StepObject?