}
function testContactMemberAdd() {
-
- $this->open($this->sboxPath);
$this->webtestLogin();
// Create a membership type to use for this test (defaults for this helper function are rolling 1 year membership)
$memTypeParams = $this->webtestAddMembershipType();
$lifeTimeMemTypeParams = $this->webtestAddMembershipType('rolling', 1, 'lifetime');
- // Go directly to the URL of the screen that you will be testing (New Individual).
- $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
+ $this->openCiviPage("contact/add", "reset=1&ct=Individual");
$firstName = "John_" . substr(sha1(rand()), 0, 7);
$this->type("first_name", $firstName);
//fill in last name
- $lastName = "Smith_" . substr(sha1(rand()), 0, 7);;
+ $lastName = "Smith_" . substr(sha1(rand()), 0, 7);
$this->type("last_name", $lastName);
//fill in email
// Clicking save.
$this->click("_qf_Contact_upload_view");
$this->waitForPageToLoad($this->getTimeoutMsec());
-
- $this->assertTrue($this->isTextPresent("$firstName $lastName has been created."));
+ $this->assertElementContainsText('crm-notification-container', "$firstName $lastName has been created.");
// click through to the membership view screen
$this->click("css=li#tab_member a");
$this->select("membership_type_id[0]", "label={$memTypeParams['member_of_contact']}");
// Wait for membership type select to reload
$this->waitForTextPresent($memTypeParams['membership_type']);
+ // Because it tends to cause problems, all uses of sleep() must be justified in comments
+ // Sleep should never be used for wait for anything to load from the server
+ // Justification for this instance: FIXME
sleep(3);
$this->select("membership_type_id[1]", "label={$memTypeParams['membership_type']}");
$this->waitForTextPresent($sourceText);
// Is status message correct?
- $this->assertTrue($this->isTextPresent("membership for $firstName $lastName has been added."),
- "Status message didn't show up after saving!"
- );
+ $this->assertElementContainsText('crm-notification-container', "membership for $firstName $lastName 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']");
'Status' => 'New',
'Source' => $sourceText,
);
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
+ $this->webtestVerifyTabularData($verifyData);
+
$this->click("_qf_MembershipView_cancel-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
// page was loaded
'Status' => 'New',
'Source' => $sourceText,
);
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
-
- $this->click("_qf_MembershipView_cancel-bottom");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("xpath=//div[@id='memberships']/div/table/tbody//tr/td[1][text()='{$memTypeParams['membership_type']}']/../td[7]");
+ $this->webtestVerifyTabularData($verifyData);
+ $this->clickLink("_qf_MembershipView_cancel-bottom", "xpath=//div[@id='memberships']/div/table/tbody//tr/td[1][text()='{$memTypeParams['membership_type']}']/../td[7]");
$this->click("xpath=//div[@id='memberships']/div/table/tbody//tr/td[1][text()='{$memTypeParams['membership_type']}']/../td[9]/span/a[2][text()='Edit']");
-
$this->waitForElementPresent("_qf_Membership_cancel-bottom");
// fill in Membership Organization and Type
'Source' => $sourceText,
'End date' => '',
);
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
+ $this->webtestVerifyTabularData($verifyData);
}
function testMemberAddWithLifeTimeMembershipType() {
- $this->open($this->sboxPath);
$this->webtestLogin();
// Create a membership type to use for this test (defaults for this helper function are rolling 1 year membership)
$lifeTimeMemTypeParams = $this->webtestAddMembershipType('rolling', 1, 'lifetime');
- // Go directly to the URL of the screen that you will be testing (New Individual).
- $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
+ $this->openCiviPage("contact/add", "reset=1&ct=Individual");
$firstName = "John_" . substr(sha1(rand()), 0, 7);
// Clicking save.
$this->click("_qf_Contact_upload_view");
$this->waitForPageToLoad($this->getTimeoutMsec());
-
- $this->assertTrue($this->isTextPresent("$firstName $lastName has been created."));
+ $this->assertElementContainsText('crm-notification-container', "$firstName $lastName has been created.");
// click through to the membership view screen
$this->click("css=li#tab_member a");
// Wait for membership type select to reload
$this->waitForTextPresent($lifeTimeMemTypeParams['membership_type']);
+ // Because it tends to cause problems, all uses of sleep() must be justified in comments
+ // Sleep should never be used for wait for anything to load from the server
+ // Justification for this instance: FIXME
sleep(3);
$this->select("membership_type_id[1]", "label={$lifeTimeMemTypeParams['membership_type']}");
$this->waitForTextPresent($sourceText);
// Is status message correct?
- $this->assertTrue($this->isTextPresent("membership for $firstName $lastName has been added."),
- "Status message didn't show up after saving!"
- );
+ $this->assertElementContainsText('crm-notification-container', "membership for $firstName $lastName 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']");
'Source' => $sourceText,
'End date' => '',
);
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
+ $this->webtestVerifyTabularData($verifyData);
$this->click("_qf_MembershipView_cancel-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
}