From 201e298c44e7e853a7d6585ee80debdc57f27abc Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 14 Mar 2014 15:48:05 +0530 Subject: [PATCH] Select2 handling for Webtest --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index b892411438..e3738058e3 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -501,19 +501,14 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** */ function webtestNewDialogContact($fname = 'Anthony', $lname = 'Anderson', $email = 'anthony@anderson.biz', - $type = 4, $selectId = 'profiles_1', $row = 1, $prefix = '') { + $type = 4, $selectId = 's2id_contact_id', $row = 1, $prefix = '') { // 4 - Individual profile // 5 - Organization profile // 6 - Household profile - $this->select($selectId, "value={$type}"); + $profile = array('4' => 'New Individual', '5' => 'New Organisation', '6' => 'New Household'); + $this->clickAt("xpath=//div[@id='$selectId']/a"); + $this->click("xpath=//li[@class='select2-no-results']//a[contains(text(),' $profile[$type]')]"); - // create new contact using dialog - if (!$prefix) { - $this->waitForElementPresent("css=div#contact-dialog-{$row}"); - } - else { - $this->waitForElementPresent("css=div#contact-dialog-{$prefix}_{$row}"); - } $this->waitForElementPresent('_qf_Edit_next'); switch ($type) { @@ -536,10 +531,12 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { // Is new contact created? if ($lname) { - $this->assertTrue($this->isTextPresent("$fname $lname has been created."), "Status message didn't show up after saving!"); + $this->waitForText("xpath=//div[@id='$selectId']","$lname, $fname"); + $this->assertTrue($this->isTextPresent("$lname, $fname"), "Status message didn't show up after saving!"); } else { - $this->assertTrue($this->isTextPresent("$fname has been created."), "Status message didn't show up after saving!"); + $this->waitForText("xpath=//div[@id='$selectId']","$fname"); + $this->assertTrue($this->isTextPresent("$fname"), "Status message didn't show up after saving!"); } } -- 2.25.1