3 use Codeception\Util\Locator;
7 public function _before(\FunctionalTester $I)
9 $I->amOnRoute('items/update', ['id' => '1']);
10 $I->click(Yii::t('moving', 'Create Moving'), 'a.btn');
14 // Проверка открытия страницы на добавление
15 public function openInsertPage(\FunctionalTester $I)
18 $I->see(Yii::t('moving', 'Create Moving'), 'h1');
20 $I->dontSee(Yii::t('items', 'Update Items: {name}', [ 'name' => '', ]), 'h1');
21 $I->see(Yii::t('moving', 'Moving date'), 'label');
22 $I->see(Yii::t('status', 'Status'), 'label');
23 $I->see(Yii::t('locations', 'Location'), 'label');
24 $I->see(Yii::t('moving', 'Comment'), 'label');
26 $I->see(Yii::t('app', 'Save'), 'button');
27 $I->see(Yii::t('app', 'Cancel'), 'a.btn');
30 // Нажатие кнопки "Места размещения"
31 public function clickLocations(\FunctionalTester $I)
33 $I->click(Locator::contains('div a', Yii::t('locations', 'Locations')));
34 $I->see(Yii::t('locations', 'Locations'), 'h1');
35 $I->dontSee(Yii::t('moving', 'Create Moving'), 'h1');
38 // Нажатие сохранение данных
39 public function enterData(\FunctionalTester $I)
41 $I->submitForm('#MovingForm', [
42 'Moving[date]' => '20.09.2020',
43 'Moving[state_id]' => '1',
44 'Moving[location_id]' => '1',
45 'Moving[comment]' => '*TEST MOVE COMMENT*',
47 $I->see(Yii::t('items', 'Update Items: {name}', [ 'name' => '', ]), 'h1');
48 $I->dontSee(Yii::t('moving', 'Create Moving'), 'h1');
49 $I->see('20.09.2020', '#MovingTable a');
52 // Нажатие кнопки попытка сохранить неправильную дату
53 public function enterWrongAboveTodayData(\FunctionalTester $I)
55 $I->submitForm('#MovingForm', [
56 'Moving[date]' => '20.09.2200',
57 'Moving[state_id]' => '1',
58 'Moving[location_id]' => '1',
59 'Moving[comment]' => '*TEST MOVE COMMENT*',
61 $I->dontSee(Yii::t('items', 'Update Items: {name}', [ 'name' => '', ]), 'h1');
62 $I->see(Yii::t('moving', 'Create Moving'), 'h1');
63 $I->see(Yii::t('moving', 'The date cannot be more than today'));
66 // Нажатие кнопки попытка сохранить неправильную дату
67 public function enterWrongDataBeforeFirst(\FunctionalTester $I)
69 $I->submitForm('#MovingForm', [
70 'Moving[date]' => '01.01.2010',
71 'Moving[state_id]' => '1',
72 'Moving[location_id]' => '1',
73 'Moving[comment]' => '*TEST MOVE COMMENT*',
75 $I->dontSee(Yii::t('items', 'Update Items: {name}', [ 'name' => '', ]), 'h1');
76 $I->see(Yii::t('moving', 'Create Moving'), 'h1');
77 $I->see(Yii::t('moving', 'Дата не может быть меньше, чем {date}', [ 'date' => '' ]));