From fc8cb638ca47d5ee4c96d950fdc47509ec84a5d8 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Wed, 20 Apr 2016 18:52:48 +0530 Subject: [PATCH] webtest fixes --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 12 +++++++++++- tests/phpunit/WebTest/Profile/ProfileAddTest.php | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index c3cd052b7f..14cdfc8220 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -402,6 +402,16 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { return $this->settingCache[$field]; } + /** + * override this since the built in function doesn't work with the new phpunit. + * @param string $element + * @param string $text + */ + public function waitForText($element, $text) { + $this->waitForTextPresent($text); + $this->assertElementContainsText($element, $text); + } + /** * Ensures the required CiviCRM components are enabled. * @param $components @@ -1558,7 +1568,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->clickLink('_qf_Edit_upload-bottom'); // Is status message correct? - $this->waitForText('crm-notification-container', "$groupName"); + $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved."); return $groupName; } diff --git a/tests/phpunit/WebTest/Profile/ProfileAddTest.php b/tests/phpunit/WebTest/Profile/ProfileAddTest.php index 8d2485b8e9..47c14a88de 100644 --- a/tests/phpunit/WebTest/Profile/ProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileAddTest.php @@ -194,9 +194,9 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { //check the existence of the two contacts in the group $this->openCiviPage('group', 'reset=1'); $this->type('title', $groupName); - $this->click('_qf_Search_refresh'); - $this->waitForElementPresent("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); - $this->clickLink("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td[1]/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); + $this->click('title'); + $this->waitForElementPresent("xpath=//div[text() = '$groupName']/parent::td/following-sibling::td[@class='crm-group-group_links']/span/a"); + $this->clickLink("xpath=//div[text() = '$groupName']/parent::td/following-sibling::td[@class='crm-group-group_links']/span/a"); $contactEmails = array( 1 => "$lastName1, $firstName1", 2 => "$lastName2, $firstName2", -- 2.25.1