Merge pull request #3041 from freeform/CRM-14470
[civicrm-core.git] / tests / phpunit / WebTest / Member / UpdateMembershipScriptTest.php
index f2af6f98d620c6a255949c59a77e24791c3e4d3a..dc96ea47220e113c94643fc2ac721411f5ad72dd 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.                                    |
  |                                                                    |
@@ -24,7 +24,6 @@
  +--------------------------------------------------------------------+
 */
 
-
 require_once 'CiviTest/CiviSeleniumTestCase.php';
 class WebTest_Member_UpdateMembershipScriptTest extends CiviSeleniumTestCase {
 
@@ -33,11 +32,6 @@ class WebTest_Member_UpdateMembershipScriptTest extends CiviSeleniumTestCase {
   }
 
   function testAddMembership() {
-    // This is the path where our testing install resides.
-    // The rest of URL is defined in CiviSeleniumTestCase base class, in
-    // class attributes.
-    $this->open($this->sboxPath);
-
     // Log in using webtestLogin() method
     $this->webtestLogin();
 
@@ -66,12 +60,9 @@ class WebTest_Member_UpdateMembershipScriptTest extends CiviSeleniumTestCase {
 
     // Clicking save.
     $this->click('_qf_Membership_upload');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is status message correct?
-    $this->assertTrue($this->isTextPresent("{$memTypeParams['membership_type']} membership for $firstName Anderson has been added."),
-      "Status message didn't show up after saving!"
-    );
+    $this->waitForText('crm-notification-container', "{$memTypeParams['membership_type']} membership for $firstName Anderson has been added.");
 
     // click through to the membership view screen
     $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]");
@@ -102,18 +93,14 @@ class WebTest_Member_UpdateMembershipScriptTest extends CiviSeleniumTestCase {
       'relationship_type' => '4_b_a',
     );
 
-    $this->open($this->sboxPath . "civicrm/admin/member/membershipType?reset=1&action=browse");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/member/membershipType', 'reset=1&action=browse');
 
     $this->click("link=Add Membership Type");
     $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
 
     // New membership type
     $this->type('name', $memTypeParams['membership_type']);
-    $this->type('member_of_contact', $membershipTitle);
-    $this->click('member_of_contact');
-    $this->waitForElementPresent("css=div.ac_results-inner li");
-    $this->click("css=div.ac_results-inner li");
+    $this->select2('member_of_contact_id', $membershipTitle);
 
     // Membership fees
     $this->type('minimum_fee', '100');
@@ -124,15 +111,14 @@ class WebTest_Member_UpdateMembershipScriptTest extends CiviSeleniumTestCase {
     $this->select('duration_unit', "label=year");
 
     // Membership period type
-    $this->select('period_type', "label=rolling");
+    $this->select('period_type', "value=rolling");
     $this->click('relationship_type_id', "value={$memTypeParams['relationship_type']}");
 
     // Clicking save
     $this->click('_qf_MembershipType_upload-bottom');
     $this->waitForElementPresent('link=Add Membership Type');
-    $this->assertTrue($this->isTextPresent("The membership type '$title' has been saved."));
+    $this->waitForText('crm-notification-container', "The membership type '$title' has been saved.");
 
     return $memTypeParams;
   }
 }
-