$this->waitForElementPresent("edit-submit");
$this->click('edit-user-register-1');
- $this->click('edit-user-email-verification');
+ $this->check('edit-user-email-verification');
$this->click('edit-submit');
$this->waitForPageToLoad($this->getTimeoutMsec());
// logout
// Advanced Search
- $this->open($this->sboxPath . 'civicrm/contact/search/advanced?reset=1');
-
- $this->waitForElementPresent('_qf_Advanced_refresh');
+ $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
$this->click('_qf_Advanced_refresh');
$this->waitForElementPresent('CIVICRM_QFID_ts_all_8');
// Setting registration source
$this->type('source', 'Event StandaloneAddTest Webtest');
- $this->assertTrue($this->isTextPresent('Source for this registration (if applicable).'));
+ $this->assertElementContainsText('css=tr.crm-participant-form-block-source span.description', 'Source for this registration (if applicable).');
// Clicking save.
$this->click("address_1_country_id");
$this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID());
- if ($this->isTextPresent("Latitude")) {
+ if($this->assertElementContainsText('address_1', "Latitude")) {
$this->type("address_1_geo_code_1", "1234");
$this->type("address_1_geo_code_2", "5678");
}
$this->click("address_2_country_id");
$this->select("address_2_country_id", "value=" . $this->webtestGetValidCountryID());
- if ($this->isTextPresent("Latitude")) {
+ if($this->assertElementContainsText('address_2', "Latitude")) {
$this->type("address_2_geo_code_1", "1234");
$this->type("address_2_geo_code_2", "5678");
}
$this->waitForElementPresent("subject");
$this->type("subject", "test note");
$this->type("note", "this is a test note contact webtest");
- $this->assertTrue($this->isTextPresent("Subject\n Notes"));
+ $this->assertElementContainsText('notesBlock', "Subject\n Notes");
//Demographics section
$this->click("//div[@class='crm-accordion-header' and contains(.,'Demographics')]");
//fill in IM
- $this->assertTrue($this->isTextPresent("Yahoo MSN AIM GTalk Jabber Skype"));
+ $this->assertElementContainsText('im_1_provider_id', "Yahoo MSN AIM GTalk Jabber Skype");
$this->type("im_1_name", "testSkype");
$this->select("im_1_location_type_id", "value=3");
$this->select("im_1_provider_id", "value=6");
$this->click("address_1_country_id");
$this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID());
- if ($this->isTextPresent("Latitude")) {
+ if ($this->assertElementContainsText('address_1', "Latitude")) {
$this->type("address_1_geo_code_1", "1234");
$this->type("address_1_geo_code_2", "5678");
}
$this->click("_qf_Display_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Go directly to the URL of the screen that you will be testing (New Organization).
- $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Organization");
+ $this->openCiviPage('contact/add', 'reset=1&ct=Organization');
//contact details section
//fill in Organization name
$this->click("address_1_country_id");
$this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID());
- if ($this->isTextPresent("Latitude")) {
+ if ($this->assertElementContainsText('address_1', "Latitude")) {
$this->type("address_1_geo_code_1", "1234");
$this->type("address_1_geo_code_2", "5678");
}
$this->click("_qf_Edit_next");
// Is new contact created?
- $this->assertTrue(
- $this->isTextPresent("$currentEmployer has been created."),
+ $this->assertElementContainsText('crm-notification-container', "$currentEmployer has been created.",
"Status message didn't show up after saving!"
);
$this->click("_qf_Edit_next");
// Is new contact created?
- $this->assertTrue(
- $this->isTextPresent("$sharedHousehold has been created."),
+ $this->assertElementContainsText('crm-notification-container', "$sharedHousehold has been created.",
"Status message didn't show up after saving!"
);
$this->click("_qf_Contact_upload_view");
$this->waitForPageToLoad($this->getTimeoutMsec());
$name = $this->getText("xpath=//div[@class='crm-summary-display_name']");
- $this->assertTrue($this->isTextPresent("$name has been created."));
+ $this->assertElementContainsText('crm-notification-container', "$name has been created.");
//make sure current employer is set
$this->verifyText("xpath=id('contactinfo-block')/div/div/div[2]/div", 'Employer');
$this->verifyText("xpath=id('contactinfo-block')/div/div/div[2]/div[2]/a[text()]", $currentEmployer);
//make sure both shared address are set.
- $this->assertTrue($this->isTextPresent("Address belongs to $currentEmployer"));
- $this->assertTrue($this->isTextPresent("Address belongs to $sharedHousehold"));
+ $this->assertElementContainsText('address-block-1', "Address belongs to $currentEmployer");
+ $this->assertElementContainsText('address-block-2', "Address belongs to $sharedHousehold");
// make sure relationships are created
$this->click("xpath=id('tab_rel')/a");
- $this->isTextPresent('Employee of');
- $this->isTextPresent('Household Member of');
+ $this->waitForElementPresent('permission-legend');
+ $this->assertElementContainsText('option11', 'Employee of');
+ $this->assertElementContainsText('option11', 'Household Member of');
}
}
$this->webtestLogin();
// Go directly to the URL of the screen that you will be testing (Create Profile).
- $this->open($this->sboxPath . "civicrm/profile/create?reset=1&gid=1");
+ $this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_cancel');
$firstName = 'Jo' . substr(sha1(rand()), 0, 4);
$lastName = 'Ad' . substr(sha1(rand()), 0, 7);
$this->type("street_address-1", "902C El Camino Way SW");
$this->type("city-1", "Dumfries");
$this->type("postal_code-1", "1234");
- $this->assertTrue($this->isTextPresent("United States"));
+ $this->assertElementContainsText('country-1', "United States");
$this->select("state_province-1", "value=1019");
// Clicking save.
$this->click("_qf_Edit_next");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your information has been saved."));
+ $this->assertElementContainsText('css=.msg-text', "Your information has been saved.");
}
}
$this->waitForElementPresent("css=div#tagtree");
$this->click("xpath=//ul/li/label[text()=\"$tagName\"]");
$this->waitForElementPresent("css=.success");
+
// is status message correct?
$this->waitForTextPresent("Saved");
- $this->assertTrue($this->isTextPresent("Saved"));
+ $this->assertElementContainsText('crm-notification-container', "Saved");
// go to event tab and register for event ( auto add activity and contribution )
$this->click("css=li#tab_participant a");
$this->type("trxn_id", "trid$firstName");
$this->click("_qf_Participant_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Event registration for $firstName adv$firstName has been added"));
+ $this->assertElementContainsText('crm-notification-container', "Event registration for $firstName adv$firstName has been added");
// go to pledge tab and add pledge
$this->click("css=li#tab_pledge a");
$this->click("_qf_Pledge_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Pledge has been recorded and the payment schedule has been created."));
+ $this->assertElementContainsText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
// go to Membership tab and add membership
$this->click("css=li#tab_member a");
$this->click("_qf_Membership_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Student membership for $firstName adv$firstName has been added"));
+ $this->assertElementContainsText('crm-notification-container', "Student membership for $firstName adv$firstName has been added");
// go to relationship tab and add relationship
$this->click("css=li#tab_rel a");
$this->webtestFillDate("end_date", "+1 day");
$this->click("details-save");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("New relationship created."));
+ $this->assertElementContainsText('crm-notification-container', "New relationship created.");
//-------------- advance search --------------
// Go directly to the URL of the screen that you will be testing (Advance Search).
- $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1");
+ $this->openCiviPage('contact/search/advanced', 'reset=1');
//also create a dummy name to test false
$dummyName = substr(sha1(rand()), 0, 7);
$this->type("sort_name", "$dummyName");
$this->click("_qf_Advanced_refresh");
$this->waitForElementPresent("css=div.messages");
- $this->assertTrue($this->isTextPresent("No matches found for"));
+ $this->assertElementContainsText('css=div.messages', "No matches found for");
}
/*
function testActivitySearchByTypeTest() {
$this->open($this->sboxPath);
$this->webtestLogin();
- $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1");
+ $this->openCiviPage('contact/search/advanced', 'reset=1');
$this->click("activity");
- sleep(2);
+ $this->waitForElementPresent('activity_subject');
$this->check("xpath=//div[@id='Activity']//div/label[text()='Tell a Friend']/../input");
$this->click("_qf_Advanced_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
// create contact type Individual with subtype
// with most of values to required to search
$Subtype = "Student";
- $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Contact_cancel");
+ $this->openCiviPage('contact/add', 'reset=1&ct=Individual', '_qf_Contact_cancel');
// --- fill few values in Contact Detail block
$this->type("first_name", "$firstName");
// save contact
$this->click("_qf_Contact_upload_view");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("$firstName adv$firstName"));
+ $this->assertElementContainsText('css=.crm-summary-display_name', "$firstName adv$firstName");
}
}
$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.";
$this->_testAddLocation($streetAddress);
$this->_testAddFees(FALSE, FALSE, $paymentProcessorId);
- $this->open($this->sboxPath . "civicrm/event/manage?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('event/manage', 'reset=1');
$this->type('title', $eventTitle);
$this->click('_qf_SearchEvent_refresh');
$this->waitForPageToLoad($this->getTimeoutMsec());
$displayName2 = "$firstName2 David";
$this->_testAddRelationship($sortName2, $sortName, $relType);
- $this->open($this->sboxPath . "civicrm/contact/search?reset=1");
- $this->waitForElementPresent("_qf_Basic_refresh");
+ $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
$this->type("sort_name", $sortName);
$this->select("contact_type", "value=Individual");
$this->click("_qf_Basic_refresh");
$this->click("_qf_Participant_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('contact/search/advanced', 'reset=1');
$this->type("sort_name", $sortName);
$this->click('_qf_Advanced_refresh');
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('1 Contact'));
+ $this->assertElementContainsText('search-status', '1 Contact');
$this->click('css=div.crm-advanced_search_form-accordion div.crm-accordion-header');
$this->select("component_mode", "label=Related Contacts");
$this->click('_qf_Advanced_refresh');
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('2 Contacts'));
+ $this->assertElementContainsText('search-status', '2 Contact');
$this->select("task", "label=Add Contacts to Group");
$this->click("_qf_AddToGroup_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Added Contacts to ".$groupName));
- $this->assertTrue($this->isTextPresent('2 contacts added to group'));
+ $this->assertElementContainsText('crm-notification-container', "Added Contacts to ".$groupName);
+ $this->assertElementContainsText('crm-notification-container', '2 contacts added to group');
$this->_testSearchResult($relType);
}
// Wait for "saved" status msg
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForTextPresent("'Location' information has been saved.");
+ $this->assertElementContainsText('crm-notification-container', "'Location' information has been saved.");
}
function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) {
$this->waitForElementPresent("_qf_Fee_upload-bottom");
$this->click("CIVICRM_QFID_1_is_monetary");
$this->check("payment_processor[{$processorId}]");
- $this->select("financial_type_id", "value=4");
+ $this->select("financial_type_id", "value=4");
if ($priceSet) {
// get one - TBD
}
function _testAddRelationship($ContactName, $relatedName, $relType) {
- $this->open($this->sboxPath . "civicrm/contact/search?reset=1");
- $this->waitForElementPresent("_qf_Basic_refresh");
+ $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
$this->type("sort_name", $ContactName);
$this->select("contact_type", "value=Individual");
$this->click("_qf_Basic_refresh");
$this->waitForElementPresent("current-relationships");
//check the status message
- $this->assertTrue($this->isTextPresent("New relationship created."));
+ $this->assertElementContainsText('crm-notification-container', "New relationship created.");
$this->waitForElementPresent("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='View']");
$this->click("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='View']");
'Status' => 'Enabled',
)
);
- $this->assertTrue($this->isTextPresent($relType));
+ $this->assertElementContainsText('option11', $relType);
}
function _testSearchResult($relType) {
//search related contact using Advanced Search
- $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Advanced_refresh");
+ $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
$this->select("component_mode", "label=Related Contacts");
$this->select("display_relationship_type", "label={$relType}");
$this->click("CiviEvent");
$this->type("event_type", "Conference");
$this->click("_qf_Advanced_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('2 Contacts'));
+ $this->assertElementContainsText('search-status', '2 Contacts');
}
function testAdvanceSearchForLog() {
//advance search for created contacts
- $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1");
- $this->waitForElementPresent('_qf_Advanced_refresh');
+ $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
$this->type('sort_name', $lastNameSoft.', '.$firstNameSoft);
$this->click('changeLog');
$this->waitForElementPresent("log_date_low");
$this->waitForElementPresent('note');
// check contact name on Grant form
- $this->assertTrue($this->isTextPresent("$firstName $lastName"));
+ $this->assertElementContainsText('page-title', "$firstName $lastName");
// Let's start filling the form with values.
$rand = substr(sha1(rand()), 0, 7);
// Add new Grant Type
- $this->open($this->sboxPath . 'civicrm/admin/options/grant_type?group=grant_type&reset=1');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/options/grant_type', 'group=grant_type&reset=1');
$this->click("css=#grant_type > div.action-link > #new > span");
$this->waitForPageToLoad($this->getTimeoutMsec());
$grantType = 'GrantType' . $rand;
$this->type('id=label', $grantType);
$this->click('id=_qf_Options_next-top');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("The Grant Type '$grantType' has been saved."));
+ $this->assertElementContainsText('crm-notification-container', "The Grant Type '$grantType' has been saved.");
// Create new Custom Field Set that extends the grant type
- $this->open($this->sboxPath . 'civicrm/admin/custom/group?reset=1');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/custom/group', 'reset=1');
$this->click("css=#newCustomDataGroup > span");
$this->waitForElementPresent('_qf_Group_next-bottom');
$grantFieldSet = 'Fieldset' . $rand;
$this->click('id=collapse_display');
$this->click('id=_qf_Group_next-bottom');
$this->waitForElementPresent('_qf_Field_next-bottom');
- $this->assertTrue($this->isTextPresent("Your custom field set '$grantFieldSet' has been added."));
+ $this->assertElementContainsText('crm-notification-container', "Your custom field set '$grantFieldSet' has been added.");
// Add field to fieldset
$grantField = 'GrantField' . $rand;
$this->select('id=data_type_0', 'label=Money');
$this->click('id=_qf_Field_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your custom field '$grantField' has been saved."));
+ $this->assertElementContainsText('crm-notification-container', "Your custom field '$grantField' has been saved.");
// Create new Grant
- $this->open($this->sboxPath . 'civicrm/grant/add?reset=1&action=add&context=standalone');
- $this->waitForElementPresent('_qf_Grant_upload-bottom');
+ $this->openCiviPage('grant/add', 'reset=1&action=add&context=standalone', '_qf_Grant_upload-bottom');
$this->select('id=profiles_1', 'label=New Individual');
$this->waitForElementPresent('_qf_Edit_next');
$firstName = 'First' . $rand;
$this->select('id=status_id', 'label=Approved');
$this->select('id=grant_type_id', "label=$grantType");
$this->waitForTextPresent($grantField);
- $this->assertTrue($this->isTextPresent($grantField));
+ $this->assertElementContainsText($grantFieldSet, $grantField);
$this->type('id=amount_total', '100.00');
$this->type("css=div#$grantFieldSet input.form-text", '99.99');
$this->click('id=_qf_Grant_upload-bottom');
$this->changePermissions($permission);
// Go directly to the URL of the screen that you will be testing (New Contribution-standalone).
- $this->open($this->sboxPath . "civicrm/grant/add?reset=1&context=standalone");
-
- // 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_Grant_upload");
+ $this->openCiviPage('grant/add', 'reset=1&context=standalone', '_qf_Grant_upload');
// Let's start filling the form with values.
$this->waitForElementPresent("_qf_GrantView_cancel-bottom");
$expected = array(
- 2 => 'Submitted',
- 3 => 'Emergency',
- 8 => '$ 100.00',
- 10 => '$ 90.00',
- 13 => 'Grant Note',
+ 'Grant Status' => 'Submitted',
+ 'Grant Type' => 'Emergency',
+ 'Amount Requested' => '$ 100.00',
+ 'Amount Granted' => '$ 90.00',
+ 'Notes' => 'Grant Note',
);
- foreach ($expected as $label => $value) {
- $this->verifyText("xpath=id('GrantView')/div[2]/table[1]/tbody/tr[$label]/td[2]", preg_quote($value));
- }
+ $this->webtestVerifyTabularData($expected);
}
}