$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(array('CiviCampaign'));
// add the required Drupal permission
$permissions = array(
$this->changePermissions($permissions);
// Go directly to the URL of the screen that you will be testing
- $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
-
- // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
- // button at the end of this page to show up, to make sure it's fully loaded.
- $this->waitForElementPresent("_qf_Campaign_upload-bottom");
+ $this->openCiviPage("campaign/add", "reset=1", "_qf_Campaign_upload-bottom");
// Let's start filling the form with values.
$campaignTitle = "Campaign $title";
$this->click("_qf_Campaign_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Campaign Campaign $title has been saved."),
+ $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.",
"Status message didn't show up after saving campaign!"
);
$processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
$paymentProcessorId = $this->webtestAddPaymentProcessor($processorName);
- $this->open($this->sboxPath . "civicrm/admin/contribute/add?reset=1&action=add");
+ $this->openCiviPage("admin/contribute/add", "reset=1&action=add");
$contributionTitle = substr(sha1(rand()), 0, 7);
$rand = 2 * rand(2, 50);
//this contribution page for online contribution
$this->check("payment_processor[{$paymentProcessorId}]");
- $this->isTextPresent("Contribution Amounts section enabled");
+ $this->assertElementContainsText('crm-container', "Contribution Amounts section enabled");
$this->type("label_1", "amount 1");
$this->type("value_1", "100");
$this->type("label_2", "amount 2");
$registerUrl = $this->_testVerifyRegisterPage($contributionPageTitle);
//logout
- $this->open($this->sboxPath . "civicrm/logout?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage("logout", "reset=1");
//Open Live Contribution Page
- $this->open($this->sboxPath . $registerUrl);
- $this->waitForElementPresent("_qf_Main_upload-bottom");
-
+ $this->openCiviPage($registerUrl['url'], $registerUrl['args']);
$firstName = 'Ma' . substr(sha1(rand()), 0, 4);
$lastName = 'An' . substr(sha1(rand()), 0, 7);
$this->webtestLogin();
//Find Contribution
- $this->open($this->sboxPath . "civicrm/contribute/search?reset=1");
-
- $this->waitForElementPresent("contribution_date_low");
+ $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
$this->type("sort_name", "$firstName $lastName");
$this->click("_qf_Search_refresh");
}
function _testVerifyRegisterPage($contributionPageTitle) {
- $this->open($this->sboxPath . "civicrm/admin/contribute?reset=1");
- $this->waitForElementPresent("_qf_SearchContribution_refresh");
+ $this->openCiviPage("admin/contribute", "reset=1", "_qf_SearchContribution_refresh");
$this->type('title', $contributionPageTitle);
$this->click("_qf_SearchContribution_refresh");
$this->waitForPageToLoad('50000');
$id = $this->getAttribute("//div[@id='configure_contribution_page']//table/tbody/tr/td/strong[text()='$contributionPageTitle']/../../td[5]/div/span/ul/li/a[text()='Title and Settings']@href");
$id = explode('id=', $id);
- $registerUrl = "civicrm/contribute/transact?reset=1&id=$id[1]";
+ $registerUrl = array('url' => 'contribute/transact', 'args' => "reset=1&id=$id[1]");
return $registerUrl;
}
-}
-
+}
\ No newline at end of file
$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("Your changes have been saved."));
- }
+ $this->enableComponents(array('CiviCampaign'));
// add the required Drupal permission
$permissions = array('edit-2-administer-civicampaign', 'edit-1-register-for-events');
$this->changePermissions($permissions);
// Go directly to the URL of the screen that you will be testing
- $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
-
- // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
- // button at the end of this page to show up, to make sure it's fully loaded.
- $this->waitForElementPresent("_qf_Campaign_upload-bottom");
+ $this->openCiviPage("campaign/add", "reset=1", "_qf_Campaign_upload-bottom");
// Let's start filling the form with values.
$campaignTitle = "Campaign $title";
$this->click("_qf_Campaign_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Campaign Campaign $title has been saved."),
+ $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.",
"Status message didn't show up after saving campaign!"
);
$this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
$id = (int) $this->getText("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
-
+
$this->onlineParticipantAddTest($campaignTitle, $id);
}
$paymentProcessorId = $this->webtestAddPaymentProcessor($processorName);
// Go directly to the URL of the screen that you will be testing (New Event).
- $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add");
+ $this->openCiviPage("event/add", "reset=1&action=add");
$eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7);
$eventDescription = "Here is a description for this conference.";
$numberRegistrations = 3;
$anonymous = TRUE;
-
+
$this->_testOnlineRegistration($campaignTitle, $registerUrl, $numberRegistrations, $anonymous);
}
function _testVerifyEventInfo($eventTitle, $eventInfoStrings) {
// verify event input on info page
// start at Manage Events listing
- $this->open($this->sboxPath . "civicrm/event/manage?reset=1");
+ $this->openCiviPage("event/manage", "reset=1");
$this->click("link=$eventTitle");
$this->waitForPageToLoad($this->getTimeoutMsec());
function _testOnlineRegistration($campaignTitle, $registerUrl, $numberRegistrations = 1, $anonymous = TRUE) {
if ($anonymous) {
- $this->open($this->sboxPath . "civicrm/logout?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage("logout", "reset=1");
}
$this->open($registerUrl);
$this->open($this->sboxPath);
$this->webtestLogin();
- $this->open($this->sboxPath . 'civicrm/event/search?reset=1');
- $this->waitForElementPresent("_qf_Search_refresh");
+ $this->openCiviPage('event/search', 'reset=1', '_qf_Search_refresh');
$this->type('sort_name', $email);
$this->click("_qf_Search_refresh");
$this->waitForElementPresent("_qf_Search_next_print");
$this->click("xpath=//div[@id='participantSearch']/table/tbody/tr/td[11]/span/a[text()='Edit']");
$this->waitForElementPresent("_qf_Participant_cancel-bottom");
- $this->assertTrue($this->isTextPresent("$campaignTitle"));
+ $this->assertElementContainsText('crm-container', "$campaignTitle");
}
-}
+}
\ No newline at end of file