| @@ 59-73 (lines=15) @@ | ||
| 56 | * @param string $field |
|
| 57 | * @throws \Exception |
|
| 58 | */ |
|
| 59 | private function openComponent(DocumentElement $page, $component, $field) |
|
| 60 | { |
|
| 61 | $select = $page->find('css', sprintf('#%s', $field)); |
|
| 62 | if (!$select) { |
|
| 63 | throw new \Exception(sprintf('No select "%s" found', $field)); |
|
| 64 | } |
|
| 65 | ||
| 66 | $fieldName = sprintf('.fs-%1$s .fs-%1$s-selected', $component); |
|
| 67 | $choices = $select->getParent()->find('css', $fieldName); |
|
| 68 | if (!$choices) { |
|
| 69 | throw new \Exception(sprintf('No field "%s" found', $field)); |
|
| 70 | } |
|
| 71 | ||
| 72 | $choices->press(); |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * Select value in choice list |
|
| @@ 84-98 (lines=15) @@ | ||
| 81 | * @param string $field |
|
| 82 | * @throws \Exception |
|
| 83 | */ |
|
| 84 | private function openField(DocumentElement $page, $field) |
|
| 85 | { |
|
| 86 | $fieldName = sprintf('select[name="%s"] + .select2-container', $field); |
|
| 87 | ||
| 88 | $inputField = $page->find('css', $fieldName); |
|
| 89 | if (!$inputField) { |
|
| 90 | throw new \Exception(sprintf('No field "%s" found', $field)); |
|
| 91 | } |
|
| 92 | ||
| 93 | $choice = $inputField->find('css', '.select2-selection'); |
|
| 94 | if (!$choice) { |
|
| 95 | throw new \Exception(sprintf('No select2 choice found for "%s"', $field)); |
|
| 96 | } |
|
| 97 | $choice->press(); |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Fill Select2 search field |
|