| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Server module for HiPanel |
||
| 4 | * |
||
| 5 | * @link https://github.com/hiqdev/hipanel-module-server |
||
| 6 | * @package hipanel-module-server |
||
| 7 | * @license BSD-3-Clause |
||
| 8 | * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace hipanel\modules\server\tests\acceptance\admin; |
||
| 12 | |||
| 13 | use Codeception\Example; |
||
|
0 ignored issues
–
show
|
|||
| 14 | use hipanel\helpers\Url; |
||
| 15 | use hipanel\modules\server\tests\_support\Page\Hub\AssignHubs; |
||
| 16 | use hipanel\modules\server\tests\_support\Page\Hub\Create; |
||
| 17 | use hipanel\modules\server\tests\_support\Page\Hub\Options; |
||
| 18 | use hipanel\modules\server\tests\_support\Page\Hub\Update; |
||
| 19 | use hipanel\modules\server\tests\_support\Page\Hub\View; |
||
| 20 | use hipanel\tests\_support\Page\IndexPage; |
||
| 21 | use hipanel\tests\_support\Page\Widget\Input\Input; |
||
| 22 | use hipanel\tests\_support\Step\Acceptance\Admin; |
||
| 23 | |||
| 24 | class HubCest |
||
| 25 | { |
||
| 26 | /** @var IndexPage */ |
||
| 27 | private $indexPage; |
||
| 28 | |||
| 29 | /** @var View */ |
||
| 30 | private $viewPage; |
||
| 31 | |||
| 32 | /** @var Example */ |
||
| 33 | private $hubData; |
||
| 34 | |||
| 35 | public function _before(Admin $I) |
||
| 36 | { |
||
| 37 | $this->indexPage = new IndexPage($I); |
||
| 38 | $this->viewPage = new View($I); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @dataProvider createProvider |
||
| 43 | * @param Admin $I |
||
| 44 | * @param Example $data |
||
| 45 | * @throws \Exception |
||
| 46 | */ |
||
| 47 | public function ensureICanCreateHub(Admin $I, Example $data): void |
||
| 48 | { |
||
| 49 | $createPage = new Create($I); |
||
| 50 | |||
| 51 | $I->needPage(Url::to(['@hub/create'])); |
||
| 52 | $createPage->fillForm($data) |
||
| 53 | ->hasNotErrors() |
||
| 54 | ->submitForm(); |
||
| 55 | |||
| 56 | $I->closeNotification('Switch was created'); |
||
| 57 | $I->seeInCurrentUrl(Url::to(['@hub/view'])); |
||
| 58 | $this->viewPage->check($data); |
||
| 59 | $this->hubData = $data; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @dataProvider assignHubsProvider |
||
| 64 | * @param Admin $I |
||
| 65 | * @param Example $data |
||
| 66 | * @throws \Codeception\Exception\ModuleException |
||
| 67 | */ |
||
| 68 | public function ensureICanAssignHubs(Admin $I, Example $data): void |
||
| 69 | { |
||
| 70 | $assignPage = new AssignHubs($I); |
||
| 71 | |||
| 72 | $I->needPage(Url::to(['@hub/index'])); |
||
| 73 | |||
| 74 | $this->indexPage->filterBy( |
||
| 75 | Input::asTableFilter($I, 'Name'), $this->hubData['name'] |
||
| 76 | ); |
||
| 77 | $this->indexPage->openRowMenuByColumnValue('Name', $this->hubData['name']); |
||
| 78 | $this->indexPage->chooseRowMenuOption('Switches'); |
||
| 79 | |||
| 80 | $assignPage->fillForm($data) |
||
| 81 | ->hasNotErrors() |
||
| 82 | ->submitForm(); |
||
| 83 | $I->closeNotification('Switches have been edited'); |
||
| 84 | $I->seeInCurrentUrl(Url::to(['@hub/view'])); |
||
| 85 | $this->viewPage->check($data); |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @dataProvider optionsDataProvider |
||
| 90 | * @param Admin $I |
||
| 91 | * @param Example $data |
||
| 92 | * @throws \Codeception\Exception\ModuleException |
||
| 93 | */ |
||
| 94 | public function ensureICanSetHubOptions(Admin $I, Example $data): void |
||
| 95 | { |
||
| 96 | $optionsPage = new Options($I); |
||
| 97 | |||
| 98 | $I->needPage(Url::to(['@hub/index'])); |
||
| 99 | |||
| 100 | $this->indexPage->filterBy( |
||
| 101 | Input::asTableFilter($I, 'Name'), $this->hubData['name'] |
||
| 102 | ); |
||
| 103 | $this->indexPage->openRowMenuByColumnValue('Name', $this->hubData['name']); |
||
| 104 | $this->indexPage->chooseRowMenuOption('Options'); |
||
| 105 | |||
| 106 | $optionsPage->fillForm($data) |
||
| 107 | ->hasNotErrors() |
||
| 108 | ->submitForm(); |
||
| 109 | $I->closeNotification('Options was updated'); |
||
| 110 | $I->seeInCurrentUrl(Url::to(['@hub/view'])); |
||
| 111 | $this->viewPage->check($data); |
||
| 112 | } |
||
| 113 | |||
| 114 | /** |
||
| 115 | * @param Admin $I |
||
| 116 | * @throws \Codeception\Exception\ModuleException |
||
| 117 | */ |
||
| 118 | public function ensureICanUpdateHub(Admin $I): void |
||
| 119 | { |
||
| 120 | $updatePage = new Update($I); |
||
| 121 | |||
| 122 | $I->needPage(Url::to(['@hub/index'])); |
||
| 123 | $this->indexPage->filterBy( |
||
| 124 | Input::asTableFilter($I, 'Name'), $this->hubData['name'] |
||
| 125 | ); |
||
| 126 | $this->indexPage->openRowMenuByColumnValue('Name', $this->hubData['name']); |
||
| 127 | $this->indexPage->chooseRowMenuOption('Update'); |
||
| 128 | $this->updateHubData(); |
||
| 129 | |||
| 130 | $updatePage->fillForm($this->hubData) |
||
| 131 | ->hasNotErrors() |
||
| 132 | ->submitForm(); |
||
| 133 | $I->closeNotification('Switch was updated'); |
||
| 134 | $I->seeInCurrentUrl(Url::to(['@hub/view'])); |
||
| 135 | $this->viewPage->check($this->hubData); |
||
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @dataProvider createProvider |
||
| 140 | * @param Admin $I |
||
| 141 | * @throws \Codeception\Exception\ModuleException |
||
| 142 | */ |
||
| 143 | public function ensureICanDeleteHub(Admin $I): void |
||
| 144 | { |
||
| 145 | $viewPage = new View($I); |
||
| 146 | |||
| 147 | $I->needPage(Url::to(['@hub/index'])); |
||
| 148 | $this->indexPage->filterBy( |
||
| 149 | Input::asTableFilter($I, 'Name'), $this->hubData['name'] |
||
| 150 | ); |
||
| 151 | $this->indexPage->openRowMenuByColumnValue('Name', $this->hubData['name']); |
||
| 152 | $this->indexPage->chooseRowMenuOption('View'); |
||
| 153 | $viewPage->clickAction('Delete'); |
||
| 154 | $I->acceptPopup(); |
||
| 155 | $I->closeNotification('Switches have been deleted'); |
||
| 156 | } |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @return array |
||
| 160 | */ |
||
| 161 | protected function createProvider(): array |
||
| 162 | { |
||
| 163 | return [ |
||
| 164 | [ |
||
| 165 | 'name' => 'test_switch' . uniqid(), |
||
| 166 | 'type_id' => 'Switch', |
||
| 167 | 'inn' => 'test_inn', |
||
| 168 | 'model' => 'test_model', |
||
| 169 | 'note' => 'test_note', |
||
| 170 | ], |
||
| 171 | ]; |
||
| 172 | } |
||
| 173 | |||
| 174 | protected function updateHubData(): void |
||
| 175 | { |
||
| 176 | foreach ($this->hubData as $field => $value) { |
||
| 177 | if (!in_array($field, ['type_id', 'ip', 'mac', 'name'])) { |
||
| 178 | $this->hubData[$field] = $value . '_updated'; |
||
| 179 | } |
||
| 180 | } |
||
| 181 | } |
||
| 182 | |||
| 183 | /** |
||
| 184 | * @return array |
||
| 185 | */ |
||
| 186 | protected function assignHubsProvider(): array |
||
| 187 | { |
||
| 188 | return [ |
||
| 189 | [ |
||
| 190 | 'net_id' => 'TEST-SW-05', |
||
| 191 | 'net_port' => 'port' . uniqid(), |
||
| 192 | 'kvm_id' => 'TEST-SW-04', |
||
| 193 | 'kvm_port' => 'port' . uniqid(), |
||
| 194 | 'pdu_id' => 'TEST-SW-06', |
||
| 195 | 'pdu_port' => 'port' . uniqid(), |
||
| 196 | 'rack_id' => 'TEST-SW-02', |
||
| 197 | 'rack_port' => 'port' . uniqid(), |
||
| 198 | 'location_id' => 'TEST-SW-03', |
||
| 199 | ], |
||
| 200 | ]; |
||
| 201 | } |
||
| 202 | |||
| 203 | /** |
||
| 204 | * @return array |
||
| 205 | */ |
||
| 206 | protected function optionsDataProvider(): array |
||
| 207 | { |
||
| 208 | return [ |
||
| 209 | [ |
||
| 210 | 'inn' => 'test_inn_option', |
||
| 211 | 'model' => 'test_model_option', |
||
| 212 | 'ports_num' => 42, |
||
| 213 | 'community' => 'hiqdev', |
||
| 214 | 'nic_media' => '100 Gbit/s', |
||
| 215 | 'digit_capacity_id' => 'vds2', |
||
| 216 | 'base_port_no' => 21, |
||
| 217 | ], |
||
| 218 | ]; |
||
| 219 | } |
||
| 220 | } |
||
| 221 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths