function _addCustomData() {
$customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 4);
// Go directly to the URL of the screen that you will be testing (New Custom Group).
- $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1");
-
+ $this->openCiviPage('admin/custom/group', 'reset=1');
+
//add new custom data
$this->click("//a[@id='newCustomDataGroup']/span");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Go directly to the URL of the screen that you will be
// testing (Add new profile ).
- $this->open($this->sboxPath . 'civicrm/admin/uf/group?reset=1');
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
-
+ $this->openCiviPage('admin/uf/group', 'reset=1');
+
$this->click('newCiviCRMProfile-top');
$this->waitForElementPresent('_qf_Group_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
//check for profile create
- $this->assertTrue($this->isTextPresent("Your CiviCRM Profile '$profileTitle' has been added. You can add fields to this profile now"));
+ $this->assertElementContainsText('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('field_name[0]');
$this->waitForPageToLoad($this->getTimeoutMsec());
//now use profile create mode for group subscription
- $this->click("xpath=id('field_page')/div[1]/a[4]/span");
+ $this->click("xpath=//div[@id='field_page']/div/a[4]/span");
$this->waitForElementPresent('email-Primary');
//check for group field
- $this->assertTrue($this->isTextPresent('Group(s)'), "Groups field was not found.");
+ $this->assertElementContainsText('crm-profile-block', 'Group(s)', "Groups field was not found.");
//fill the subscription form
$radomEmail = substr(sha1(rand()), 0, 7) . "@example.com";
$this->type("email-Primary", $radomEmail);
// check advisory group ( may be we should create a separate group to test this)
- $this->click("group_4");
-
+ $this->click("group_3");
+
$this->click('_qf_Edit_next');
$this->waitForPageToLoad($this->getTimeoutMsec());
// assert for subscription message
- $this->assertTrue($this->isTextPresent("Your subscription request has been submitted for group "), "Subscription message is not shown");
+ $this->assertElementContainsText('messages', "Your subscription request has been submitted for group ", "Subscription message is not shown");
//check if profile is saved
- $this->assertTrue($this->isTextPresent("Your information has been saved."), "Profile is not saved");
+ $this->assertElementContainsText('css=span.msg-text', 'Your information has been saved.', 'Profile is not saved');
// delete the profile
- $this->open($this->sboxPath . 'civicrm/admin/uf/group?reset=1');
+ $this->openCiviPage('admin/uf/group', 'reset=1');
$this->_testdeleteProfile($profileTitle);
}
$this->waitForElementPresent('_qf_Group_next-bottom');
$this->click('_qf_Group_next-bottom');
$this->waitForElementPresent('newCiviCRMProfile-bottom');
- $this->assertTrue($this->isTextPresent("Your CiviCRM Profile '$profileTitle' has been deleted."));
+ $this->assertElementContainsText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been deleted.");
}
}
// Go directly to the URL of the screen where you will be
// Add new profile.
- $this->open($this->sboxPath . 'civicrm/admin/uf/group?reset=1');
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
-
+ $this->openCiviPage('admin/uf/group', 'reset=1');
+
$this->click('newCiviCRMProfile-bottom');
$this->waitForElementPresent('_qf_Group_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
//check for profile create
- $this->assertTrue($this->isTextPresent("Your CiviCRM Profile '$profileTitle' has been added. You can add fields to this profile now"));
+ $this->assertElementContainsText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
// Get profile id (gid) from URL
$elements = $this->parseURL();
$this->click('_qf_Field_next_new-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
//check for field add
- $this->assertTrue($this->isTextPresent("Your CiviCRM Profile Field 'Last Name' has been saved to '$profileTitle'."));
- $this->assertTrue($this->isTextPresent("You can add another profile field."));
-
+ $this->assertElementContainsText('crm-notification-container', "Your CiviCRM Profile Field 'Last Name' has been saved to '$profileTitle'.");
+ $this->assertElementContainsText('crm-notification-container', 'You can add another profile field.');
+
// Add Email field.
$this->click('field_name[0]');
$this->select('field_name[0]', 'value=Contact');
$this->click('_qf_Field_next_new-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
//check for field add
- $this->assertTrue($this->isTextPresent("Your CiviCRM Profile Field 'Email' has been saved to '$profileTitle'."));
- $this->assertTrue($this->isTextPresent("You can add another profile field."));
+ $this->assertElementContainsText('crm-notification-container', "Your CiviCRM Profile Field 'Email' has been saved to '$profileTitle'.");
+ $this->assertElementContainsText('crm-notification-container', 'You can add another profile field.');
// Add Sample Custom Field.
$this->click('field_name[0]');
// Select Custom option
$this->click('CIVICRM_QFID_Edu_2');
$this->click('_qf_Edit_next');
- $this->isTextPresent('Thank you. Your information has been saved.');
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+
+ $this->assertElementContainsText('css=span.msg-text', 'Your information has been saved.');
// Search Contact via profile.
$this->waitForElementPresent("xpath=//div[@id='crm-container']//div/a[text()='ยป Back to Listings']");
// Select Custom option
$this->click('CIVICRM_QFID_Edu_2');
$this->click('_qf_Search_refresh');
+ $this->waitForPageToLoad($this->getTimeoutMsec());
// Verify Data.
- $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td[2][text()='$lastName']");
- $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td[3][text()='$lastName']");
- $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td[4][text()='jhon@$lastName.com']");
- $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td[5][text()='Education']");
+ $this->assertTrue($this->isElementPresent("xpath=//table/tbody/tr[2]/td[2][text()='$lastName']"));
+ $this->assertTrue($this->isElementPresent("xpath=//table/tbody/tr[2]/td[3][text()='$lastName']"));
+ $this->assertTrue($this->isElementPresent("xpath=//table/tbody/tr[2]/td[4][text()='jhon@$lastName.com']"));
+ $this->assertTrue($this->isElementPresent("xpath=//table/tbody/tr[2]/td[5][text()='Education']"));
// Go back to Profile fields admin
- $this->open($this->sboxPath . 'civicrm/admin/uf/group/field?reset=1&action=browse&gid=' . $profileId);
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('admin/uf/group/field', "reset=1&action=browse&gid=$profileId");
// Edit first profile field
$this->waitForElementPresent("xpath=//table/tbody/tr[1]/td[9]");
$this->assertTrue($this->isElementPresent("visibility"), 'Visibility field not present when editing existing profile field.');
$this->click("xpath=//tr[@id='profile_visibility']/td[1]/a");
$this->waitForElementPresent("xpath=//div[@id='crm-notification-container']/div/div[2]/p[2]");
- $this->assertTrue($this->isTextPresent("Is this field hidden from other users"));
+ $this->assertElementContainsText('crm-notification-container', 'Is this field hidden from other users');
$this->select('visibility', 'value=Public Pages and Listings');
}
-}
-
-
+}
\ No newline at end of file
$this->webtestAddContact($firstName, "Anderson", $emailId);
// Go directly to the URL of the screen that you will be testing (New Tag).
- $this->open($this->sboxPath . "civicrm/report/contact/summary?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_Summary_submit");
+ $this->openCiviPage('report/contact/summary', 'reset=1', '_qf_Summary_submit' );
// enable email field
$this->click("fields[email]");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is filter statistics present?
- $this->assertTrue($this->isTextPresent("Contains $firstName"), "Statistics did not found!");
-
+ $this->assertElementContainsText("xpath=//tr/th[@class='statistics'][text()='Contact Name']/../td", "Contains $firstName", "Statistics did not found!");
+
// Is Contact Name present in result?
- $this->assertTrue($this->isTextPresent($displayName), "Contact Name did not found!");
+ $this->assertElementContainsText('css=td.crm-report-civicrm_contact_sort_name', $displayName, "Contact Name did not found!");
// Is email Id present on result?
- $this->assertTrue($this->isTextPresent($emailId), "Email did not found!");
-
+ $this->assertElementContainsText('css=td.crm-report-civicrm_email_email', $emailId, "Email did not found!");
+
// check criteria
$this->click("css=div.crm-report_criteria-accordion div.crm-accordion-header");
$this->waitForElementPresent("sort_name_value");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Open report list
- $this->open($this->sboxPath . "civicrm/report/list?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
-
+ $this->openCiviPage('report/list', 'reset=1');
+
// Is report is resent in list?
- $this->assertTrue($this->isTextPresent($reportName));
+ $this->assertElementContainsText('css=table.report-layout', $reportName);
// Visit report
$this->click("link=$reportName");
$this->waitForPageToLoad($this->getTimeoutMsec());
- // Is filter statistics present?
- $this->assertTrue($this->isTextPresent("Contains $firstName"), "Statistics did not found!");
+ // Is filter statistics present?
+ $this->assertElementContainsText("xpath=//tr/th[@class='statistics'][text()='Contact Name']/../td", "Contains $firstName", "Statistics did not found!");
+
// Is Contact Name present in result?
- $this->assertTrue($this->isTextPresent($displayName), "Contact Name did not found!");
+ $this->assertElementContainsText('css=td.crm-report-civicrm_contact_sort_name', $displayName, "Contact Name did not found!");
// Is email Id present on result?
- $this->assertTrue($this->isTextPresent($emailId), "Email did not found!");
+ $this->assertElementContainsText('css=td.crm-report-civicrm_email_email', $emailId, "Email did not found!");
// check report criteria
$this->click("css=div.crm-report_criteria-accordion div.crm-accordion-header");
$this->webtestLogin();
// now create new donar detail report instance
- $this->open($this->sboxPath . "civicrm/report/contribute/detail?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_Detail_submit");
-
+ $this->openCiviPage('report/contribute/detail', 'reset=1', '_qf_Detail_submit');
+
// preview result
$this->click("_qf_Detail_submit");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForPageToLoad($this->getTimeoutMsec());
// Open report list
- $this->open($this->sboxPath . "civicrm/report/list?reset=1");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->openCiviPage('report/list', 'reset=1');
// Is report is resent in list?
- $this->assertTrue($this->isTextPresent($reportName));
+ $this->assertElementContainsText('css=div#Contribute > table.report-layout', $reportName);
// Visit report
$this->click("link=$reportName");
//Is greater than or equal to 100
//check for criteria
- $this->assertTrue($this->isTextPresent("Is greater than or equal to 10"), "Criteria is not selected");
+ $this->assertElementContainsText('css=table.statistics-table', "Is greater than or equal to 10", "Criteria is not selected");
//click on next link
- $this->click("_qf_Detail_submit_print");
+ $this->click("_qf_Detail_submit_save");
$this->waitForPageToLoad($this->getTimeoutMsec());
// check if criteria still exits
- $this->assertTrue($this->isTextPresent("Is greater than or equal to 10"), "Criteria is not selected");
+ $this->assertElementContainsText('css=table.statistics-table', "Is greater than or equal to 10", "Criteria is not selected");
}
-}
-
-
+}
\ No newline at end of file