From 3e080337c1020aa181043fd344c471518b54587c Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 30 Sep 2014 12:25:23 +0530 Subject: [PATCH] ParticipantMaxCountTest fix --- .../WebTest/Event/PricesetMaxCountTest.php | 108 +++++++----------- 1 file changed, 40 insertions(+), 68 deletions(-) diff --git a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php index 3cdea2324a..26cfd4316a 100644 --- a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php +++ b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php @@ -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); -- 2.25.1