1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace hipanel\modules\server\tests\_support\Page\Hub; |
4
|
|
|
|
5
|
|
|
use Codeception\Example; |
|
|
|
|
6
|
|
|
use hipanel\tests\_support\Page\Authenticated; |
7
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Dropdown; |
8
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Input; |
9
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Select2; |
10
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Textarea; |
11
|
|
|
|
12
|
|
|
abstract class Hub extends Authenticated |
13
|
|
|
{ |
14
|
|
|
public function fillForm(Example $data) |
15
|
|
|
{ |
16
|
|
|
$I = $this->tester; |
17
|
|
|
foreach ($data as $field => $value) { |
18
|
|
|
if ($value) { |
19
|
|
|
switch (true) { |
20
|
|
|
case in_array($field, ['type_id']): |
21
|
|
|
(new Dropdown($I, "select[name$=\"[{$field}]\"]"))->setValue($value); |
22
|
|
|
break; |
23
|
|
|
case in_array($field, ['note']): |
24
|
|
|
(new Textarea($I, "textarea[name$=\"[{$field}]\"]"))->setValue($value); |
25
|
|
|
break; |
26
|
|
|
case in_array($field, ['net_id', 'kvm_id', 'pdu_id', 'rack_id', 'pdu2_id', 'nic2_id', 'ipmi_id', 'location_id']): |
27
|
|
|
(new Select2($I, "select[name$=\"[{$field}]\"]"))->setValue($value); |
28
|
|
|
break; |
29
|
|
|
default: |
30
|
|
|
(new Input($I, "input[name$=\"[{$field}]\"]"))->setValue($value); |
31
|
|
|
} |
32
|
|
|
} |
33
|
|
|
} |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function needPageByName(string $name): self |
37
|
|
|
{ |
38
|
|
|
$this->tester->click("//td/a[contains(text(), '{$name}')]"); |
39
|
|
|
$this->waitPjax(); |
40
|
|
|
|
41
|
|
|
return $this; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function submitForm(): self |
45
|
|
|
{ |
46
|
|
|
$this->tester->pressButton('Save'); |
47
|
|
|
$this->waitPjax(); |
48
|
|
|
$this->hasNotErrors(); |
49
|
|
|
|
50
|
|
|
return $this; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function hasNotErrors(): self |
54
|
|
|
{ |
55
|
|
|
$this->tester->dontSeeElement("//*[contains(@class, 'has-error')]"); |
56
|
|
|
|
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function hasErrors(): self |
61
|
|
|
{ |
62
|
|
|
$this->tester->seeElement("//*[contains(@class, 'has-error')]"); |
63
|
|
|
|
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function check($data): self |
68
|
|
|
{ |
69
|
|
|
foreach ($data as $field => $value) { |
70
|
|
|
if ($value) { |
71
|
|
|
$this->tester->see($value); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function waitPjax(): self |
79
|
|
|
{ |
80
|
|
|
$this->tester->waitForJS("return $.active == 0;", 30); |
81
|
|
|
|
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
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