webtestLogin(); // Create new group $title = substr(sha1(rand()), 0, 7); $groupName = $this->WebtestAddGroup(); // Enable CiviCampaign module if necessary $this->enableComponents(array('CiviCampaign')); //Creating a new Campaign $this->openCivipage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom'); $campaignTitle = "Campaign $title"; $this->type("title", $campaignTitle); // select the campaign type $this->select("campaign_type_id", "value=2"); // fill in the description $campaignDescription = "This is a test campaign line 1 \n This is a test campaign line 2 \n This is a test campaign line 3"; $this->type("description", $campaignDescription); // include groups for the campaign $this->addSelection("includeGroups-f", "label=$groupName"); $this->click("//option[@value=4]"); $this->click("add"); // fill the end date for campaign $this->webtestFillDate("end_date", "+1 year"); // select campaign status $this->select("status_id", "value=2"); // click save $this->click("_qf_Campaign_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForText('crm-notification-container', "Campaign $title"); //Opening Edit Page of the created Campaign $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']"); $this->clickLink("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']", "//textarea[@id='description']"); $fetchedVaue = $this->getValue('description'); $this->assertEquals($campaignDescription, $fetchedVaue); } }