Skip to content
Snippets Groups Projects
Commit ee88fff2 authored by pratik.joshi's avatar pratik.joshi
Browse files

webtest fixes

parent bcaf9194
No related branches found
No related tags found
No related merge requests found
......@@ -207,20 +207,20 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase {
$this->assertElementContainsText('crm-container', 'No multi-record entries found');
return array($gid, $profileTitle);
}
$this->waitForElementPresent("//div[@id='crm-profile-block']/a");
$this->click("//div[@id='crm-profile-block']/a");
$this->waitForElementPresent("//a/span[contains(text(), 'Add New Record')]");
$this->click("//a/span[contains(text(), 'Add New Record')]");
$record1 = $this->_addRecords();
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->verifyText("//div[@id='browseValues']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel']));
$this->verifyText("//div[@id='browseValues']/div/div/table/tbody/tr[2]/td[1]", preg_quote($record1['text']));
$this->openCiviPage('profile/edit', "reset=1&id=$id&gid=$gid", "//div[@id='crm-profile-block']/a");
$this->click("//div[@id='crm-profile-block']/a");
$this->openCiviPage('profile/edit', "reset=1&id=$id&gid=$gid", "//a/span[contains(text(), 'Add New Record')]");
$this->click("//a/span[contains(text(), 'Add New Record')]");
$record2 = $this->_addRecords();
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->verifyText("//div[@id='browseValues']/div/div/table/tbody/tr[3]/td[1]", preg_quote($record2['text']));
// Check Max Record Limit
$this->verifyElementNotPresent("//div[@id='crm-profile-block']/a/span");
$this->verifyElementNotPresent("//a/span[contains(text(), 'Add New Record')]");
//Check for edit functionality
// Because it tends to cause problems, all uses of sleep() must be justified in comments
......@@ -230,8 +230,8 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase {
$this->click("//div[@id='browseValues']/div/div/table/tbody/tr/td[3]/span/a[text()='Edit']");
$this->waitForElementPresent("//html/body/div[5]");
$this->verifyText("//div[@id='browseValues']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel']));
$this->type("//div[@id='profile-dialog']/div/form/div[2]/div/div/div[2]/input", $recordNew['text'].'edit');
$this->click("//div[@id='profile-dialog']/div/form/div[2]/div[2]/span/input[@id='_qf_Edit_next']");
$this->type("//div[@id='profile-dialog']/div/form/div[2]/div/div[2]/input", $recordNew['text'].'edit');
$this->click("//div[@id='profile-dialog']/div/form/div[3]/span/input[@id='_qf_Edit_next']");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->verifyText("//div[@id='browseValues']/div/div/table/tbody/tr[1]/td[1]", preg_quote($recordNew['text'].'edit'));
......@@ -353,7 +353,7 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase {
function _addRecords($context = 'Edit') {
$this->waitForPageToLoad($this->getTimeoutMsec());
$params['text'] = 'text' . substr(sha1(rand()), 0, 3);
$this->type("//div[@id='crm-profile-block']/div/div/div[2]/input[@type='text']", $params['text']);
$this->type("//div[@id='crm-profile-block']/div/div[2]/input[@type='text']", $params['text']);
if ($context == 'Create') {
$params['firstname'] = 'John' . substr(sha1(rand()), 0, 3);
$this->type('first_name', $params['firstname']);
......@@ -362,8 +362,8 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase {
$params['email'] = $params['firstname'].$params['lastname'].'@exa.com';
$this->type('email-Primary', $params['email']);
}
$this->waitForElementPresent("//div[@id='crm-profile-block']/div//div/div[2]/select");
$this->select("//div[@id='crm-profile-block']/div//div/div[2]/select",'value=1');
$this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select");
$this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1');
$this->click('_qf_Edit_next');
return $params;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment