Answer the question
In order to leave comments, you need to log in
Codeception acceptance - annotations before, after, depends do not work, what could be the problem?
I am using Codeception version 2.2.4.
I don’t want to rely on chance when executing a test and I’m trying to indicate the dependencies of the tests among themselves and the order of execution using annotations:
class TsdPricetagCest extends ValidateFormCest
{
public function _before(AcceptanceTester $I)
{
$I->login();
}
public function _after(AcceptanceTester $I)
{
}
/**
* в конце теста сохраняет валидные значения
* @example {"importFilesDestinationFolder":{"type":"path", "value":"C:\\tmp\\tsd\\import"}, "archiveExpirationDate":{"type":"day", "min":1, "max":365, "value":1}, "archiveDestinationFolder":{"type":"path", "value":"C:\\tmp\\tsd\\archive"}, "logsDestinationFolder":{"type":"path", "value":"C:\\tmp\\tsd\\logs"}}
* @param AcceptanceTester $I
* @param \Codeception\Example $example
*/
public function testSettingsValidation(AcceptanceTester $I, \Codeception\Example $example)
{
$I->wantTo('test settings validation');
$I->amOnPage('index.php?r=tsd/settings/index');
$I->waitForElement(\Codeception\Util\Locator::contains('h1', 'Настройки'));
$this->testFormValidation($I, 'TsdPricetagForm', $example);
$I->wantTo('test template alias validation');
$I->click(Locator::contains('#content_templatesCollapseable a', 'Добавить шаблоны'));
$I->waitForElementVisible('#templatesDialog', $I::TIMEOUT);
$I->click(Locator::elementAt('#templatesGrid .items tbody tr', 1));
$I->seeCheckboxIsChecked('#checkboxTemplatesColumn_0');
$I->click('#templateDialogSelect');
$I->waitForElementNotVisible('#templatesDialog');
$I->waitForElement('#templatesCollapseable div.ym-grid');
$fieldSelector = '#templatesCollapseable div.ym-grid input[type="text"]';
$templateFieldValidator = $this->validationHelper->createValidator($fieldSelector, array('type' => 'length', 'min' => 1, 'max' => 1, 'value' => 1));
$templateFieldValidator->isSelectorXPath = true;
$templateFieldValidator->validateWithSubmit = true;
$templateFieldValidator->submitButton = '#save';
$templateFieldValidator->validate($I);
$I->wait($I::WAIT_A_SEC);
}
/**
* @param AcceptanceTester $I
*/
public function testSettingsSaveCorrectly(AcceptanceTester $I)
{
$I->wantTo('test settings validation');
$I->amOnPage('index.php?r=tsd/settings/index');
$I->seeInField('#TsdPricetagForm_importFilesDestinationFolder', 'C:\tmp\tsd\import');
$I->seeInField('#TsdPricetagForm_archiveExpirationDate', '1');
$I->seeInField('#TsdPricetagForm_archiveDestinationFolder', 'C:\tmp\tsd\archive');
$I->seeInField('#TsdPricetagForm_logsDestinationFolder', 'C:\tmp\tsd\logs');
$I->seeInField('#templatesCollapseable .ym-grid input[type="text"]', '1');
}
}
/**
* @depends testSettingsValidation
* @param AcceptanceTester $I
*/
public function testSettingsSaveCorrectly(AcceptanceTester $I)
/**
* @depends OperationalActivity\TsdPricetagCest::testSettingsValidation
* @param AcceptanceTester $I
*/
public function testSettingsSaveCorrectly(AcceptanceTester $I)
@after
@before
Answer the question
In order to leave comments, you need to log in
As it turned out, using the before, after annotations together with the example injection does not work - the annotations work fine without them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question