webtest fixes
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Tue, 24 Sep 2013 10:40:14 +0000 (16:10 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Tue, 24 Sep 2013 10:40:14 +0000 (16:10 +0530)
tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php

index 35dd9769c82dc79dc9a79ac2a9d9411da92f911f..480625b932a7ce53789474ff563129a49dc0ebbd 100644 (file)
@@ -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;
   }