ParticipantMaxCountTest fix
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 30 Sep 2014 06:55:23 +0000 (12:25 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 30 Sep 2014 06:55:23 +0000 (12:25 +0530)
tests/phpunit/WebTest/Event/PricesetMaxCountTest.php

index 3cdea2324ae5aad39ece26ab4beec0396e05e091..26cfd4316af93fbc103412a9c8e73e164dd96f11 100644 (file)
@@ -117,35 +117,28 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $pricesetLoc = $this->getLocation();
 
     // get text field Id.
-    $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
-    $textFieldId = explode('&', $textFieldId[0]);
-    $textFieldId = explode('=', $textFieldId[3]);
-    $textFieldId = $textFieldId[1];
+    $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+    $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+    $textFieldId = $this->urlArg('fid', $textFieldIdURL);
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // get select field id
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
     $selectFieldLoc = $this->getLocation();
-    $selectFieldId = $this->urlArg('fid');
+    $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+    $selectFieldId = $this->urlArg('fid', $selectFieldURL);
 
     // get select field ids
     // get select field option1
-    $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
-    $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
-    $selectFieldOp1 = $selectFieldOp1[1];
-
-    $this->open($selectFieldLoc);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
 
     // get select field option2
-    $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
-    $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
-    $selectFieldOp2 = $selectFieldOp2[1];
+    $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
@@ -322,35 +315,28 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $pricesetLoc = $this->getLocation();
 
     // get text field Id.
-    $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
-    $textFieldId = explode('&', $textFieldId[0]);
-    $textFieldId = explode('=', $textFieldId[3]);
-    $textFieldId = $textFieldId[1];
+    $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+    $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+    $textFieldId = $this->urlArg('fid', $textFieldIdURL);
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // get select field id
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
     $selectFieldLoc = $this->getLocation();
-    $selectFieldId = $this->urlArg('fid');
+    $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+    $selectFieldId = $this->urlArg('fid', $selectFieldURL);
 
     // get select field ids
     // get select field option1
-    $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
-    $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
-    $selectFieldOp1 = $selectFieldOp1[1];
-
-    $this->open($selectFieldLoc);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
 
     // get select field option2
-    $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
-    $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
-    $selectFieldOp2 = $selectFieldOp2[1];
+    $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
@@ -521,35 +507,28 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $pricesetLoc = $this->getLocation();
 
     // get text field Id.
-    $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
-    $textFieldId = explode('&', $textFieldId[0]);
-    $textFieldId = explode('=', $textFieldId[3]);
-    $textFieldId = $textFieldId[1];
+    $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+    $textFieldURL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+    $textFieldId = $this->urlArg('fid', $textFieldURL);
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // get select field id
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
     $selectFieldLoc = $this->getLocation();
-    $selectFieldId = $this->urlArg('fid');
+    $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+    $selectFieldId = $this->urlArg('fid', $selectFieldURL);
 
     // get select field ids
     // get select field option1
-    $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
-    $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
-    $selectFieldOp1 = $selectFieldOp1[1];
-
-    $this->open($selectFieldLoc);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
 
     // get select field option2
-    $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
-    $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
-    $selectFieldOp2 = $selectFieldOp2[1];
+    $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
@@ -820,35 +799,28 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $pricesetLoc = $this->getLocation();
 
     // get text field Id.
-    $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href"));
-    $textFieldId = explode('&', $textFieldId[0]);
-    $textFieldId = explode('=', $textFieldId[3]);
-    $textFieldId = $textFieldId[1];
+    $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
+    $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
+    $textFieldId = $this->urlArg('fid', $textFieldIdURL);
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // get select field id
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
     $selectFieldLoc = $this->getLocation();
-    $selectFieldId = $this->urlArg('fid');
+    $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
+    $selectFieldId = $this->urlArg('fid', $selectFieldURL);
 
     // get select field ids
     // get select field option1
-    $selectFieldOp1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp1 = explode('&', $selectFieldOp1[0]);
-    $selectFieldOp1 = explode('=', $selectFieldOp1[2]);
-    $selectFieldOp1 = $selectFieldOp1[1];
-
-    $this->open($selectFieldLoc);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
 
     // get select field option2
-    $selectFieldOp2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href"));
-    $selectFieldOp2 = explode('&', $selectFieldOp2[0]);
-    $selectFieldOp2 = explode('=', $selectFieldOp2[2]);
-    $selectFieldOp2 = $selectFieldOp2[1];
+    $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
+    $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);