INFRA-132 - Remove white space after an opening "(" or before a closing ")"
[civicrm-core.git] / tests / phpunit / WebTest / Report / LoggingReportTest.php
index 9713d236566314eb5fd710796f85ed15013bcdc7..8a28e6130e428815b9402ef5b369bd21f5b01622 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -35,7 +35,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
     parent::setUp();
   }
 
-  function testLoggingReport() {
+  public function testLoggingReport() {
     $this->webtestLogin();
 
     //enable the logging
@@ -100,15 +100,14 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
     $this->type('subject', $noteSubject);
     $this->type('note', $noteText);
     $this->click("_qf_Note_upload-top");
-    $this->waitForElementPresent("xpath=//div[@id='notes']//a[text()='Edit']");
-    $this->click("xpath=//div[@id='notes']//a[text()='Edit']");
-
+    $this->waitForElementPresent("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[1]/a[2][text()='Edit']");
+    $this->click("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[1]/a[2][text()='Edit']");
     $this->waitForElementPresent("_qf_Note_upload-top");
     $this->type('subject', $noteSubject . "_edited");
     $this->type('note', $noteText . "_edited");
     $this->clickLink("_qf_Note_upload-top", "xpath=//div[@class='crm-results-block']/div[@id='notes']/div/table/tbody/tr//td/span[2]/ul/li[2]/a[text()='Delete']", FALSE);
 
-    $this->click("xpath=//div[@class='crm-results-block']/div[@id='notes']/div/table/tbody/tr//td/span[2]/ul/li[2]/a[text()='Delete']");
+    $this->click("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[2]/ul/li[2]/a[text()='Delete']");
     // Check confirmation alert.
     $this->waitForText("xpath=//form[@id='Note']/div[@class='view-content']/div[@class='status']", "Are you sure you want to delete the note ''?");
     $this->click("xpath=//input[@id='_qf_Note_next']");
@@ -123,8 +122,9 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
     $this->select("relationship_type_id", "label=Employee of");
     $this->select2('related_contact_id', 'Default', TRUE);
     $this->click('_qf_Relationship_upload-bottom');
-    $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
-    $this->click("xpath=//div[@class='crm-contact-relationship-current']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
+    $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
+
+    $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']");
     $this->waitForText("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']", 'Are you sure you want to disable this relationship?');
     $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[text()='Yes']");
     $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-past']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[2]/a[text()='Delete']");
@@ -150,25 +150,26 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]");
     $this->click("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]");
     $this->waitForElementPresent("_qf_Activity_cancel-bottom");
-    $this->select("status_id","value=2");
+    $this->select("status_id", "value=2");
     $this->click('_qf_Activity_upload-bottom');
     $this->waitForText("crm-notification-container", "Activity has been saved.");
     $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[7][text()='Completed']");
 
     //add a case
+    $this->waitForAjaxContent();
     $this->click("xpath=//li[@id='tab_case']/a");
     $this->waitForElementPresent("xpath=//div[@class='view-content']//div[@class='action-link']/a");
     $this->click("xpath=//div[@class='view-content']//div[@class='action-link']/a");
     $this->waitForElementPresent("_qf_Case_cancel-bottom");
-    $this->type('activity_subject',"subject".rand());
-    $this->select('case_type_id','value=1');
+    $this->type('activity_subject', "subject".rand());
+    $this->select('case_type_id', 'value=1');
     $this->click('_qf_Case_upload-bottom');
-    $this->waitForElementPresent("xpath=//div[@class='view-content']/table[@class='caseSelector']/tbody/tr[2]/td[9]//span//a[text()='Manage']");
-    $this->click("xpath=//div[@class='view-content']/table[@class='caseSelector']/tbody/tr[2]/td[9]//span//a[text()='Manage']");
+    $this->waitForElementPresent("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']");
+    $this->click("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']");
     $this->waitForElementPresent("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a");
     $this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a");
     $this->waitForElementPresent("_qf_Activity_cancel-bottom");
-    $this->select("case_status_id","value=2");
+    $this->select("case_status_id", "value=2");
     $this->click("_qf_Activity_upload-top");
     $this->waitForElementPresent("_qf_CaseView_cancel-bottom");
     $this->click("_qf_CaseView_cancel-bottom");
@@ -273,7 +274,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
   /**
    * @param $data
    */
-  function verifyReportData($data) {
+  public function verifyReportData($data) {
     foreach ($data as $value) {
       // check for the row contains proper data
       $actionPath = ($value['action'] == 'Update') ? "td[1]/a[2]" : "td[1][contains(text(), '{$value['action']}')]";
@@ -282,7 +283,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
       $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../{$contactCheck}/../{$actionPath}"), "The proper record not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']}, action as {$value['action']})");
 
       if ($value['action'] == 'Update') {
-        $this->assertTrue( ($value['action'] == $this->getText("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../{$actionPath}")), "The proper record action  {$value['action']} not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']} record)");
+        $this->assertTrue(($value['action'] == $this->getText("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../{$actionPath}")), "The proper record action  {$value['action']} not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']} record)");
       }
     }
   }
@@ -291,7 +292,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
    * @param $dataForReportDetail
    * @param array $filters
    */
-  function detailReportCheck($dataForReportDetail, $filters = array()) {
+  public function detailReportCheck($dataForReportDetail, $filters = array()) {
     foreach ($dataForReportDetail as $value) {
       $this->waitForElementPresent("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../td[1]/a[2]");
       $this->click("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../td[1]/a[2]");
@@ -309,17 +310,17 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
         }
       }
 
-    //visit the logging contact summary report
-    $this->openCiviPage('report/logging/contact/summary', 'reset=1');
-    foreach ($filters as $type => $filter) {
-      if ($type == 'text' ) {
-        foreach ($filter as $filterName => $filterValue) {
-          $this->type($filterName, $filterValue);
+      //visit the logging contact summary report
+      $this->openCiviPage('report/logging/contact/summary', 'reset=1');
+      foreach ($filters as $type => $filter) {
+        if ($type == 'text') {
+          foreach ($filter as $filterName => $filterValue) {
+            $this->type($filterName, $filterValue);
+          }
         }
       }
-    }
-    $this->click("_qf_LoggingSummary_submit");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+      $this->click("_qf_LoggingSummary_submit");
+      $this->waitForPageToLoad($this->getTimeoutMsec());
     }
   }
 }