Merge pull request #6219 from open-sausages/pulls/4.0/fix-behat-search-chosen

BUG Prevent intermittent "Element is not currently visible and so may not be interacted with"
This commit is contained in:
Ingo Schommer 2016-10-25 17:33:22 +13:00 committed by GitHub
commit a4a895ff43

View File

@ -239,7 +239,7 @@ class CmsUiContext extends BehatContext {
$filterButtonCssClass = $filterButton->getAttribute('class'); $filterButtonCssClass = $filterButton->getAttribute('class');
if($action == 'expand') { if($action === 'expand') {
if(strpos($filterButtonCssClass, 'active') === false) { if(strpos($filterButtonCssClass, 'active') === false) {
$filterButton->click(); $filterButton->click();
} }
@ -250,6 +250,17 @@ class CmsUiContext extends BehatContext {
} }
$this->getSession()->wait(2000, 'window.jQuery(".cms-content-filters:animated").length === 0'); $this->getSession()->wait(2000, 'window.jQuery(".cms-content-filters:animated").length === 0');
// If activating, wait until chosen is activated
if ($action === 'expand') {
$this->getSession()->wait(
2000,
<<<'SCRIPT'
(window.jQuery(".cms-content-filters select").length === 0) ||
(window.jQuery(".cms-content-filters select:visible.has-chosen").length > 0)
SCRIPT
);
}
} }
/** /**