From d1a39946d6b1bc0d3a70923344cc92f8db34eb9b Mon Sep 17 00:00:00 2001 From: Edsel Date: Fri, 4 Mar 2016 19:05:28 +0530 Subject: [PATCH] CRM-18152 Added webtest to support patch ---------------------------------------- * CRM-18152: On Behalf profile does not select org profile by default if contribution profiles are added prior to it https://issues.civicrm.org/jira/browse/CRM-18152 --- .../Contribute/OnBehalfOfOrganization.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index 2a7b1d56d0..1e8e46ec9a 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -1342,4 +1342,40 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->assertTrue($this->isElementPresent("xpath=//div[@id='crm-contact-thumbnail']/div/a/img")); } + public function testOnBehalfSetDefaults() { + $this->webtestLogin(); + $hash = substr(sha1(rand()), 0, 7); + $pageTitle = 'Donate Online ' . $hash; + $rand = 2 * rand(2, 50); + + // go to the New Contribution Page page + $this->openCiviPage('admin/contribute', 'action=add&reset=1'); + + // fill in step 1 (Title and Settings) + $this->type('title', $pageTitle); + + //to select financial type + $this->select('financial_type_id', "label=Donation"); + $this->clickLink('_qf_Settings_next'); + + $this->click('link=Profiles'); + $this->waitForElementPresent('_qf_Custom_next-bottom'); + $this->select('css=tr.crm-contribution-contributionpage-custom-form-block-custom_pre_id span.crm-profile-selector-select select', "value=1"); + $this->click('_qf_Custom_next-bottom'); + $this->waitForElementPresent('_qf_Custom_next-bottom'); + + $this->click('link=Title'); + $this->waitForElementPresent('_qf_Settings_next'); + $this->click('is_organization'); + $this->clickLink('_qf_Settings_next'); + $this->waitForElementPresent('_qf_Settings_next'); + $this->click('is_organization'); + $this->clickLink('_qf_Settings_next'); + $this->waitForElementPresent('_qf_Settings_next'); + $this->click('is_organization'); + $this->waitForElementPresent("xpath=//*[@id='select2-chosen-2']"); + $sel = $this->getText("xpath=//*[@id='select2-chosen-2']"); + $this->assertEquals($sel, 'On Behalf Of Organization'); + } + } -- 2.25.1