function addProfile($profileTitle, $profileFields) {
$this->openCiviPage('admin/uf/group', "reset=1");
- $this->click('link=Add Profile');
-
- // Add membership custom data field to profile
- $this->waitForElementPresent('_qf_Group_cancel-bottom');
+ $this->clickLink('link=Add Profile', '_qf_Group_cancel-bottom');
$this->type('title', $profileTitle);
- $this->click('_qf_Group_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Group_next-bottom', "xpath=//a/span[text()='Add Field']");
- $this->waitForElementPresent("xpath=//a/span[text()='Add Field']");
- $this->click("xpath=//a/span[text()='Add Field']");
- $this->waitForElementPresent("field_name[0]");
- //$this->assertTrue($this->isTextPresent("Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."));
+ $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
foreach ($profileFields as $field) {
$this->waitForElementPresent('field_name_0');
- // $this->waitForPageToLoad($this->getTimeoutMsec());
$this->click("id=field_name_0");
$this->select("id=field_name_0", "label=" . $field['type']);
$this->waitForElementPresent('field_name_1');
$this->waitForText('crm-notification-container', "Your custom field set '$customGroupTitle' has been added. You can add custom fields now.");
//add custom field - alphanumeric text
- $this->click('newCustomField');
$this->waitForElementPresent('_qf_Field_cancel-bottom');
$textFieldLabel = 'test_text_field' . substr(sha1(rand()), 0, 3);
$this->click("header");
$this->click("extends[0]");
$this->select("extends[0]", "label=Contacts");
$this->click("//option[@value='Contact']");
- $this->click("//form[@id='Group']/div[2]/div[3]/span[1]/input");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("//form[@id='Group']/div[2]/div[3]/span[1]/input");
//Is custom group created?
- $this->assertTrue($this->isTextPresent("Your custom field set '$customGroupTitle' has been added. You can add custom fields now."));
+ $this->waitForText('crm-notification-container', "Your custom field set '$customGroupTitle' has been added. You can add custom fields now.");
+
+ $gid = $this->urlArg('gid');
+
//add custom field - alphanumeric text
+ $this->openCiviPage('admin/custom/group/field/add', "reset=1&action=add&gid=$gid");
$textFieldLabel = 'test_text_field';
$this->click("header");
$this->type("label", $textFieldLabel);
$this->click("is_searchable");
//clicking save
- $this->click("_qf_Field_next_new-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Field_next_new-bottom");
//Is custom field created?
- $this->assertTrue($this->isTextPresent("Your custom field '$checkboxFieldLabel' has been saved."));
+ $this->waitForText('crm-notification-container', "Custom field '$checkboxFieldLabel' has been saved.");
//add custom field - alphanumeric text
$textFieldLabel = 'test_text_field';
$this->click("header");
$this->type("label", $textFieldLabel);
- $this->click("_qf_Field_next_new-bottom");
+ $this->clickLink("_qf_Field_next_new-bottom");
// Same group will not contain same custome fields so will show error for this field :
- $this->waitForPageToLoad($this->getTimeoutMsec());
$this->click("data_type[0]");
$this->select("data_type[0]", "value=0");
$this->click("//option[@value='0']");
$this->select("data_type[1]", "label=CheckBox");
$this->click("//option[@value='CheckBox']");
//Is custom field created
- $this->assertTrue($this->isTextPresent("Custom field '$textFieldLabel' already exists in Database."));
+ $this->waitForText('crm-notification-container', "Custom field '$textFieldLabel' already exists in Database.");
//create another custom field - Number Radio
$this->click("data_type[0]");
$this->click("is_searchable");
//clicking save
- $this->click("_qf_Field_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Field_done-bottom");
//Is custom field created
- $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved."));
+ $this->waitForText('crm-notification-container', "Custom field '$radioFieldLabel' has been saved.");
}
}
$this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added.");
$gid = $this->urlArg('gid');
+ // Add field
+ $this->openCiviPage('admin/custom/group/field/add', "reset=1&action=add&gid=$gid");
$fieldLabel = "custom_field_for_{$contactSubType}" . substr(sha1(rand()), 0, 4);
$this->type('label', $fieldLabel);
- $this->click('_qf_Field_next-bottom');
+ $this->click('_qf_Field_done-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
$customGroupTitle = preg_replace('/\s/', '_', trim($customGroupTitle));
return array($customGroupTitle, $gid);
*/
function _testAddPriceFields(&$fields, &$validateString, $financialType, $dateSpecificFields = FALSE) {
$validateStrings[] = $financialType;
- $this->click('newPriceField');
- $this->waitForElementPresent('label');
+ $sid = $this->urlArg('sid');
+ $this->openCiviPage('admin/price/field', "reset=1&action=add&sid=$sid", 'label');
foreach ($fields as $label => $type) {
$validateStrings[] = $label;
$this->waitForPageToLoad($this->getTimeoutMsec());
//Is custom field created?
- $this->assertTrue($this->isTextPresent("Your custom field '$checkboxFieldLabel' has been saved."));
+ $this->assertTrue($this->isTextPresent("Custom field '$checkboxFieldLabel' has been saved."));
//create another custom field - Integer Radio
$this->click("//a[@id='newCustomField']/span");
$this->waitForPageToLoad($this->getTimeoutMsec());
//Is custom field created
- $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved."));
+ $this->assertTrue($this->isTextPresent("Custom field '$radioFieldLabel' has been saved."));
//add the above custom data to the On Behalf of Profile
$this->openCiviPage("admin/uf/group", "reset=1");
// Add membership custom data field to profile
$this->waitForElementPresent('_qf_Group_cancel-bottom');
$this->type('title', $profileTitle);
- $this->click('_qf_Group_next-bottom');
+ $this->clickLink('_qf_Group_next-bottom');
- $this->waitForElementPresent('_qf_Field_cancel-bottom');
$this->assertTrue($this->isTextPresent("Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."));
+ $gid = $this->urlArg('gid');
+
+ $this->openCiviPage('admin/uf/group/field/add', array('action' => 'add', 'reset' => 1, 'gid' => $gid), 'field_name[0]');
$this->select('field_name[0]', "value=Membership");
$this->select('field_name[1]', "label={$checkboxFieldLabel} :: {$customGroupTitle}");
$this->click('field_name[1]');
$this->click('_qf_Field_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your custom field '$fieldTitle' has been saved."));
+ $this->assertTrue($this->isTextPresent("Custom field '$fieldTitle' has been saved."));
$fieldId = $this->urlArg('id', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1][text()='$fieldTitle']/../td[8]/span/a@href"));
// Enable CiviCampaign module if necessary
$this->click('_qf_Field_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent("Your custom field '$fieldTitle' has been saved."));
+ $this->assertTrue($this->isTextPresent("Custom field '$fieldTitle' has been saved."));
$fieldId = $this->urlArg('id', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1]/span[text()='$fieldTitle']/../td[8]/span/a@href"));
// Enable CiviCampaign module if necessary
$this->waitForElementPresent('_qf_Group_cancel-bottom');
$this->type('title', $profileTitle);
$this->click('uf_group_type_Profile');
- $this->click('_qf_Group_next-bottom');
+ $this->clickLink('_qf_Group_next-bottom');
- $this->waitForElementPresent('_qf_Field_cancel-bottom');
$this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
+ $gid = $this->urlArg('gid');
+
+ $this->openCiviPage('admin/uf/group/field/add', array('action' => 'add', 'reset' => 1, 'gid' => $gid), 'field_name[0]');
$this->select('field_name[0]', "value=Membership");
$this->select('field_name[1]', "label={$customDataParams[0]} :: {$customDataParams[1]}");
$this->openCiviPage('admin/uf/group', 'reset=1');
- $this->click('link=Add Profile');
+ $this->clickLink('link=Add Profile', '_qf_Group_cancel-bottom');
// Add membership custom data field to profile
- $this->waitForElementPresent('_qf_Group_cancel-bottom');
$this->type('title', $profileTitle);
- $this->click('_qf_Group_next-bottom');
- $this->waitForElementPresent("xpath=//a/span[text()='Add Field']");
+ // Standalone form or directory
+ $this->click('uf_group_type_Profile');
+
+ $this->clickLink('_qf_Group_next-bottom');
+
$this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
- $this->click("xpath=//a/span[text()='Add Field']");
$this->waitForElementPresent("field_name[0]");
- foreach ($customDataArr as $key => $customDataParams) {
+ foreach ($customDataArr as $customDataParams) {
$this->select('field_name[0]', "label={$profileFor}");
$this->select('field_name[1]', "label={$customDataParams[1]} :: {$customDataParams[0]}");
$this->click('field_name[1]');
// Clicking save and new
$this->click('_qf_Field_next_new-bottom');
$this->waitForText('crm-notification-container', "Your CiviCRM Profile Field '{$customDataParams[1]}' has been saved to '{$profileTitle}'.");
+ $this->waitForElementPresent("xpath=//select[@id='field_name_1'][@style='display: none;']");
}
}
$this->openCiviPage('admin/custom/group', 'reset=1');
//add new custom data
- $this->click("//a[@id='newCustomDataGroup']/span");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("//a[@id='newCustomDataGroup']/span");
//fill custom group title
$this->click("title");
$this->click("//option[@value='']");
}
- $this->click('_qf_Group_next-bottom');
- $this->waitForElementPresent("newCustomField");
+ $this->clickLink('_qf_Group_next-bottom');
//Is custom group created?
$this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
//for checkbox 1
- $this->click("newCustomField");
$this->waitForElementPresent("label");
$checkLabel1 = 'Custom Check One Text_' . substr(sha1(rand()), 0, 4);
$this->type('label', $checkLabel1);
$this->type("options_per_line", 2);
//clicking save
- $this->click('_qf_Field_done');
- $this->waitForElementPresent("newCustomField");
+ $this->click('_qf_Field_next_new-top');
//Is custom field created
$this->waitForText('crm-notification-container', "Custom field '$checkLabel1' has been saved.");
$returnArray[1] = array($customGroupTitle, $checkLabel1);
- $this->waitForElementPresent('newCustomField');
// create another custom field - Integer Radio
- $this->clickLink('newCustomField', "_qf_Field_cancel-bottom", FALSE);
-
//for checkbox 2
$checkLabel2 = 'Custom Check Two Text_' . substr(sha1(rand()), 0, 4);
$this->type('label', $checkLabel2);
$this->type('option_value_3', 3);
//clicking save
- $this->clickLink('_qf_Field_done', 'newCustomField', FALSE);
+ $this->click('_qf_Field_next_new-top');
//Is custom field created
$this->waitForText('crm-notification-container', "Custom field '$checkLabel2' has been saved.");
$returnArray[2] = array($customGroupTitle, $checkLabel2);
- // create another custom field - Integer Radio
- $this->clickLink('newCustomField', "_qf_Field_cancel-bottom", FALSE);
-
// create another custom field - Date
$dateFieldLabel = 'Custom Date Field' . substr(sha1(rand()), 0, 4);
$this->type('label', $dateFieldLabel);
$this->select('time_format', "value=2");
//clicking save
- $this->clickLink('_qf_Field_done', 'newCustomField', FALSE);
-
+ $this->click('_qf_Field_next_new-top');
//Is custom field created
$this->waitForText('crm-notification-container', "Custom field '$dateFieldLabel' has been saved.");
$returnArray[3] = array($customGroupTitle, $dateFieldLabel);
- // create another custom field - Integer Radio
- $this->clickLink('newCustomField', "_qf_Field_cancel-bottom", FALSE);
-
//create rich text editor field
$richTextField = 'Custom Rich TextField_' . substr(sha1(rand()), 0, 4);
$this->type('label', $richTextField);
$this->select('data_type[1]', "label=RichTextEditor");
//clicking save
- $this->clickLink('_qf_Field_done', 'newCustomField', FALSE);
+ $this->click('_qf_Field_next_new-top');
//Is custom field created
$this->waitForText('crm-notification-container', "Custom field '$richTextField' has been saved.");
$returnArray[4] = array($customGroupTitle, $richTextField);
- // create another custom field - Integer Radio
- $this->clickLink('newCustomField', "_qf_Field_cancel-bottom", FALSE);
-
//create radio button field
//for radio 1
$radioLabel1 = 'Custom Radio One Text_' . substr(sha1(rand()), 0, 4);
$this->type('option_value_3', 3);
//clicking save
- $this->clickLink('_qf_Field_done', 'newCustomField', FALSE);
+ $this->click('_qf_Field_next_new-top');
//Is custom field created
$this->waitForText('crm-notification-container', "Custom field '$radioLabel1' has been saved.");
$returnArray[5] = array($customGroupTitle, $radioLabel1);
- // create another custom field - Integer Radio
- $this->clickLink('newCustomField', "_qf_Field_cancel-bottom", FALSE);
-
+ // create another custom field - Alpha Radio
//for radio 2
$radioLabel2 = 'Custom Radio Two Text_' . substr(sha1(rand()), 0, 4);
$this->type('label', $radioLabel2);
$this->click('is_uf_link');
//click on save
- $this->click('_qf_Group_next');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Group_next');
+
+ $gid = $this->urlArg('gid');
- //check for profile create
- $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
//Add field to profile
- $this->waitForElementPresent("xpath=//a/span[text()='Add Field']");
$this->click("xpath=//a/span[text()='Add Field']");
$this->waitForElementPresent("field_name[0]");
$this->click('field_name[0]');
//click on save
$this->click('_qf_Field_next');
- $this->waitForElementPresent("xpath=//a/span[text()='Add Field']");
+ sleep(1);
// delete the profile
$this->openCiviPage('admin/uf/group', 'reset=1');
'last_name' => 'Individual',
'email' => 'Contact'
);
- $this->waitForElementPresent("xpath=//a/span[text()='Add Field']");
- $this->click("xpath=//a/span[text()='Add Field']");
$this->waitForElementPresent("field_name_0");
foreach ($fields as $field => $type) {
$this->click('field_name_0');
// Wait for "saved" status msg
$this->waitForText('crm-notification-container', 'Profile Saved');
- $this->clickLink("xpath=//div[@id='breadcrumb']/div//a[text()='Profiles']");
+ $this->openCiviPage("admin/uf/group", "reset=1");
$this->waitForElementPresent("xpath=//div[@class='crm-submit-buttons']/a[@id='newCiviCRMProfile-bottom']");
$this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody/tr[@id='UFGroup-$id']/td[2]/a");
$this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody/tr[@id='UFGroup-$id']/td[3]");
$profileTitle = 'Country state province web test temp';
$this->type('title', $profileTitle);
+ // Standalone form or directory
+ $this->click('uf_group_type_Profile');
+
//click on save
$this->click('_qf_Group_next');
$this->waitForPageToLoad($this->getTimeoutMsec());
//check for profile create
$this->waitForText('crm-notification-container', "Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
$gid = $this->urlArg('gid');
+
//Add Country field to profile
+ $this->openCiviPage('admin/uf/group/field/add', array('action' => 'add', 'reset' => 1, 'gid' => $gid), 'field_name[0]');
$this->click('field_name[0]');
$this->select('field_name[0]', 'value=Contact');
$this->click("//option[@value='Contact']");
$states = CRM_Core_PseudoConstant::stateProvinceForCountry($countryID, 'id');
$stateID = array_rand($states);
$this->select("xpath=//form[@id='Edit']/div[2]/div/div/div[2]/select", "value=$countryID");
- sleep(2);
- $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/div[2]/div[2]/select");
+ $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/div[2]/div[2]/select/option[@value=$stateID]");
$this->click("xpath=//form[@id='Edit']/div[2]/div/div[2]/div[2]/select");
$this->select("xpath=//form[@id='Edit']/div[2]/div/div[2]/div[2]/select", "value=$stateID");
$this->clickLink('_qf_Edit_next', NULL);
- $this->openCiviPage('admin/uf/group', 'reset=1');
- $this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul/li[4]/a[text()='Delete']");
- $this->click("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul/li[4]/a[text()='Delete']");
- $this->waitForElementPresent('_qf_Group_next-bottom');
- $this->click('_qf_Group_next-bottom');
- $this->waitForElementPresent('newCiviCRMProfile-bottom');
+ // Delete profile
+ $this->openCiviPage('admin/uf/group', 'action=delete&id=' . $gid, '_qf_Group_next-bottom');
+ $this->clickLink('_qf_Group_next-bottom', 'newCiviCRMProfile-bottom');
$this->waitForText('crm-notification-container', "Profile '{$profileTitle}' has been deleted.");
$this->openCiviPage("admin/setting/localization", "reset=1", "_qf_Localization_next-bottom");
$this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
//Add email field to profile
- $this->click("xpath=//a/span[text()='Add Field']");
$this->waitForElementPresent("field_name[0]");
$this->click('field_name[0]');
$this->select('field_name[0]', 'value=Contact');
$profileId = $this->urlArg('gid');
// Add Last Name field.
- $this->click("xpath=//a/span[text()='Add Field']");
$this->waitForElementPresent("field_name[0]");
$this->click('field_name[0]');
$this->select('field_name[0]', 'value=Individual');
$this->clickLink('_qf_Field_next-bottom', "xpath=//div[@id='field_page']/div[1]/a[4]/span[text()='Use (create mode)']", FALSE);
$uselink = explode('?', $this->getAttribute("xpath=//*[@id='field_page']/div[1]/a[4]@href"));
- $this->openCiviPage('profile/create', "$uselink[1]", '_qf_Edit_cancel');
- $this->waitForElementPresent('_qf_Edit_next');
+ $this->openCiviPage('profile/create', "$uselink[1]", '_qf_Edit_next');
$lastName = substr(sha1(rand()), 0, 7);
// Fill Last Name
// fill country, state, county
$this->select('country-Primary', "United States");
- // adding sleep gives time for state data
- // to get populated in state combo box
- sleep(1);
+
+ // wait for state data to be populated
+ $this->waitForElementPresent("xpath=//select[@id='state_province-Primary']/option[text()='California']");
$this->select('state_province-Primary', "California");
- // adding sleep gives time for county data
- // to get populated in county combo box
- sleep(1);
+
+ // wait for county data to be populated
+ $this->waitForElementPresent("xpath=//select[@id='county-Primary']/option[text()='Alameda']");
$this->select('county-Primary', "Alameda");
- $this->click('_qf_Edit_next');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+
+ $this->clickLink('_qf_Edit_next', NULL);
$this->assertElementContainsText("css=span.msg-text", 'Your information has been saved.');
// Fill state, county, country
$this->select('country-Primary', "United States");
- // adding sleep gives time for state data
- // to get populated in state combo box
- sleep(1);
+
+ // wait for state data to be populated
+ $this->waitForElementPresent("xpath=//select[@id='state_province-Primary']/option[text()='California']");
$this->select('state_province-Primary', "California");
- // adding sleep gives time for county data
- // to get populated in county combo box
- sleep(1);
+
+ // wait for county data to be populated
+ $this->waitForElementPresent("xpath=//select[@id='county-Primary']/option[text()='Alameda']");
$this->select('county-Primary', "Alameda");
// Select Custom option
$this->select('custom_1', 'Education');
- $this->click('_qf_Search_refresh');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Search_refresh', NULL);
// Verify Data.
$this->assertTrue($this->isElementPresent("xpath=//table/tbody/tr[2]/td[2][text()='$lastName']"));
$this->assertTrue($this->isElementPresent("xpath=//table/tbody/tr[2]/td[8][text()='Alameda']"));
// Go back to Profile fields admin
- $this->openCiviPage('admin/uf/group/field', "reset=1&action=browse&gid=$profileId");
+ $this->openCiviPage('admin/uf/group/field', "reset=1&action=browse&gid=$profileId", "xpath=//table/tbody/tr[1]/td[9]");
// Edit first profile field
- $this->waitForElementPresent("xpath=//table/tbody/tr[1]/td[9]");
$this->clickLink("xpath=//table/tbody/tr[1]/td[9]/span[1]/a[1]", '_qf_Field_next-bottom', FALSE);
- // sleep 5 to make sure jQuery is not hiding field after page load
- // Because it tends to cause problems, all uses of sleep() must be justified in comments
- // Sleep should never be used for wait for anything to load from the server
- // Justification for this instance: FIXME
- sleep(5);
- $this->assertTrue($this->isElementPresent("visibility"), 'Visibility field not present when editing existing profile field.');
+ $this->waitForElementPresent("visibility");
$this->click("xpath=//tr[@id='profile_visibility']/td[1]/a");
$this->waitForElementPresent("xpath=//div[@id='crm-notification-container']/div/div[2]/p[2]");
$this->waitForText('crm-notification-container', 'Is this field hidden from other users');