Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
232624b1 | 4 | | CiviCRM version 4.4 | |
6a488035 TO |
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. | | |
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 | ||
51 | $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1"); | |
52 | $this->type("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", "$contactFirstName1"); | |
53 | $this->typeKeys("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", "$contactFirstName1"); | |
54 | ||
55 | // ...waiting for drop down with results to show up... | |
56 | $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); | |
57 | $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); | |
58 | ||
59 | // ...need to use mouseDownAt on first result (which is a li element), click does not work | |
60 | $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); | |
61 | ||
62 | // ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)... | |
63 | $this->waitForElementPresent("css=tr.crm-activity-form-block-target_contact_id td ul li span.token-input-delete-token-facebook"); | |
64 | ||
65 | // Now we're doing the same for "Assigned To" field. | |
66 | // Typing contact's name into the field (using typeKeys(), not type()!)... | |
67 | $this->click("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id"); | |
68 | $this->type("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", "$contactFirstName2"); | |
69 | $this->typeKeys("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", "$contactFirstName2"); | |
70 | ||
71 | // ...waiting for drop down with results to show up... | |
72 | $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); | |
73 | $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); | |
74 | ||
75 | //..need to use mouseDownAt on first result (which is a li element), click does not work | |
76 | $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); | |
77 | ||
78 | // ...again, waiting for the box with contact name to show up... | |
79 | $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook"); | |
80 | } | |
81 | } | |
82 |