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. | | |
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_Generic_CheckActivityTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testCheckDashboardElements() { | |
6a488035 TO |
35 | // Log in using webtestLogin() method |
36 | $this->webtestLogin(); | |
37 | ||
38 | // Adding contact with randomized first name | |
39 | // We're using Quick Add block on the main page for this. | |
40 | $contactFirstName1 = substr(sha1(rand()), 0, 7); | |
41 | $this->webtestAddContact($contactFirstName1, "Devis", TRUE); | |
42 | ||
43 | // Adding another contact with randomized first name | |
44 | // We're using Quick Add block on the main page for this. | |
45 | $contactFirstName2 = substr(sha1(rand()), 0, 7); | |
46 | $this->webtestAddContact($contactFirstName2, "Anderson", TRUE); | |
cb5b38f1 | 47 | $this->openCiviPage("activity", "reset=1&action=add&context=standalone", "_qf_Activity_upload"); |
6a488035 | 48 | |
6a488035 TO |
49 | $this->select("activity_type_id", "label=Meeting"); |
50 | ||
cba9346d | 51 | $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); |
52 | $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); | |
53 | $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $contactFirstName1); | |
54 | $this->typeKeys("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $contactFirstName1); | |
6a488035 TO |
55 | |
56 | // ...waiting for drop down with results to show up... | |
cba9346d | 57 | $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); |
6a488035 TO |
58 | |
59 | // ...need to use mouseDownAt on first result (which is a li element), click does not work | |
cba9346d | 60 | $this->clickAt("xpath=//div[@class='select2-result-label']"); |
6a488035 TO |
61 | |
62 | // ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)... | |
cba9346d | 63 | $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$contactFirstName1"); |
6a488035 TO |
64 | |
65 | // Now we're doing the same for "Assigned To" field. | |
66 | // Typing contact's name into the field (using typeKeys(), not type()!)... | |
cba9346d | 67 | $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); |
68 | $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); | |
69 | $this->type("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $contactFirstName2); | |
70 | $this->typeKeys("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $contactFirstName2); | |
6a488035 TO |
71 | |
72 | // ...waiting for drop down with results to show up... | |
cba9346d | 73 | $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); |
6a488035 TO |
74 | |
75 | //..need to use mouseDownAt on first result (which is a li element), click does not work | |
cba9346d | 76 | $this->clickAt("xpath=//div[@class='select2-result-label']"); |
6a488035 TO |
77 | |
78 | // ...again, waiting for the box with contact name to show up... | |
cba9346d | 79 | $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$contactFirstName2"); |
6a488035 TO |
80 | } |
81 | } | |
82 |