When I try to run Cest test I get error:
Codeception PHP Testing Framework v2.2.6
Powered by PHPUnit 5.6.2 by Sebastian Bergmann and contributors.
PHP Catchable fatal error:
Argument 1 passed to
CartFlowDeliverPointCest::cartFlowDeliverPointCest() must be an
instance of AcceptanceTester, none given, called in
phar:///usr/local/bin/codecept/src/Codeception/Test/Loader/Cest.php on line 37
and defined in /home/michal/www/tests/acceptance/CartFlowDeliverPointCest.php on line 20
My Cest code:
use \AcceptanceTester;
class CartFlowDeliverPointCest
{
public function cartFlowDeliverPointCest(AcceptanceTester $I)
{
$homePage = new \Page\HomePage($I);
$productNanme = 'Fotoksiążka jesień';
$homePage -> fillSearchField($productName);
$homePage -> clickSearchBtn();
$searchPage -> clickFirstProduct();
$productPage ->clickMakeProductBtn();
}
}
and my Page Object code:
<?php
namespace Page;
class HomePage
{
public static $URL = '/';
public static $searchField = ['id' => 'microsearch_fraza'];
public static $searchBtn = "//div[@id='microsearch_fraza_container']/button";
protected $tester;
public function __construct(\AcceptanceTester $I)
{
$this->tester = $I;
}
public static function fillSearchField($productName)
{
$I = $this->tester;
$I->fillField(self::$searchField, $productName);
}
public static function clickSearchBtn()
{
$I = $this->tester;
$I->click(self::$searchBtn);
}
}
My Codeception version: 2.2.6