3 use Codeception\Util\Locator;
8 public function _before(FunctionalTester $I)
10 $I->amLoggedInAs(User::findByUsername('user'));
11 $I->amOnRoute('items/create');
15 // Открыта страница добавления
16 public function openCreatePage(FunctionalTester $I)
19 $I->see(Yii::t('items', 'Create Items'), 'h1');
21 $I->see(Yii::t('items', 'Item type'), 'label');
22 $I->see(Yii::t('items', 'Item network name'), 'label');
23 $I->see(Yii::t('items', 'Model'), 'label');
24 $I->see(Yii::t('items', 'Operating system'), 'label');
25 $I->see(Yii::t('items', 'MAC address'), 'label');
26 $I->see(Yii::t('items', 'Serial number'), 'label');
27 $I->see(Yii::t('items', 'Product number'), 'label');
28 $I->see(Yii::t('items', 'Model number'), 'label');
29 $I->see(Yii::t('items', 'Inventory number'), 'label');
30 $I->see(Yii::t('items', 'Additional Information'), 'label');
31 $I->see(Yii::t('moving', 'Moving date'), 'label');
32 $I->see(Yii::t('status', 'Status'), 'label');
33 $I->see(Yii::t('locations', 'Location'), 'label');
35 $I->see(Yii::t('app', 'Save'), 'button');
36 $I->see(Yii::t('app', 'Cancel'), 'a.btn');
40 public function enterData(FunctionalTester $I)
42 $I->submitForm('#ItemForm', [
43 'Items[type_id]' => '1',
44 'Items[name]' => 'TEST-WS-0001',
45 'Items[model]' => 'Тестовый компьютер',
46 'Items[os]' => 'Тестовая ОС',
47 'Items[mac]' => '00:00-MAC-:00:00',
48 'Items[serial]' => '*TEST SERIAL NUMBER*',
49 'Items[product]' => 'TEST PRODUCT',
50 'Items[modelnumber]' => 'TEST MODEL NUMBER',
51 'Items[invent]' => '*TEST INVENTORY NUMBER*',
52 'Items[comment]' => 'Тестирование. Это тестовая запись.',
53 'Moving[date]' => '01.01.2020',
54 'Moving[state_id]' => '1',
55 'Moving[location_id]' => '1',
57 $I->see(Yii::t('items', 'Items'), 'h1');
58 $I->dontSee(Yii::t('items', 'Create Items'), 'h1');
61 // Нажатие на кнопку "Типы"
62 public function pushTypes(FunctionalTester $I)
64 $I->click(Locator::contains('div a', Yii::t('types', 'Types')));
65 $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
66 $I->see(Yii::t('types', 'Types'), 'h1');
67 $I->dontSee(Yii::t('items', 'Create Items'), 'h1');
70 // Нажатие на кнопку "Места размещения"
71 public function pushLocations(FunctionalTester $I)
73 $I->click(Locator::contains('div a', Yii::t('locations', 'Locations')));
74 $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
75 $I->see(Yii::t('locations', 'Locations'), 'h1');
76 $I->dontSee(Yii::t('items', 'Create Items'), 'h1');
79 // Нажатие на кнопку "Отмена"
80 public function pushCancel(FunctionalTester $I)
82 $I->click(Locator::contains('div a', Yii::t('app', 'Cancel')));
83 $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
84 $I->see(Yii::t('items', 'Items'), 'h1');
85 $I->dontSee(Yii::t('items', 'Create Items'), 'h1');