webtestLogin(); // create contact $firstName = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name"); $contactName = "Memberson, {$firstName}"; $displayName = "{$firstName} Memberson"; // add membership type $membershipTypes = $this->webtestAddMembershipType(); // now add membership $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload"); // select contact $this->webtestFillAutocomplete($contactName); // fill in Membership Organization $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}"); // select membership type $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}"); // fill in Source $this->type("source", "Membership StandaloneAddTest Webtest"); // Let Join Date and Start Date stay default $this->click("_qf_Membership_upload"); //View Membership $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']"); $this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); $expected = array( 'Membership Type' => $membershipTypes['membership_type'], 'Status' => 'New', 'Source' => 'Membership StandaloneAddTest Webtest', ); $this->webtestVerifyTabularData($expected); // now edit and update type and status $this->click("crm-membership-edit-button-top"); $this->waitForElementPresent("_qf_Membership_upload-bottom"); $this->click('is_override'); $this->waitForElementPresent('status_id'); $this->select('status_id', 'label=Current'); $this->select('membership_type_id[0]', 'label=Default Organization'); $this->select('membership_type_id[1]', 'label=General'); $this->click('_qf_Membership_upload-bottom'); $this->waitForElementPresent("access"); // Use activity search to find the expected activities $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->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[2][text()='Change Membership Status']")); $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[3][text()='Status changed from New to Current']")); $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[5]/a[text()='{$contactName}']")); $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[3]/td[2][text()='Change Membership Type']")); $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}']")); } }