1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace hipanel\tests\_support\Page; |
4
|
|
|
|
5
|
|
|
class IndexPage extends Authenticated |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @param string $formId |
9
|
|
|
* @param array[] $filters Example: |
10
|
|
|
* ```php |
11
|
|
|
* [ |
12
|
|
|
* ['textarea' => ['placeholder' => 'Domain names (one per row)']], |
13
|
|
|
* ['input' => [ |
14
|
|
|
* 'id' => 'domainsearch-created_from', |
15
|
|
|
* 'name' => 'date-picker', |
16
|
|
|
* ]], |
17
|
|
|
* ] |
18
|
|
|
*``` |
19
|
|
|
*/ |
20
|
|
|
public function containsFilters(string $formId, array $filters): void |
21
|
|
|
{ |
22
|
|
|
$I = $this->tester; |
23
|
|
|
|
24
|
|
|
foreach ($filters as $filter) { |
25
|
|
|
foreach ($filter as $selector => $attributes) { |
26
|
|
|
$I->seeElement("//form[@id='$formId']//$selector", $attributes); |
27
|
|
|
} |
28
|
|
|
} |
29
|
|
|
$I->see('Search', "//form[@id='$formId']//button[@type='submit']"); |
30
|
|
|
$I->see('Clear', "//form[@id='$formId']//a"); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param array[] $buttons Example: |
35
|
|
|
* ```php |
36
|
|
|
* [ |
37
|
|
|
* ["//button[@type='button']" => 'Set IPs'], |
38
|
|
|
* ] |
39
|
|
|
*``` |
40
|
|
|
*/ |
41
|
|
|
public function containsBulkButtons(array $buttons): void |
42
|
|
|
{ |
43
|
|
|
$I = $this->tester; |
44
|
|
|
|
45
|
|
|
foreach ($buttons as $button) { |
46
|
|
|
foreach ($button as $selector => $text) { |
47
|
|
|
$I->see($text, $selector); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param string $formId |
54
|
|
|
* @param string[] $columnNames array of column names |
55
|
|
|
*/ |
56
|
|
|
public function containsColumns(string $formId, array $columnNames): void |
57
|
|
|
{ |
58
|
|
|
$I = $this->tester; |
59
|
|
|
|
60
|
|
|
foreach ($columnNames as $column) { |
61
|
|
|
$I->see($column, "//form[@id='$formId']//table/thead/tr/th"); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|