Merge pull request #9072 from jeromelebleu/patch-19386
[civicrm-core.git] / tests / phpunit / WebTest / Contribute / ContactContextAddTest.php
index 9b187d2a6507ccb66bcb893069f6280043957b87..8f546482319937f34931dd4ca89d912cc0596efb 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -139,9 +139,8 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase {
     $this->clickLink("_qf_Contribution_upload-bottom", 'civicrm-footer', FALSE);
     // Is status message correct?
     $this->waitForText('crm-notification-container', "The contribution record has been saved");
-
-    $this->waitForElementPresent("xpath=//div[@class='view-content']/table[2]/tbody/tr/td[8]/span/a[text()='View']");
-    $viewUrl = $this->parseURL($this->getAttribute("xpath=//div[@class='view-content']/table[2]/tbody/tr/td[8]/span/a[text()='View']@href"));
+    $this->waitForElementPresent("xpath=//form[@class='CRM_Contribute_Form_Search crm-search-form']/div[2]/table[2]/tbody/tr/td[8]/span//a[text()='View']");
+    $viewUrl = $this->parseURL($this->getAttribute("xpath=//form[@class='CRM_Contribute_Form_Search crm-search-form']/div[2]/table[2]/tbody/tr/td[8]/span//a[text()='View']@href"));
     $id = $viewUrl['queryString']['id'];
     $this->assertType('numeric', $id);
 
@@ -160,9 +159,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase {
       'Check Number' => 'check #1041',
     );
     foreach ($verifyData as $label => $value) {
-      $this->verifyText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
-        preg_quote($value)
-      );
+      $this->assertElementContainsText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", $value);
     }
 
     // check values of contribution record in the DB
@@ -190,7 +187,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase {
       1 => "{$firstName} Anderson",
     );
     foreach ($expected as $value => $label) {
-      $this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody//tr/td[$value]", preg_quote($label));
+      $this->assertElementContainsText("xpath=id('Search')/div[2]/table[2]/tbody//tr/td[$value]", $label);
     }
   }