Merge pull request #10635 from creative-commoners/pulls/5/fix-behat

MNT Fix using treedropdownfield in behat
This commit is contained in:
Maxime Rainville 2023-01-11 11:34:27 +13:00 committed by GitHub
commit 2868edd8d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,13 +304,13 @@ JS;
}); });
$this->retryThrowable(function () use ($parentElement, $selector) { $this->retryThrowable(function () use ($parentElement, $selector) {
$dropdown = $parentElement->find('css', '.Select-arrow'); $dropdown = $parentElement->find('css', '.treedropdownfield__dropdown-indicator');
Assert::assertNotNull($dropdown, sprintf('Unable to find the dropdown in "%s"', $selector)); Assert::assertNotNull($dropdown, sprintf('Unable to find the dropdown in "%s"', $selector));
$dropdown->click(); $dropdown->click();
}); });
$this->retryThrowable(function () use ($text, $parentElement, $selector) { $this->retryThrowable(function () use ($text, $parentElement, $selector) {
$element = $parentElement->find('xpath', sprintf('//*[count(*)=0 and contains(.,"%s")]', $text)); $element = $parentElement->find('xpath', sprintf('//*[count(*)=0 and .="%s"]', $text));
Assert::assertNotNull($element, sprintf('"%s" not found in "%s"', $text, $selector)); Assert::assertNotNull($element, sprintf('"%s" not found in "%s"', $text, $selector));
$element->click(); $element->click();
}); });
@ -326,14 +326,14 @@ JS;
{ {
$locator = $this->fixStepArgument($locator); $locator = $this->fixStepArgument($locator);
$page = $this->getSession()->getPage(); $page = $this->getSession()->getPage();
// Searching by name is usually good... // Searching by name is usually good...
$element = $page->find('css', 'textarea.htmleditor[name=\'' . $locator . '\']'); $element = $page->find('css', 'textarea.htmleditor[name=\'' . $locator . '\']');
if ($element === null) { if ($element === null) {
$element = $this->findInputByLabelContent($locator); $element = $this->findInputByLabelContent($locator);
} }
Assert::assertNotNull($element, sprintf('HTML field "%s" not found', $locator)); Assert::assertNotNull($element, sprintf('HTML field "%s" not found', $locator));
return $element; return $element;
} }