Merge remote-tracking branch 'upstream/4.4' into 4.4-4.5-2014-09-29-14-51-22
[civicrm-core.git] / tests / phpunit / WebTest / Generic / CheckDashboardTest.php
index 09737aacb29df40cad1df07893a6828f309117ce..912ca2ab5d3992985bcbff9edb05f67a1df1f0ce 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 */
 
 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=//button[@title='Close']");
   }
 
+  /**
+   * @param $widgetConfigureID
+   * @param $widgetEnabledSelector
+   */
   function _testRemoveDashboardElement($widgetConfigureID, $widgetEnabledSelector) {
     $this->click("link=Configure Your Dashboard");
     $this->waitForElementPresent("dashlets-header-col-0");
@@ -132,11 +145,11 @@ class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase {
     // If CiviCase enabled, click 'more' link for context menu pop-up in the widget selector
     if ($this->isElementPresent("//table[@id='contact-activity-selector-dashlet']/tbody/tr[1]/td[8]/span[text()='more ']")) {
       // click 'Delete Activity' link
-      $this->click("//table[@id='contact-activity-selector-dashlet']/tbody/tr[1]/td[8]/span[text()='more ']/ul/li[2]/a[text()='Delete']");
+      $this->click("//table[@class='contact-activity-selector-dashlet dataTable no-footer']/tbody/tr[1]/td[8]/span[text()='more ']/ul/li[2]/a[text()='Delete']");
     }
     else {
       // click 'Delete Activity' link
-      $this->click("//table[@id='contact-activity-selector-dashlet']/tbody/tr[1]/td[8]/span//a[text()='Delete']");
+      $this->click("//table[@class='contact-activity-selector-dashlet dataTable no-footer']/tbody/tr[1]/td[8]/span//a[text()='Delete']");
     }
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForElementPresent("_qf_Activity_next-bottom");