<?php
-/*
+/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
*/
-
require_once 'CiviTest/CiviSeleniumTestCase.php';
class WebTest_Member_EditMembershipTest extends CiviSeleniumTestCase {
protected function setUp() {
$membershipTypes = $this->webtestAddMembershipType();
// now add membership
- $this->open($this->sboxPath . "civicrm/member/add?reset=1&action=add&context=standalone");
-
- $this->waitForElementPresent("_qf_Membership_upload");
+ $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
// select contact
$this->webtestFillAutocomplete($contactName);
$this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']");
$this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
$expected = array(
- 2 => $membershipTypes['membership_type'],
- 3 => 'New',
- 4 => 'Membership StandaloneAddTest Webtest',
+ 'Membership Type' => $membershipTypes['membership_type'],
+ 'Status' => 'New',
+ 'Source' => 'Membership StandaloneAddTest Webtest',
);
- foreach ($expected as $label => $value) {
- $this->verifyText("xpath=id('MembershipView')/div[2]/div/table[1]/tbody/tr[$label]/td[2]", preg_quote($value));
- }
+ $this->webtestVerifyTabularData($expected);
// now edit and update type and status
$this->click("crm-membership-edit-button-top");
$this->waitForElementPresent("access");
// Use activity search to find the expected activities
- $this->open($this->sboxPath . "civicrm/activity/search?reset=1");
- $this->waitForElementPresent("_qf_Search_refresh");
+ $this->openCiviPage('activity/search', 'reset=1', "_qf_Search_refresh");
+
$this->type("sort_name", $contactName);
$this->click('activity_type_id[35]');
$this->click('activity_type_id[36]');
$this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[3]/td[3][text()='Type changed from {$membershipTypes['membership_type']} to General']"));
$this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[3]/td[5]/a[text()='{$contactName}']"));
}
-}
-
+}
\ No newline at end of file
+--------------------------------------------------------------------+
*/
-
require_once 'CiviTest/CiviSeleniumTestCase.php';
class WebTest_Member_InheritedMembershipTest extends CiviSeleniumTestCase {
protected function setUp() {
// Log in using webtestLogin() method
$this->webtestLogin();
- $this->open($this->sboxPath . 'civicrm/contact/add?reset=1&ct=Organization');
- $this->waitForElementPresent('_qf_Contact_cancel');
+ $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
$title = substr(sha1(rand()), 0, 7);
$this->type('organization_name', "Organization $title");
$this->type('email_1_email', "$title@org.com");
$this->click('_qf_Contact_upload_view');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Organization $title has been created."));
+ $this->assertElementContainsText('crm-notification-container', "Organization {$title} has been created.");
// Go directly to the URL
- $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');
$this->click('_qf_MembershipType_upload-bottom');
$this->waitForElementPresent('link=Add Membership Type');
- $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved."));
+ $this->assertElementContainsText('crm-notification-container', "The membership type 'Membership Type $title' has been saved.");
- $this->open($this->sboxPath . 'civicrm/contact/add?reset=1&ct=Organization');
- $this->waitForElementPresent('_qf_Contact_cancel');
+ $this->openCiviPage('contact/add', 'reset=1&ct=Organization', '_qf_Contact_cancel');
// creating another Orgnization
$title1 = substr(sha1(rand()), 0, 7);
$this->waitForTextPresent($sourceText);
// Is status message correct?
- $this->assertTrue($this->isTextPresent("Membership Type $title membership for Organization $title1 has been added."),
- "Status message didn't show up after saving!"
- );
+ $this->assertElementContainsText('crm-notification-container', "Membership Type $title membership for Organization $title1 has been added.",
+ "Status message didn't show up after saving!");
// click through to the membership view screen
$this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
'joinDate', 'startDate', 'endDate') as $date) {
$$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
}
-
+
$this->webtestVerifyTabularData(
array(
'Membership Type' => "Membership Type $title",
$this->click('_qf_Relationship_upload');
$this->waitForElementPresent('inactive-relationships');
//check the status message
- $this->assertTrue($this->isTextPresent('Relationship record has been updated.'));
+ $this->assertElementContainsText('crm-notification-container', 'Relationship record has been updated.');
// click through to the membership view screen
$this->click('css=li#tab_member a');
//verify inherited membership has been removed
- $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid=$id&selectedChild=member");
- $this->waitForElementPresent("xpath=//div[@class='crm-container-snippet']/div/div[3]");
+ $this->openCiviPage("contact/view", "reset=1&cid=$id&selectedChild=member", "xpath=//div[@class='crm-container-snippet']/div/div[3]");
$this->assertTrue($this->isTextPresent('No memberships have been recorded for this contact.'));
// visit relationship tab and re-enable the relationship
$this->click('css=li#tab_rel a');
$this->waitForElementPresent('css=div.action-link');
$this->click("//li[@id='tab_rel']/a");
-
+
$this->waitForElementPresent("xpath=//div[@id='inactive-relationships']//div//table/tbody//tr/td[7]/span/a[text()='Edit']");
$this->click("xpath=//div[@id='inactive-relationships']//div//table/tbody//tr/td[7]/span/a[text()='Edit']");
$this->waitForElementPresent('is_active');
$this->click('_qf_Relationship_upload');
$this->waitForElementPresent('current-relationships');
//check the status message
- $this->assertTrue($this->isTextPresent('Relationship record has been updated.'));
+ $this->assertElementContainsText('crm-notification-container', 'Relationship record has been updated.');
//check for memberships
$this->click('css=li#tab_member a');
sleep(10);
//verify inherited membership has been removed
- $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid=$id&selectedChild=member");
- $this->waitForElementPresent("xpath=//div[@class='crm-container-snippet']/div/div[3]");
+ $this->openCiviPage("contact/view", "reset=1&cid={$id}&selectedChild=member", "xpath=//div[@class='crm-container-snippet']/div/div[3]");
$this->assertTrue($this->isTextPresent('No memberships have been recorded for this contact.'));
//enable relationship