From: Dave Greenberg Date: Mon, 20 May 2013 20:22:18 +0000 (-0700) Subject: CRM-12510. There were no webtests for copying a contribution page or copying an event... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=05f3c31c374caec74b327a14ebb273a61051ab7c;p=civicrm-core.git CRM-12510. There were no webtests for copying a contribution page or copying an event. Adding them. ---------------------------------------- * CRM-12510: Copy Contribution Page does not copy associated quick-config price set http://issues.civicrm.org/jira/browse/CRM-12510 --- diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index 4cf0a2f63a..2cc2d3f35a 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -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 */ diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index 51c630a764..6cb63b65b8 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -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() {