Skip to content
Snippets Groups Projects
Commit 8dc2a88b authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

Merge pull request #811 from davecivicrm/CRM-12510

CRM-12510. There were no webtests for copying a contribution page or cop...
parents aa0b93c1 05f3c31c
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,64 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
}
}
// CRM-12510 Test copy contribution page
function testContributionPageCopy() {
// open browser, login
$this->webtestLogin();
// a random 7-char string and an even number to make this pass unique
$hash = substr(sha1(rand()), 0, 7);
$rand = 2 * rand(2, 50);
$pageTitle = 'Donate Online ' . $hash;
// create contribution page with randomized title and default params
$pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array("Webtest Dummy" . substr(sha1(rand()), 0, 7) => 'Dummy'), TRUE, TRUE, 'required');
$this->openCiviPage("admin/contribute", "reset=1");
// search for the new contrib page and go to its test version
$this->type('title', $pageTitle);
$this->click('_qf_SearchContribution_refresh');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->isTextPresent($pageTitle);
// Call URL to make a copy of the page
$this->openCiviPage("admin/contribute", "action=copy&gid=$pageId");
// search for the new copy page and go to its test version
$this->type('title', 'Copy of ' . $pageTitle);
$this->click('_qf_SearchContribution_refresh');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->isTextPresent('Copy of ' . $pageTitle);
// get page id of the copy
// $copyPageId = $this->getText("xpath=//div[@id='configure_contribution_page']/tr[@id='row_4']/td[2]");
$copyPageId = $this->getText("xpath=//div[@id='option11_wrapper']/table[@id='option11']/tbody/tr[1]/td[2]");
// select testdrive mode
$this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$copyPageId", '_qf_Main_upload-bottom');
// verify whatever’s possible to verify
// FIXME: ideally should be expanded
$texts = array(
"Title - New Membership $hash",
"This is introductory message for $pageTitle",
'$ 50.00 Student',
"$ $rand.00 Label $hash",
"Pay later label $hash",
'Organization Details',
'Other Amount',
'I pledge to contribute this amount every',
"Honoree Section Title $hash",
"Honoree Introductory Message $hash",
'In Honor of',
'Name and Address',
'Summary Overlay',
);
foreach ($texts as $text) {
$this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text);
}
}
/**
* check CRM-7943
*/
......
......@@ -58,7 +58,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations);
$eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress);
$this->_testVerifyEventInfo($eventTitle, $eventInfoStrings);
$eventId = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings);
$registerStrings = array("225.00", "Member", "300.00", "Non-member", $registerIntro);
$registerUrl = $this->_testVerifyRegisterPage($registerStrings);
......@@ -66,6 +66,12 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$numberRegistrations = 3;
$anonymous = TRUE;
$this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous);
// Now test making a copy of the event
$this->webtestLogin();
$this->openCiviPage("event/manage", "reset=1&action=copy&id=$eventId");
$copyEventId = $this->_testVerifyEventInfo('Copy of ' . $eventTitle, $eventInfoStrings);
$registerUrl = $this->_testVerifyRegisterPage($registerStrings);
}
function testAddPaidEventDiscount() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment