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