Check for jQuery in Behat tests

Identified as one potential cause for flickering tests
on our own Selenium box.
This commit is contained in:
Ingo Schommer 2013-09-30 23:36:46 +02:00
parent d963eac0a6
commit a68e0ba365

View File

@ -73,7 +73,10 @@ class CmsUiContext extends BehatContext
protected function getCmsTabsElement() protected function getCmsTabsElement()
{ {
$this->getSession()->wait(5000, "window.jQuery('.cms-content-header-tabs').size() > 0"); $this->getSession()->wait(
5000,
"window.jQuery && window.jQuery('.cms-content-header-tabs').size() > 0"
);
$page = $this->getSession()->getPage(); $page = $this->getSession()->getPage();
$cms_content_header_tabs = $page->find('css', '.cms-content-header-tabs'); $cms_content_header_tabs = $page->find('css', '.cms-content-header-tabs');
@ -86,7 +89,7 @@ class CmsUiContext extends BehatContext
{ {
$this->getSession()->wait( $this->getSession()->wait(
5000, 5000,
"window.jQuery('.cms-content-toolbar').size() > 0 " "window.jQuery && window.jQuery('.cms-content-toolbar').size() > 0 "
. "&& window.jQuery('.cms-content-toolbar').children().size() > 0" . "&& window.jQuery('.cms-content-toolbar').children().size() > 0"
); );
@ -99,7 +102,10 @@ class CmsUiContext extends BehatContext
protected function getCmsTreeElement() protected function getCmsTreeElement()
{ {
$this->getSession()->wait(5000, "window.jQuery('.cms-tree').size() > 0"); $this->getSession()->wait(
5000,
"window.jQuery && window.jQuery('.cms-tree').size() > 0"
);
$page = $this->getSession()->getPage(); $page = $this->getSession()->getPage();
$cms_tree_element = $page->find('css', '.cms-tree'); $cms_tree_element = $page->find('css', '.cms-tree');
@ -181,7 +187,10 @@ class CmsUiContext extends BehatContext
*/ */
public function iClickTheCmsTab($tab) public function iClickTheCmsTab($tab)
{ {
$this->getSession()->wait(5000, "window.jQuery('.ui-tabs-nav').size() > 0"); $this->getSession()->wait(
5000,
"window.jQuery && window.jQuery('.ui-tabs-nav').size() > 0"
);
$page = $this->getSession()->getPage(); $page = $this->getSession()->getPage();
$tabsets = $page->findAll('css', '.ui-tabs-nav'); $tabsets = $page->findAll('css', '.ui-tabs-nav');
@ -343,7 +352,8 @@ class CmsUiContext extends BehatContext
// wait for ajax dropdown to load // wait for ajax dropdown to load
$this->getSession()->wait( $this->getSession()->wait(
5000, 5000,
"jQuery('#" . $container->getAttribute('id') . " .treedropdownfield-panel li').length > 0" "window.jQuery && "
. "window.jQuery('#" . $container->getAttribute('id') . " .treedropdownfield-panel li').length > 0"
); );
} else { } else {
// wait for dropdown overlay to appear (might be animated) // wait for dropdown overlay to appear (might be animated)