3 use Codeception\Util\Locator;
8 public function _before(\FunctionalTester $I)
10 $I->amLoggedInAs(\app\models\User::findByUsername('admin'));
11 $I->amOnPage(['items/index']);
14 // наполнение страницы
15 public function openItemsPage(\FunctionalTester $I)
17 $I->see(Yii::t('items', 'Items'), 'h1');
18 $I->see(Yii::t('items', 'Inventory number'), '#ItemsTable tr th a');
19 $I->see(Yii::t('items', 'Serial number'), '#ItemsTable tr th a');
20 $I->see(Yii::t('items', 'Model'), '#ItemsTable tr th a');
21 $I->see(Yii::t('regions', 'Region'), '#ItemsTable tr th a');
22 $I->see(Yii::t('status', 'Status'), '#ItemsTable tr th a');
25 // Переход к странице добавления
26 public function pushCreateItem(\FunctionalTester $I)
28 $I->click(Locator::contains('div a', Yii::t('items', 'Create Items')));
29 $I->see(Yii::t('items', 'Create Items'), 'h1');
32 // Переход к странице импорта
33 public function pushImportItems(\FunctionalTester $I)
35 $I->click(Locator::contains('div a', Yii::t('items', 'Import')));
36 $I->see(Yii::t('items', 'Import Items'), 'h1');
39 // Формирование печатной формы PDF
40 public function pushPrintItems(\FunctionalTester $I)
42 $I->click(Locator::contains('div a', Yii::t('items', 'Print Items')));
43 $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
45 // Этот участок кода пока не понятно как включить, но функционал обязательно добавлю.
47 //$I->canSeeHttpHeader('Content-type', 'application/pdf');
48 //$I->canSeeHttpHeader('Content-disposition', 'attachment; filename="' . Yii::t('app', Yii::$app->name) . ' (' . Yii::t('items', 'Items') . ').pdf"');
52 //$I->canSeeHttpHeader('Content-length', '1024');
54 //$actualLength= $I->grabHttpHeader('Content-length');
55 //$I->assertGreaterThan(1024, $actualLength);
58 // Начало инвентаризации
59 public function pushStartInventory(\FunctionalTester $I)
61 $I->click(Locator::contains('div a', Yii::t('items', 'Start checking')));
62 $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
63 $I->see('', 'tr.danger');
66 // Нажатие на кнопку "Удалить"
67 public function clickDeleteItem(\FunctionalTester $I)
69 $I->click(Locator::find('a', [ 'title' => Yii::t('yii', 'Delete') ]));
70 $I->seeResponseCodeIs(405);
71 //$I->see(Yii::t('yii', 'Are you sure you want to delete this item?'));
74 // Печать отдельной наклейки
75 public function clickPrintItem(\FunctionalTester $I)
77 $I->click(Locator::find('a', [ 'title' => Yii::t('items', 'Print selected labels') ]));
78 $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
82 // переход к редактированию элемента
83 public function clickItem(\FunctionalTester $I)
85 $I->click(Locator::contains('tr td a', ''));
86 $I->see(Yii::t('items', 'Update Items: {name}', [ 'name' => '', ]), 'h1');