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