Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.3 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 TO |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected $captureScreenshotOnFailure = TRUE; | |
31 | protected $screenshotPath = '/var/www/api.dev.civicrm.org/public/sc'; | |
32 | protected $screenshotUrl = 'http://api.dev.civicrm.org/sc/'; | |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
38 | function testCreateCampaign() { | |
39 | ||
6a488035 TO |
40 | $this->webtestLogin(); |
41 | ||
42 | // Create new group | |
43 | $title = substr(sha1(rand()), 0, 7); | |
44 | $groupName = $this->WebtestAddGroup(); | |
45 | ||
46 | // Enable CiviCampaign module if necessary | |
8f737a72 | 47 | $this->enableComponents(array('CiviCampaign')); |
6a488035 TO |
48 | |
49 | //Creating a new Campaign | |
8f737a72 | 50 | $this->openCivipage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom'); |
6a488035 | 51 | |
6a488035 TO |
52 | $campaignTitle = "Campaign $title"; |
53 | $this->type("title", $campaignTitle); | |
54 | ||
55 | // select the campaign type | |
56 | $this->select("campaign_type_id", "value=2"); | |
57 | ||
58 | // fill in the description | |
59 | $campaignDescription = "This is a test campaign line 1 \n This is a test campaign line 2 \n This is a test campaign line 3"; | |
60 | $this->type("description", $campaignDescription); | |
61 | ||
62 | // include groups for the campaign | |
63 | $this->addSelection("includeGroups-f", "label=$groupName"); | |
64 | $this->click("//option[@value=4]"); | |
65 | $this->click("add"); | |
66 | ||
67 | // fill the end date for campaign | |
68 | $this->webtestFillDate("end_date", "+1 year"); | |
69 | ||
70 | // select campaign status | |
71 | $this->select("status_id", "value=2"); | |
72 | ||
73 | // click save | |
74 | $this->click("_qf_Campaign_upload-bottom"); | |
75 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76 | ||
6c5f7368 | 77 | $this->waitForText('crm-notification-container', "Campaign $title"); |
6a488035 TO |
78 | |
79 | //Opening Edit Page of the created Campaign | |
80 | $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']"); | |
225a8648 | 81 | $this->clickLink("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']", "//textarea[@id='description']"); |
6a488035 TO |
82 | $fetchedVaue = $this->getValue('description'); |
83 | $this->assertEquals($campaignDescription, $fetchedVaue); | |
84 | } | |
6a488035 | 85 | |
c4e6d4e8 PJ |
86 | function testAjaxCustomGroupLoad() { |
87 | $this->webtestLogin(); | |
88 | $triggerElement = array('name' => 'campaign_type_id', 'type' => 'select'); | |
89 | $customSets = array( | |
90 | array('entity' => 'Campaign', 'subEntity' => 'Referral Program', 'triggerElement' => $triggerElement), | |
91 | array('entity' => 'Campaign', 'subEntity' => 'Constituent Engagement', 'triggerElement' => $triggerElement) | |
92 | ); | |
93 | ||
94 | $pageUrl = array('url' => 'campaign/add', 'args' => 'reset=1'); | |
95 | $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl); | |
96 | } | |
97 | } |