}
function testCreateCampaign() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
// Log in as admin first to verify permissions for CiviCampaign
$this->webtestLogin(TRUE);
$this->waitForPageToLoad($this->getTimeoutMsec());
// Enable CiviCampaign module if necessary
- $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviCampaign", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviCampaign");
- $this->click("//option[@value='CiviCampaign']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Changes Saved."));
- }
+ $this->enableComponents("CiviCampaign");
// now logout and login with admin credentials
$this->open($this->sboxPath . "civicrm/logout?reset=1");
$registerUrl = array('url' => 'contribute/transact', 'args' => "reset=1&id=$id[1]");
return $registerUrl;
}
-}
\ No newline at end of file
+}
$this->waitForElementPresent("_qf_Participant_cancel-bottom");
$this->assertElementContainsText('crm-container', "$campaignTitle");
}
-}
\ No newline at end of file
+}
}
function testPetitionUsageScenario() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
- // Logging in. Remember to wait for page to load. In most cases,
- // you can rely on 30000 as the value that allows your test to pass, however,
- // sometimes your test might fail because of this. In such cases, it's better to pick one element
- // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
- // page contents loaded and you can continue your test execution.
$this->webtestLogin();
-
// Enable CiviCampaign module if necessary
- $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviCampaign", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviCampaign");
- $this->click("//option[@value='CiviCampaign']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your changes have been saved."));
- }
+ $this->enableComponents("CiviCampaign");
// handle permissions early
$this->webtestLogin(TRUE);
// Enable CiviCampaign module and CiviPledge module if necessary
- $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviCampaign", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviCampaign");
- $this->click("//option[@value='CiviCampaign']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your changes have been saved."));
- }
-
- $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviPledge", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviPledge");
- $this->click("//option[@value='CiviPledge']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your changes have been saved."));
- }
+ $this->enableComponents(array("CiviCampaign", "CiviPledge"));
// add the required Drupal permission
$permissions = array(
$this->webtestLogin();
// Enable CiviCase module if necessary
- $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions('enableComponents-t');
- if (!in_array('CiviCase', $enabledComponents)) {
- $this->addSelection('enableComponents-f', "label=CiviCase");
- $this->click("//option[@value='CiviCase']");
- $this->click('add');
- $this->click('_qf_Component_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviCase");
// let's give full CiviCase permissions to demo user (registered user).
$permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase');
}
function testStandaloneCaseAdd() {
-
- $this->open($this->sboxPath);
-
// Log in as admin first to verify permissions for CiviCase
$this->webtestLogin();
// Enable CiviCase module if necessary
- $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviCase", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviCase");
- $this->click("//option[@value='CiviCase']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviCase");
// let's give full CiviCase permissions to demo user (registered user).
$permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase');
$this->webtestLogin();
// Enable CiviCase module if necessary
- $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviCase", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviCase");
- $this->click("//option[@value='CiviCase']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviCase");
// let's give full CiviCase permissions to demo user (registered user).
$permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase');
$this->click("_qf_Basic_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent($emailId));
- $this->assertTrue($this->isTextPresent($lastName . ', ' . $firstName));
- $this->assertTrue($this->isTextPresent("902C El Camino Way SW"));
- $this->assertTrue($this->isTextPresent("Dumfries"));
- $this->assertTrue($this->isTextPresent("1234"));
+ $this->assertElementContainsText('css=.crm-search-results', $emailId);
+ $this->assertElementContainsText('css=.crm-search-results', $lastName . ', ' . $firstName);
+ $this->assertElementContainsText('css=.crm-search-results', "902C El Camino Way SW");
+ $this->assertElementContainsText('css=.crm-search-results', "Dumfries");
+ $this->assertElementContainsText('css=.crm-search-results', "1234");
}
}
$fieldId = $url[1];
// Enable CiviCampaign module if necessary
- $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions('enableComponents-t');
- if (!in_array("CiviCampaign", $enabledComponents)) {
- $this->addSelection('enableComponents-f', "label=CiviCampaign");
- $this->click("//option[@value='CiviCampaign']");
- $this->click('add');
- $this->click('_qf_Component_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('Your changes have been saved.'));
- }
+ $this->enableComponents("CiviCampaign");
// add the required Drupal permission
$permission = array('edit-2-administer-civicampaign');
$fieldId = $url[1];
// Enable CiviCampaign module if necessary
- $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions('enableComponents-t');
- if (!in_array("CiviCampaign", $enabledComponents)) {
- $this->addSelection('enableComponents-f', "label=CiviCampaign");
- $this->click("//option[@value='CiviCampaign']");
- $this->click('add');
- $this->click('_qf_Component_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('Your changes have been saved.'));
- }
+ $this->enableComponents("CiviCampaign");
// add the required Drupal permission
$permission = array('edit-2-administer-civicampaign');
function testContributionDashboard() {
$this->login();
// Enable CiviContribute module if necessary
- $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviContribute", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviContribute");
- $this->click("//option[@value='CiviContribute']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviContribute");
// Contributions → Dashboard
$this->click("css=ul#civicrm-menu li.crm-Contributions");
$this->login();
// Enable CiviEvent module if necessary
- $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviEvent", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviEvent");
- $this->click("//option[@value='CiviEvent']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviEvent");
// Events → Dashboard
$this->click("css=ul#civicrm-menu li.crm-Events");
$this->login();
// Enable CiviMember module if necessary
- $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviMember", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviMember");
- $this->click("//option[@value='CiviMember']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviMember");
// Memberships → Dashboard
$this->click("css=ul#civicrm-menu li.crm-Memberships");
$this->login();
// Enable CiviContribute module if necessary
- $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviContribute", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviContribute");
- $this->click("//option[@value='CiviContribute']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviContribute");
// Search → Find Contributions
// Use class names for menu items since li array can change based on which components are enabled
$this->login();
// Enable CiviMail module if necessary
- $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviMail", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviMail");
- $this->click("//option[@value='CiviMail']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- }
+ $this->enableComponents("CiviMail");
// configure default mail-box
$this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", "_qf_MailSettings_cancel-bottom");
}
function testContactContextAddTest() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin(TRUE);
// Enable CiviGrant module if necessary
- $this->open($this->sboxPath . 'civicrm/admin/setting/component?reset=1');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions('enableComponents-t');
- if (!in_array('CiviGrant', $enabledComponents)) {
- $this->addSelection('enableComponents-f', 'label=CiviGrant');
- $this->click("//option[@value='CiviGrant']");
- $this->click('add');
- $this->click('_qf_Component_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('css=div.success');
- $this->assertTrue($this->isTextPresent('Changes Saved.'));
- }
+ $this->enableComponents("CiviGrant");
// let's give full CiviGrant permissions to demo user (registered user).
$permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant');
}
function testCustomFieldsetTest() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin(TRUE);
// Enable CiviGrant module if necessary
- $this->open($this->sboxPath . 'civicrm/admin/setting/component?reset=1');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions('enableComponents-t');
- if (!in_array('CiviGrant', $enabledComponents)) {
- $this->addSelection('enableComponents-f', 'label=CiviGrant');
- $this->click("//option[@value='CiviGrant']");
- $this->click('add');
- $this->click('_qf_Component_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertElementContainsText("css=#crm-notification-container", 'Changes Saved', 'CiviCRM Message does not indicate the enabled component changes were saved');
- }
+ $this->enableComponents("CiviGrant");
// let's give full CiviGrant permissions to demo user (registered user).
$permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant');
}
function testStandaloneGrantAdd() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin(TRUE);
// Enable CiviGrant module if necessary
- $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Component_next-bottom");
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviGrant", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviGrant");
- $this->click("//option[@value='CiviGrant']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your changes have been saved."));
- }
+ $this->enableComponents("CiviGrant");
// let's give full CiviGrant permissions to demo user (registered user).
$permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant');
//campaign test for interview
//enable CiviCampaign module if necessary
- $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviCampaign", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviCampaign");
- $this->click("//option[@value='CiviCampaign']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertElementContainsText('crm-notification-container', 'Changes Saved');
- }
+ $this->enableComponents("CiviCampaign");
//Adding a survey
$this->openCiviPage('survey/add', 'reset=1', '_qf_Main_upload-bottom');
return $returnArray;
}
-}
\ No newline at end of file
+}
}
function testLoggingReport() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
- // Logging in. Remember to wait for page to load. In most cases,
- // you can rely on 30000 as the value that allows your test to pass, however,
- // sometimes your test might fail because of this. In such cases, it's better to pick one element
- // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
- // page contents loaded and you can continue your test execution.
$this->webtestLogin();
//enable the logging
$this->waitForTextPresent("Changes Saved");
//enable CiviCase component
- $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom');
- $enabledComponents = $this->getSelectOptions("enableComponents-t");
- if (!in_array("CiviCase", $enabledComponents)) {
- $this->addSelection("enableComponents-f", "label=CiviCase");
- $this->click("//option[@value='CiviCase']");
- $this->click("add");
- $this->click("_qf_Component_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertElementContainsText('crm-notification-container', "Changes Saved");
- }
+ $this->enableComponents("CiviCase");
+
//add new contact
$orginalFirstName = $firstName = 'Anthony' . substr(sha1(rand()), 0, 7);
$lastName = 'Anderson' . substr(sha1(rand()), 0, 7);
$this->waitForPageToLoad($this->getTimeoutMsec());
}
}
-}
\ No newline at end of file
+}