From c41b442d39cd87f3828e1266b3dc6843b9878bb4 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 13 Sep 2014 21:40:53 -0400 Subject: [PATCH] Webtest fixes --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 10 ++++++++-- tests/phpunit/WebTest/Contact/AdvancedSearchTest.php | 6 +----- tests/phpunit/WebTest/Contact/ContactTagTest.php | 5 +---- tests/phpunit/WebTest/Contact/SearchTest.php | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 65889ae620..785feee753 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -2134,6 +2134,13 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->assertElementContainsText("xpath=//*[@id='$fieldid']/preceding-sibling::div[1]/", $value); } } + + /** + * Wait for unobtrusive status message as set by CRM.status + */ + function waitForStatusMsg() { + $this->waitForElementPresent("css=.crm-status-box-outer.status-success"); + } /** * function to enable or disable Pop-ups via Display Preferences @@ -2150,7 +2157,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { else { $this->assertNotChecked('ajaxPopupsEnabled'); } - $this->click("_qf_Display_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Display_next-bottom"); } } diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index 9d5ad0fb94..7685a3b64c 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -65,11 +65,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->click("css=li#tab_tag a"); $this->waitForElementPresent("css=div#tagtree"); $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]"); - $this->waitForElementPresent("css=.success"); - - // is status message correct? - $this->waitForTextPresent("Saved"); - $this->waitForText('crm-notification-container', "Saved"); + $this->waitForStatusMsg(); // go to event tab and register for event ( auto add activity and contribution ) $this->click("css=li#tab_participant a"); diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index dcf4d0ec2d..41ee7ad46c 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -73,10 +73,7 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { // check tag we have created $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]"); - $this->waitForElementPresent("css=.success"); - - // Is status message correct? - $this->waitForText('crm-notification-container', "Saved"); + $this->waitForStatusMsg(); } function testTagSetContact() { diff --git a/tests/phpunit/WebTest/Contact/SearchTest.php b/tests/phpunit/WebTest/Contact/SearchTest.php index fa51272095..4972237332 100644 --- a/tests/phpunit/WebTest/Contact/SearchTest.php +++ b/tests/phpunit/WebTest/Contact/SearchTest.php @@ -126,7 +126,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // select tag $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]"); - $this->waitForElementPresent("css=.success"); + $this->waitForStatusMsg(); // visit contact search page $this->openCiviPage("contact/search", "reset=1"); -- 2.25.1