}
//Go to the contacts page and check that the custom field is in the right group
- $this->open($this->sboxPath . "/civicrm/contact/view?reset=1&cid=" . $cid_all);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('contact/view',"reset=1&cid={$cid_all}");
//load the names of the custom fieldsets
$source = $this->webtest_civicrm_api("CustomGroup", "get", array('id' => $from_group_id));
//moves a field from one field to another
function _moveCustomField($field_to_move, $from_group_id, $to_group_id) {
//go to the move field page
- $this->open($this->sboxPath . "civicrm/admin/custom/group/field/move?reset=1&fid=" . $field_to_move);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/custom/group/field/move', "reset=1&fid={$field_to_move}");
//select the destination field set from select box
$this->click("dst_group_id");
$this->click("_qf_MoveField_next");
$this->waitForPageToLoad($this->getTimeoutMsec());
- //asser that the success text is present
- $this->assertTrue($this->isTextPresent("has been moved"), "Move field success message not displayed");
+ //assert that the success text is present
+ $this->assertElementContainsText('crm-notification-container', "has been moved", "Move field success message not displayed");
//assert that the custom field not on old data set page
$this->assertTrue(!$this->isElementPresent("CustomField-" . $field_to_move), "The moved custom field still displays on the old fieldset page");
//go to the destination fieldset and make sure the field is present
- $this->open($this->sboxPath . "civicrm/admin/custom/group/field?reset=1&action=browse&gid=" . $to_group_id);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/custom/group/field', "reset=1&action=browse&gid={$to_group_id}");
$this->assertTrue($this->isElementPresent("CustomField-" . $field_to_move), "The moved custom field does not display on the new fieldset page");
}
//Creates a custom field group for a specific entity type and returns the custom group Id
function _createCustomGroup($prefix = "custom", $entity = "Contact") {
// Go directly to the URL of the screen that you will be testing (New Custom Group).
- $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/custom/group', 'action=add&reset=1');
//fill custom group title
$customGroupTitle = $prefix . '_' . substr(sha1(rand()), 0, 7);
$this->waitForElementPresent("_qf_Field_cancel-bottom");
//Is custom group created?
- $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."), "Group title missing");
+ $this->assertElementContainsText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.", "Group title missing");
$url = $this->parseURL();
$group_id = $url['queryString']['gid'];
}
//Go to the add custom field page for the given group id
- $this->open($this->sboxPath . "civicrm/admin/custom/group/field/add?action=add&reset=1&gid=" . $group_id);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/custom/group/field/add', "action=add&reset=1&gid={$group_id}");
//Do common setup for all field types
$this->waitForPageToLoad($this->getTimeoutMsec());
//Is custom field created?
- $this->assertTrue($this->isTextPresent("Your custom field '$fieldLabel' has been saved."), "Field was not created successfully");
+ $this->assertElementContainsText('crm-notification-container', "Your custom field '$fieldLabel' has been saved.", "Field was not created successfully");
//get the custom id of the custom field that was just created
$results = $this->webtest_civicrm_api("CustomField", "get", array('label' => $fieldLabel, 'custom_group_id' => $group_id));
//randomly generates data for a specific custom field
function _fillCustomDataForContact($contact_id, $group_id) {
//edit the given contact
- $this->open($this->sboxPath . "civicrm/contact/add?reset=1&action=update&cid=" . $contact_id);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('contact/add', "reset=1&action=update&cid={$contact_id}");
$this->click("expand");
$this->waitForElementPresent("address_1_street_address");
$this->waitForPageToLoad($this->getTimeoutMsec());
//assert success
- $this->assertTrue($this->isTextPresent("has been updated"), "Contact Record could not be saved");
+ $this->assertElementContainsText('crm-notification-container', "has been updated", "Contact Record could not be saved");
}
}
$this->waitForPageToLoad($this->getTimeoutMsec());
//jump directly to relationship type selector.
- $this->open($this->sboxPath . 'civicrm/admin/reltype?reset=1&action=browse');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
//load the form to add new relationship type.
$this->click('link=Add Relationship Type');
$this->waitForPageToLoad($this->getTimeoutMsec());
//does data saved.
- $this->assertTrue($this->isTextPresent('The Relationship Type has been saved.'),
+ $this->assertElementContainsText('crm-notification-container', 'The Relationship Type has been saved.',
"Status message didn't show up after saving!"
);
'Contact Type B' => 'Individual',
);
foreach ($data as $param => $val) {
- $this->assertTrue($this->isTextPresent($val), "Could not able to save $param");
+ $this->assertElementContainsText('option11', $val, "Could not able to save $param");
}
}
$this->waitForPageToLoad($this->getTimeoutMsec());
//jump directly to relationship type selector.
- $this->open($this->sboxPath . 'civicrm/admin/reltype?reset=1&action=browse');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
//validate form rules.
$this->click('link=Add Relationship Type');
$this->click('_qf_RelationshipType_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('Relationship Label-A to B is a required field.'),
+ $this->assertElementContainsText('crm-notification-container', 'Relationship Label-A to B is a required field.',
'Required form rule for Label A - B seems to be broken.'
);
$this->click('_qf_RelationshipType_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->open($this->sboxPath . 'civicrm/admin/reltype?reset=1&action=browse');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
$this->click('link=Add Relationship Type');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->type('label_a_b', $labelAB);
$this->type('label_b_a', $labelBA);
$this->click('_qf_RelationshipType_next-bottom');
+
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('Label already exists in Database.'),
+ $this->assertElementContainsText('crm-notification-container', 'Label already exists in Database.',
'Unique relationship type label form rule seems to be broken.'
);
}
$this->webtestLogin(TRUE);
// 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());
- sleep(1);
- $this->assertTrue($this->isTextPresent("Changes Saved."));
- }
+ $this->enableComponents(array('CiviCampaign'));
// add the required Drupal permission
$permissions = array('edit-2-administer-civicampaign');
$this->waitForPageToLoad($this->getTimeoutMsec());
// 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!"
);
// Let's start filling the form with values.
// ...and verifying if the page contains properly formatted display name for chosen contact.
- $this->assertTrue($this->isTextPresent("Anderson, " . $firstName2), "Contact not found in line " . __LINE__);
+ $this->assertElementContainsText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook','Anderson, ' . $firstName2, 'Contact not found in line ' . __LINE__);
// Now we're filling the "Assigned To" field.
// Typing contact's name into the field (using typeKeys(), not type()!)...
$this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook");
// ...and verifying if the page contains properly formatted display name for chosen contact.
- $this->assertTrue($this->isTextPresent("Summerson, " . $firstName1), "Contact not found in line " . __LINE__);
+ $this->assertElementContainsText('css=tr.crm-activity-form-block-assignee_contact_id td ul li.token-input-token-facebook', 'Summerson, ' . $firstName1, 'Contact not found in line ' . __LINE__);
// Since we're here, let's check if screen help is being displayed properly
// $this->assertTrue($this->isTextPresent("A copy of this activity will be emailed to each Assignee"));
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is status message correct?
- $this->assertTrue($this->isTextPresent("Activity '$subject' has been saved."), "Status message didn't show up after saving!");
+ $this->assertElementContainsText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving!");
$this->waitForElementPresent("xpath=//div[@id='Activities']//table/tbody/tr[1]/td[9]/span/a[text()='View']");
$groupName = $this->WebtestAddGroup();
// 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'));
//Creating a new Campaign
- $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->webtestLogin(TRUE);
// 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');
$this->waitForPageToLoad($this->getTimeoutMsec());
// 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.
$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->click("_qf_GroupContact_next");
// configure default mail-box
- $this->open($this->sboxPath . "civicrm/admin/mailSettings?action=update&id=1&reset=1");
- $this->waitForElementPresent('_qf_MailSettings_cancel-bottom');
+ $this->openCiviPage('admin/mailSettings', 'action=update&id=1&reset=1', '_qf_MailSettings_cancel-bottom');
$this->type('name', 'Test Domain');
$this->type('domain', 'example.com');
$this->select('protocol', 'value=1');
$this->waitForPageToLoad($this->getTimeoutMsec());
// Go directly to Schedule and Send Mailing form
- $this->open($this->sboxPath . "civicrm/mailing/send?reset=1");
- $this->waitForElementPresent("_qf_Group_cancel");
+ $this->openCiviPage('mailing/send', 'reset=1', '_qf_Group_cancel');
//-------select recipients----------
$this->assertChecked("open_tracking");
// do check count for Recipient
- $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+ $this->assertElementContainsText('crm-container', "Total Recipients: 2");
// no need tracking for this test
$this->select("footer_id", "label=Mailing Footer");
// do check count for Recipient
- $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+ $this->assertElementContainsText('crm-container', "Total Recipients: 2");
// click next with nominal content
$this->click("_qf_Upload_upload");
////////
// do check count for Recipient
- $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+ $this->assertElementContainsText('crm-container', "Total Recipients: 2");
// click next
$this->click("_qf_Test_next");
$this->assertChecked("now");
// do check count for Recipient
- $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+ $this->assertElementContainsText('crm-container', "Total Recipients: 2");
// finally schedule the mail by clicking submit
$this->click("_qf_Schedule_next");
//----------end New Mailing-------------
//check redirected page to Scheduled and Sent Mailings and verify for mailing name
- $this->assertTrue($this->isTextPresent("Scheduled and Sent Mailings"));
- $this->assertTrue($this->isTextPresent("Mailing $mailingName Webtest"));
+ $this->assertElementContainsText('page-title', "Scheduled and Sent Mailings");
+ $this->assertElementContainsText('Search', "Mailing $mailingName Webtest");
//--------- mail delivery verification---------
$this->waitForPageToLoad($this->getTimeoutMsec());
// verify undelivered status message
- $this->assertTrue($this->isTextPresent("Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently."));
+ $this->assertElementContainsText('crm-container',"Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently.");
// do check for recipient group
- $this->assertTrue($this->isTextPresent("Members of $groupName"));
+ $this->assertElementContainsText('crm-container', "Members of $groupName");
// directly send schedule mailing -- not working right now
- $this->open($this->sboxPath . "civicrm/mailing/queue?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('mailing/queue', 'reset=1');
//click report link of created mailing
$this->click("xpath=//table//tbody/tr[td[1]/text()='Mailing $mailingName Webtest']/descendant::a[text()='Report']");
$this->waitForPageToLoad($this->getTimeoutMsec());
// do check again for recipient group
- $this->assertTrue($this->isTextPresent("Members of $groupName"));
+ $this->assertElementContainsText('crm-container', "Members of $groupName");
// check for 100% delivery
- $this->assertTrue($this->isTextPresent("2 (100.00%)"));
+ $this->assertElementContainsText('crm-container', "2 (100.00%)");
// verify intended recipients
$this->verifyText("xpath=//table//tr[td/a[text()='Intended Recipients']]/descendant::td[2]", preg_quote("2"));
$this->waitForPageToLoad($this->getTimeoutMsec());
// check for open page
- $this->assertTrue($this->isTextPresent("Successful Deliveries"));
+ $this->assertElementContainsText('page-title', "Successful Deliveries");
// verify email
- $this->assertTrue($this->isTextPresent("mailino$firstName@mailson.co.in"));
+ $this->assertElementContainsText('mailing_event', "mailino$firstName@mailson.co.in");
//------end delivery verification---------
}
}
$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('edit-2-administer-civicampaign');
$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->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('edit-2-administer-civicampaign');
$this->changePermissions($permissions);
- $this->open($this->sboxPath . 'civicrm/campaign?reset=1');
- $this->waitForElementPresent("link=Add Campaign");
+ $this->openCiviPage('campaign', 'reset=1', "link=Add Campaign");
if ($this->isTextPresent('No campaigns found.')) {
// Go directly to the URL of the screen that you will be testing (Register Participant for Event-standalone).
- $this->open($this->sboxPath . "civicrm/contribute/add?reset=1&action=add&context=standalone");
- $this->waitForElementPresent("_qf_Contribution_cancel-bottom");
- $this->assertTrue($this->isTextPresent('There are currently no active Campaigns.'));
+ $this->openCiviPage('contribute/add', 'reset=1&action=add&context=standalone', '_qf_Contribution_cancel-bottom');
+ $this->assertElementContainsText('crm-container', 'There are currently no active Campaigns.');
}
// Go directly to the URL of the screen that you will be testing
- $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
+ $this->openCiviPage('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->click("_qf_Campaign_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Campaign $campaignTitle has been saved."),
+ $this->assertElementContainsText('crm-notification-container', "Campaign $campaignTitle has been saved.",
"Status message didn't show up after saving campaign!"
);
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is status message correct?
- $this->assertTrue($this->isTextPresent("The contribution record has been saved"));
+ $this->assertElementContainsText('crm-notification-container', "The contribution record has been saved");
$this->waitForElementPresent("xpath=//div[@id='Contributions']//table/tbody/tr/td[8]/span/a[text()='View']");
if ($past) {
// when campaign component is disabled
- $this->open($this->sboxPath . 'civicrm/admin/setting/component?reset=1');
- $this->waitForElementPresent("_qf_Component_next-bottom");
+ $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom');
$this->addSelection("enableComponents-t", "label=CiviCampaign");
$this->click("//option[@value='CiviCampaign']");
$this->click("remove");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertTrue($this->isTextPresent("Changes Saved."));
- $this->open($this->sboxPath . 'civicrm/contribute/search?reset=1');
- $this->waitForElementPresent("_qf_Search_refresh");
+ $this->openCiviPage('contribute/search', 'reset=1', '_qf_Search_refresh');
$this->type('sort_name', $firstName);
$this->click("_qf_Search_refresh");
function pastCampaignsTest($groupName) {
// 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.
$pastTitle = substr(sha1(rand()), 0, 7);