webtestLogin(); // Adding contact with randomized first name // We're using Quick Add block on the main page for this. $contactFirstName1 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($contactFirstName1, "Devis", TRUE); // Adding another contact with randomized first name // We're using Quick Add block on the main page for this. $contactFirstName2 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($contactFirstName2, "Anderson", TRUE); $this->openCiviPage("activity", "reset=1&action=add&context=standalone", "_qf_Activity_upload"); $this->select("activity_type_id", "label=Meeting"); $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $contactFirstName1); $this->typeKeys("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $contactFirstName1); // ...waiting for drop down with results to show up... $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); // ...need to use mouseDownAt on first result (which is a li element), click does not work $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)... $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$contactFirstName1"); // Now we're doing the same for "Assigned To" field. // Typing contact's name into the field (using typeKeys(), not type()!)... $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); $this->type("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $contactFirstName2); $this->typeKeys("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $contactFirstName2); // ...waiting for drop down with results to show up... $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); //..need to use mouseDownAt on first result (which is a li element), click does not work $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$contactFirstName2"); } }