Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
fa938177 | 6 | | Copyright CiviCRM LLC (c) 2004-2016 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License along with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
d25dd0ee | 25 | */ |
6a488035 | 26 | |
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Contribute_ContributionPageAddTest | |
31 | */ | |
6a488035 | 32 | class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { |
00be9182 | 33 | public function testContributionPageAdd() { |
6a488035 | 34 | // open browser, login |
6a488035 TO |
35 | $this->webtestLogin(); |
36 | ||
37 | // a random 7-char string and an even number to make this pass unique | |
42daf119 CW |
38 | $hash = substr(sha1(rand()), 0, 7); |
39 | $rand = 2 * rand(2, 50); | |
6a488035 TO |
40 | $pageTitle = 'Donate Online ' . $hash; |
41 | // create contribution page with randomized title and default params | |
c3ad8633 | 42 | $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array('Test Processor' => 'Dummy'), TRUE, TRUE, 'required'); |
6a488035 | 43 | |
071a6d2e | 44 | $this->openCiviPage("admin/contribute", "reset=1"); |
6a488035 TO |
45 | |
46 | // search for the new contrib page and go to its test version | |
47 | $this->type('title', $pageTitle); | |
48 | $this->click('_qf_SearchContribution_refresh'); | |
49 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
50 | ||
51 | // select testdrive mode | |
52 | $this->isTextPresent($pageTitle); | |
b45c587e | 53 | $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId", '_qf_Main_upload-bottom'); |
071a6d2e | 54 | |
6a488035 TO |
55 | // verify whatever’s possible to verify |
56 | // FIXME: ideally should be expanded | |
57 | $texts = array( | |
58 | "Title - New Membership $hash", | |
59 | "This is introductory message for $pageTitle", | |
b21dd815 RK |
60 | 'Student - $ 50.00', |
61 | "Label $hash - $ $rand.00", | |
6a488035 | 62 | "Pay later label $hash", |
05f3c31c DG |
63 | 'Organization Details', |
64 | 'Other Amount', | |
65 | 'I pledge to contribute this amount every', | |
05f3c31c DG |
66 | 'Name and Address', |
67 | 'Summary Overlay', | |
68 | ); | |
69 | foreach ($texts as $text) { | |
70 | $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); | |
b21dd815 | 71 | $this->waitForAjaxContent(); |
05f3c31c | 72 | } |
11b9c22d JP |
73 | |
74 | // Disable and re-enable Other Amounts (verify fix for CRM-15021) | |
75 | $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=$pageId", '_qf_Amount_next-bottom'); | |
76 | $this->click("is_allow_other_amount"); | |
77 | $this->clickLink("_qf_Amount_upload_done-bottom"); | |
78 | $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId", '_qf_Main_upload-bottom'); | |
79 | $this->assertFalse($this->isTextPresent('Other Amount'), 'Other Amount present but not expected.'); | |
80 | $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=$pageId", '_qf_Amount_next-bottom'); | |
81 | $this->click("is_allow_other_amount"); | |
82 | $this->clickLink("_qf_Amount_upload_done-bottom"); | |
83 | $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId", '_qf_Main_upload-bottom'); | |
84 | $this->assertTrue($this->isTextPresent('Other Amount'), 'Other Amount not present but expected.'); | |
85 | $this->isElementPresent("xpath=//div[@class='content other_amount-content']/input"); | |
05f3c31c | 86 | } |
e9479dcf | 87 | |
546b78fa CW |
88 | /** |
89 | * CRM-12510 Test copy contribution page | |
90 | */ | |
00be9182 | 91 | public function testContributionPageCopy() { |
05f3c31c DG |
92 | // open browser, login |
93 | $this->webtestLogin(); | |
94 | ||
95 | // a random 7-char string and an even number to make this pass unique | |
96 | $hash = substr(sha1(rand()), 0, 7); | |
97 | $rand = 2 * rand(2, 50); | |
98 | $pageTitle = 'Donate Online ' . $hash; | |
99 | // create contribution page with randomized title and default params | |
c3ad8633 | 100 | $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array('Test Processor' => 'Dummy'), TRUE, TRUE, 'required'); |
05f3c31c DG |
101 | |
102 | $this->openCiviPage("admin/contribute", "reset=1"); | |
103 | ||
104 | // search for the new contrib page and go to its test version | |
105 | $this->type('title', $pageTitle); | |
106 | $this->click('_qf_SearchContribution_refresh'); | |
107 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
108 | ||
109 | $this->isTextPresent($pageTitle); | |
110 | ||
111 | // Call URL to make a copy of the page | |
112 | $this->openCiviPage("admin/contribute", "action=copy&gid=$pageId"); | |
e9479dcf | 113 | |
05f3c31c DG |
114 | // search for the new copy page and go to its test version |
115 | $this->type('title', 'Copy of ' . $pageTitle); | |
116 | $this->click('_qf_SearchContribution_refresh'); | |
117 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
e9479dcf | 118 | |
05f3c31c DG |
119 | $this->isTextPresent('Copy of ' . $pageTitle); |
120 | // get page id of the copy | |
121 | // $copyPageId = $this->getText("xpath=//div[@id='configure_contribution_page']/tr[@id='row_4']/td[2]"); | |
122 | $copyPageId = $this->getText("xpath=//div[@id='option11_wrapper']/table[@id='option11']/tbody/tr[1]/td[2]"); | |
123 | // select testdrive mode | |
124 | $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$copyPageId", '_qf_Main_upload-bottom'); | |
125 | ||
126 | // verify whatever’s possible to verify | |
127 | // FIXME: ideally should be expanded | |
128 | $texts = array( | |
129 | "Title - New Membership $hash", | |
130 | "This is introductory message for $pageTitle", | |
b21dd815 RK |
131 | 'Student - $ 50.00', |
132 | "Label $hash - $ $rand.00", | |
05f3c31c | 133 | "Pay later label $hash", |
6a488035 TO |
134 | 'Organization Details', |
135 | 'Other Amount', | |
136 | 'I pledge to contribute this amount every', | |
6a488035 TO |
137 | 'Name and Address', |
138 | 'Summary Overlay', | |
139 | ); | |
140 | foreach ($texts as $text) { | |
141 | $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); | |
b21dd815 | 142 | $this->waitForAjaxContent(); |
6a488035 TO |
143 | } |
144 | } | |
145 | ||
b45c587e | 146 | /** |
100fef9d | 147 | * Check CRM-7943 |
b45c587e | 148 | */ |
00be9182 | 149 | public function testContributionPageSeparatePayment() { |
6a488035 | 150 | // open browser, login |
6a488035 TO |
151 | $this->webtestLogin(); |
152 | ||
153 | // a random 7-char string and an even number to make this pass unique | |
42daf119 CW |
154 | $hash = substr(sha1(rand()), 0, 7); |
155 | $rand = 2 * rand(2, 50); | |
6a488035 TO |
156 | $pageTitle = 'Donate Online ' . $hash; |
157 | ||
158 | // create contribution page with randomized title, default params and separate payment for Membership and Contribution | |
c3ad8633 | 159 | $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array('Test Processor' => 'Dummy'), |
6a488035 TO |
160 | TRUE, TRUE, 'required', TRUE, FALSE, TRUE, NULL, TRUE, |
161 | 1, 7, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE | |
162 | ); | |
163 | ||
071a6d2e | 164 | $this->openCiviPage("admin/contribute", "reset=1"); |
6a488035 TO |
165 | |
166 | // search for the new contrib page and go to its test version | |
167 | $this->type('title', $pageTitle); | |
168 | $this->click('_qf_SearchContribution_refresh'); | |
169 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
170 | ||
171 | // select testdrive mode | |
172 | $this->isTextPresent($pageTitle); | |
b45c587e | 173 | $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId", '_qf_Main_upload-bottom'); |
6a488035 | 174 | |
6a488035 TO |
175 | $texts = array( |
176 | "Title - New Membership $hash", | |
177 | "This is introductory message for $pageTitle", | |
b21dd815 | 178 | "Label $hash - $ $rand.00", |
6a488035 TO |
179 | "Pay later label $hash", |
180 | 'Organization Details', | |
181 | 'Other Amount', | |
182 | 'I pledge to contribute this amount every', | |
6a488035 TO |
183 | 'Name and Address', |
184 | 'Summary Overlay', | |
185 | ); | |
186 | foreach ($texts as $text) { | |
187 | $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); | |
b21dd815 | 188 | $this->waitForAjaxContent(); |
6a488035 TO |
189 | } |
190 | } | |
191 | ||
b45c587e | 192 | /** |
100fef9d | 193 | * Check CRM-7949 |
b45c587e | 194 | */ |
00be9182 | 195 | public function testContributionPageSeparatePaymentPayLater() { |
6a488035 | 196 | // open browser, login |
6a488035 TO |
197 | $this->webtestLogin(); |
198 | ||
199 | // a random 7-char string and an even number to make this pass unique | |
42daf119 CW |
200 | $hash = substr(sha1(rand()), 0, 7); |
201 | $rand = 2 * rand(2, 50); | |
6a488035 TO |
202 | $pageTitle = 'Donate Online ' . $hash; |
203 | ||
204 | // create contribution page with randomized title, default params and separate payment for Membership and Contribution | |
205 | $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, NULL, | |
206 | TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, NULL, FALSE, | |
207 | 1, 0, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE | |
208 | ); | |
209 | ||
071a6d2e | 210 | $this->openCiviPage("admin/contribute", "reset=1"); |
6a488035 TO |
211 | |
212 | // search for the new contrib page and go to its test version | |
213 | $this->type('title', $pageTitle); | |
214 | $this->click('_qf_SearchContribution_refresh'); | |
215 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
216 | ||
6a488035 | 217 | //logout |
42daf119 | 218 | $this->webtestLogout(); |
6a488035 TO |
219 | |
220 | //Open Live Contribution Page | |
b45c587e | 221 | $this->openCiviPage('contribute/transact', "reset=1&id=$pageId", '_qf_Main_upload-bottom'); |
6a488035 TO |
222 | |
223 | $firstName = 'Ya' . substr(sha1(rand()), 0, 4); | |
224 | $lastName = 'Cha' . substr(sha1(rand()), 0, 7); | |
225 | ||
226 | $this->type('email-5', $firstName . '@example.com'); | |
227 | $this->type('first_name', $firstName); | |
228 | $this->type('last_name', $lastName); | |
b45c587e | 229 | |
6c6e6187 | 230 | $this->select('state_province-1', "value=1002"); |
225a8648 | 231 | $this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom'); |
6a488035 TO |
232 | |
233 | $this->click('_qf_Confirm_next-bottom'); | |
234 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
235 | ||
236 | //login to check contribution | |
6a488035 TO |
237 | $this->webtestLogin(); |
238 | ||
239 | //Find Contribution | |
42daf119 | 240 | $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low'); |
6a488035 | 241 | |
6080c83e | 242 | $this->type('sort_name', "$lastName $firstName"); |
6c6e6187 | 243 | $this->select('financial_type_id', "label=Member Dues"); |
deeea38d WA |
244 | $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", FALSE); |
245 | $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE); | |
6a488035 | 246 | $expected = array( |
42daf119 CW |
247 | 'From' => "{$firstName} {$lastName}", |
248 | 'Financial Type' => 'Member Dues', | |
b68dea89 DG |
249 | 'Total Amount' => '$ 50.00', |
250 | 'Contribution Status' => 'Pending : Pay Later', | |
6a488035 | 251 | ); |
b68dea89 DG |
252 | $this->webtestVerifyTabularData($expected); |
253 | $this->click('_qf_ContributionView_cancel-bottom'); | |
254 | ||
255 | //View Contribution for separate contribution | |
deeea38d | 256 | $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']"); |
b68dea89 | 257 | // Open search criteria again |
1a599e05 | 258 | $this->click("xpath=id('Search')/div[2]/div/div[1]"); |
b68dea89 | 259 | $this->waitForElementPresent("financial_type_id"); |
1a599e05 | 260 | $this->type("sort_name", $firstName); |
6c6e6187 | 261 | $this->select('financial_type_id', "label=Donation"); |
24f591b0 | 262 | $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr/td[4][text()='Donation']/../td[10]/span//a[text()='View']", FALSE); |
263 | $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr/td[4][text()='Donation']/../td[10]/span//a[text()='View']"); | |
264 | $this->waitForElementPresent("xpath=//table/tbody/tr/td[text()='From']/following-sibling::td"); | |
f8c5cf0c | 265 | $this->waitForAjaxContent(); |
b68dea89 | 266 | $expected = array( |
42daf119 CW |
267 | 'From' => "{$firstName} {$lastName}", |
268 | 'Financial Type' => 'Donation', | |
b68dea89 DG |
269 | 'Contribution Status' => 'Pending : Pay Later', |
270 | ); | |
271 | $this->webtestVerifyTabularData($expected); | |
6a488035 TO |
272 | $this->click('_qf_ContributionView_cancel-bottom'); |
273 | ||
6a488035 | 274 | //Find Member |
42daf119 | 275 | $this->openCiviPage("member/search", "reset=1", 'member_source'); |
6080c83e | 276 | $this->type('sort_name', "$lastName $firstName"); |
f8c5cf0c | 277 | $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span//a[text()='View']", FALSE); |
0ef7acd2 WA |
278 | $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span//a[text()='View']"); |
279 | $this->waitForAjaxContent(); | |
6a488035 TO |
280 | |
281 | //View Membership Record | |
282 | $expected = array( | |
b68dea89 DG |
283 | 'Member' => "{$firstName} {$lastName}", |
284 | 'Membership Type' => 'Student', | |
285 | 'Status' => 'Pending', | |
6a488035 | 286 | ); |
b68dea89 | 287 | $this->webtestVerifyTabularData($expected); |
6a488035 TO |
288 | $this->click('_qf_MembershipView_cancel-bottom'); |
289 | } | |
2560550d AW |
290 | |
291 | /** | |
e9479dcf | 292 | * CRM-12994 |
2560550d | 293 | */ |
00be9182 | 294 | public function testContributionPageAddPremiumRequiredField() { |
2560550d AW |
295 | // open browser, login |
296 | $this->webtestLogin(); | |
297 | ||
298 | // a random 7-char string and an even number to make this pass unique | |
299 | $hash = substr(sha1(rand()), 0, 7); | |
300 | $rand = 2 * rand(2, 50); | |
301 | $pageTitle = 'Donate Online ' . $hash; | |
c3ad8633 | 302 | $processor = array('Test Processor' => 'Dummy'); |
2560550d AW |
303 | |
304 | // Create a new payment processor | |
305 | while (list($processorName, $processorType) = each($processor)) { | |
306 | $this->webtestAddPaymentProcessor($processorName, $processorType); | |
307 | } | |
e9479dcf | 308 | |
2560550d AW |
309 | // go to the New Contribution Page page |
310 | $this->openCiviPage('admin/contribute', 'action=add&reset=1'); | |
311 | ||
312 | // fill in Title and Settings | |
313 | $this->type('title', $pageTitle); | |
314 | ||
315 | // to select financial type | |
316 | $this->select('financial_type_id', "label=Donation"); | |
317 | ||
318 | $this->click('is_organization'); | |
d340a0e8 | 319 | $this->select("xpath=//*[@class='crm-contribution-onbehalf_profile_id']//span[@class='crm-profile-selector-select']//select", 'label=On Behalf Of Organization'); |
2560550d AW |
320 | $this->type('for_organization', "On behalf $hash"); |
321 | // make onBehalf optional | |
322 | $this->click('CIVICRM_QFID_1_2'); | |
e9479dcf | 323 | |
2560550d AW |
324 | $this->fillRichTextField('intro_text', 'This is introductory message for ' . $pageTitle, 'CKEditor'); |
325 | $this->fillRichTextField('footer_text', 'This is footer message for ' . $pageTitle, 'CKEditor'); | |
326 | ||
327 | $this->type('goal_amount', 10 * $rand); | |
328 | ||
329 | // Submit form | |
330 | $this->clickLink('_qf_Settings_next', "_qf_Amount_next-bottom"); | |
331 | ||
332 | // Get contribution page id | |
333 | $pageId = $this->urlArg('id'); | |
334 | ||
335 | // fill in Processor, Amounts | |
336 | if (!empty($processor)) { | |
337 | reset($processor); | |
338 | while (list($processorName) = each($processor)) { | |
339 | // select newly created processor | |
340 | $xpath = "xpath=//label[text() = '{$processorName}']/preceding-sibling::input[1]"; | |
341 | $this->assertTrue($this->isTextPresent($processorName)); | |
342 | $this->check($xpath); | |
343 | } | |
344 | } | |
345 | ||
346 | // fill in labels & values in Fixed Contribution Options | |
347 | $this->type('label_1', 'Fixed Amount 1'); | |
348 | $this->type('value_1', 1); | |
349 | $this->type('label_2', 'Fixed Amount 2'); | |
350 | $this->type('value_2', 2); | |
351 | $this->type('label_3', 'Fixed Amount 3'); | |
352 | $this->type('value_3', 3); | |
77f1e6b1 | 353 | $this->click('CIVICRM_QFID_1_4'); |
2560550d AW |
354 | $this->click('_qf_Amount_submit_savenext-bottom'); |
355 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
e9479dcf | 356 | |
2560550d AW |
357 | // click through to the membership view screen |
358 | $this->click("css=li#tab_thankyou a"); | |
359 | $this->waitForElementPresent('_qf_ThankYou_next-bottom'); | |
360 | ||
361 | // fill in Receipt details | |
362 | $this->type('thankyou_title', "Thank-you Page Title $hash"); | |
df90c6dd SB |
363 | $this->fillRichTextField('thankyou_text', 'This is thankyou message for ' . $pageTitle, 'CKEditor', TRUE); |
364 | $this->fillRichTextField('thankyou_footer', 'This is thankyou footer message for ' . $pageTitle, 'CKEditor', TRUE); | |
2560550d AW |
365 | $this->click('is_email_receipt'); |
366 | $this->waitForElementPresent('bcc_receipt'); | |
367 | $this->type('receipt_from_name', "Receipt From Name $hash"); | |
368 | $this->type('receipt_from_email', "$hash@example.org"); | |
369 | $this->type('receipt_text', "Receipt Message $hash"); | |
370 | $this->type('cc_receipt', "$hash@example.net"); | |
371 | $this->type('bcc_receipt', "$hash@example.com"); | |
372 | ||
373 | $this->click('_qf_ThankYou_next'); | |
374 | $this->waitForElementPresent('_qf_ThankYou_next-bottom'); | |
375 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
376 | $receiptText = "'ThankYou' information has been saved."; | |
377 | $this->assertTrue($this->isTextPresent($receiptText), 'Missing text: ' . $receiptText); | |
378 | ||
379 | $this->click('link=Premiums'); | |
380 | $this->waitForElementPresent('_qf_Premium_submit_savenext-bottom'); | |
381 | $assertPremiumsCheck = FALSE; | |
382 | if (!$this->isChecked('premiums_active')) { | |
383 | $assertPremiumsCheck = TRUE; | |
384 | } | |
385 | $this->assertTrue($assertPremiumsCheck, 'Premiums Section is not unchecked by default.'); | |
386 | $this->click('_qf_Premium_submit_savenext-bottom'); | |
387 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
388 | $premiumText = "'Premium' information has been saved."; | |
e9479dcf | 389 | // check if clicking Save & Next button |
2560550d AW |
390 | // Premium is saved rather than required validation error |
391 | // for No Thank-you Label textfield | |
392 | $this->assertTrue($this->isTextPresent($premiumText)); | |
393 | ||
394 | $this->openCiviPage("admin/contribute", "reset=1"); | |
395 | ||
396 | // search for the new contrib page and go to its test version | |
397 | $this->type('title', $pageTitle); | |
398 | $this->click('_qf_SearchContribution_refresh'); | |
399 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
e07ec072 | 400 | $this->isElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[1]/strong[text()='$pageTitle']"); |
401 | $this->waitForElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']"); | |
77f1e6b1 | 402 | $this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']"); |
403 | $this->waitForElementPresent("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']"); | |
404 | $this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']"); | |
2560550d AW |
405 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
406 | $this->waitForElementPresent('premiums_active'); | |
407 | $this->waitForElementPresent('_qf_Premium_cancel-bottom'); | |
408 | ||
409 | // click on Premiums Section Enabled? checkbox | |
410 | $this->click('premiums_active'); | |
411 | $this->waitForElementPresent("xpath=//div[@id='premiumSettings']"); | |
412 | $this->waitForElementPresent('premiums_nothankyou_position'); | |
413 | $this->type('premiums_intro_title', 'Premiums Intro Title'); | |
414 | $this->type('premiums_intro_text', 'Premiums Into Text'); | |
415 | $this->type('premiums_contact_email', "$hash@example.net"); | |
e9479dcf | 416 | |
2560550d AW |
417 | // let No Thank-you Label text be blank |
418 | // so that validation error appears | |
e9479dcf | 419 | // $this->type('premiums_nothankyou_label', ); |
2560550d AW |
420 | $this->select('premiums_nothankyou_position', 'value=2'); |
421 | ||
422 | // click on save & next button | |
423 | $this->click('_qf_Premium_submit_savenext-bottom'); | |
424 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
425 | $premiumRequiredText = "No Thank-you Label is a required field."; | |
426 | // check if clicking Save & Next button | |
427 | // required validation error appears | |
428 | // for No Thank-you Label textfield | |
77f1e6b1 | 429 | $this->waitForElementPresent("xpath=//*[@id='premiumSettings']/div/div[2]/table/tbody/tr[6]/td[2]/span[1]"); |
2560550d | 430 | $this->assertTrue($this->isTextPresent($premiumRequiredText)); |
e9479dcf | 431 | |
2560550d | 432 | // fill in value for Premiums No Thank-you Label textfield |
e9479dcf | 433 | $this->type('premiums_nothankyou_label', 'Premiums No Thank-you Label'); |
2560550d | 434 | $this->waitForElementPresent('_qf_Premium_upload_done-bottom'); |
e9479dcf | 435 | |
2560550d AW |
436 | // click save & done button |
437 | $this->click('_qf_Premium_upload_done-bottom'); | |
438 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
439 | $premiumSavedText = "'Premium' information has been saved."; | |
440 | // check if clicking Save & Done button | |
441 | // contribution page is saved. | |
e9479dcf | 442 | $this->assertTrue($this->isTextPresent($premiumSavedText)); |
2560550d | 443 | } |
96025800 | 444 | |
6a488035 | 445 | } |