*/
require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Contact_TaskActionAddToGroupTest
+ */
class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase {
protected function setUp() {
$this->WebtestAddGroup($newGroupName);
// Create two new contacts with a common random string in email address
- $emailString = substr(sha1(rand()), 0, 7) . '@example.com_';
+ $emailString = substr(sha1(rand()), 0, 7) . '@example.com';
$cids = array();
for ($i = 0; $i < 2; $i++) {
// create new contact
// Click "check all" box and act on "Add to group" action
$this->click('toggleSelect');
+ $this->waitForText("xpath=//input[@value='ts_sel']/following-sibling::label/span", '2');
$this->select("task", "label=Add Contacts to Group");
- // Because it tends to cause problems, all uses of sleep() must be justified in comments
- // Sleep should never be used for wait for anything to load from the server
- // Justification for this instance: FIXME
- sleep(1);
- $this->click("Go");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Select the new group and click to add
// Search by group membership in newly created group
$this->openCiviPage('contact/search/advanced', 'reset=1');
- $this->select("crmasmSelect1", "label=" . $newGroupName);
+ $this->select("group", "label=" . $newGroupName);
$this->click("_qf_Advanced_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->WebtestAddGroup($newGroupName);
$this->openCiviPage('contact/search', 'reset=1');
- $this->click("_qf_Basic_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Basic_refresh");
- $this->type("xpath=//*[@id='Basic-rows-per-page-select']", '25');
- $this->waitForElementPresent("xpath=//*[@id='Basic-rows-per-page-select']");
+ $this->type("xpath=//*[@id='CRM_Contact_Form_Search_Basic-rows-per-page-select']", '25');
+ $this->waitForElementPresent("toggleSelect");
$this->click("toggleSelect");
$this->click("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a");
- $this->waitForElementPresent("Go");
+ $this->waitForText("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a", "First");
$this->click("toggleSelect");
+ $this->waitForText("xpath=//input[@value='ts_sel']/following-sibling::label/span", '50');
$this->select("task", "label=Add Contacts to Group");
- $this->click("Go");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Select the new group and click to add
$this->waitForText('crm-notification-container', "50 contacts added to group");
$this->openCiviPage('contact/search/advanced', 'reset=1');
- $this->select("crmasmSelect1", "label=" . $newGroupName);
+ $this->select("group", "label=" . $newGroupName);
$this->click("_qf_Advanced_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());