Merge pull request #3339 from yashodha/CRM-14664
[civicrm-core.git] / tests / phpunit / WebTest / Generic / CheckDashboardTest.php
index a5fc470086732a742125e355635250187fbcd1dc..131a9a8904ae4a9073c6d8d813b55b0c620845f5 100644 (file)
 */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Generic_CheckDashboardTest
+ */
 class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase {
 
   protected function setUp() {
@@ -46,6 +50,11 @@ class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase {
     // More dashlet tests can be added here using the functions modeled below
   }
 
+  /**
+   * @param $widgetConfigureID
+   * @param $widgetEnabledSelector
+   * @param $widgetTitle
+   */
   function _testAddDashboardElement($widgetConfigureID, $widgetEnabledSelector, $widgetTitle) {
     // Check if desired widget is already loaded on dashboard and remove it if it is so we can test adding it.
     // Because it tends to cause problems, all uses of sleep() must be justified in comments
@@ -80,14 +89,18 @@ class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("css=li#widget-2 a.fullscreen-icon");
     $this->click("css=li#widget-2 a.fullscreen-icon");
     $this->waitForElementPresent("ui-id-1");
-    $this->assertTrue($this->isTextPresent($widgetTitle));
+    $this->waitForTextPresent("$widgetTitle");
     // Because it tends to cause problems, all uses of sleep() must be justified in comments
     // Sleep should never be used for wait for anything to load from the server
     // Justification for this instance: FIXME
     sleep(5);
-    $this->click("link=close");
+    $this->click("xpath=//*[@class='ui-button-text'][contains(text(), 'close')]");
   }
 
+  /**
+   * @param $widgetConfigureID
+   * @param $widgetEnabledSelector
+   */
   function _testRemoveDashboardElement($widgetConfigureID, $widgetEnabledSelector) {
     $this->click("link=Configure Your Dashboard");
     $this->waitForElementPresent("dashlets-header-col-0");