Web Test Fix
authorjitendrapurohit <jitendra.purohit@webaccess.co.in>
Wed, 2 Apr 2014 14:48:36 +0000 (20:18 +0530)
committerjitendrapurohit <jitendra.purohit@webaccess.co.in>
Wed, 2 Apr 2014 14:48:36 +0000 (20:18 +0530)
tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php
tests/phpunit/WebTest/Contact/GroupAddTest.php
tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php

index 639431602e3a3dc60c03be823d4a8eae76e450bc..84c3d68c51f92a4ab11689e597bcbbdaaf227df5 100644 (file)
@@ -115,8 +115,8 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //the civicrm messages should indicate the username is taken
-    $this->assertElementContainsText("css=#crm-notification-container", "already taken", "CiviCRM Message does not indicate the username is in user");
 
+    $this->assertElementContainsText("xpath=//span[@class = 'crm-error']", "already taken", "CiviCRM Message does not indicate the username is in user");
     //check the uf match table that no contact has been created
     $results = $this->webtest_civicrm_api("UFMatch", "get", array('contact_id' => $cid));
     $this->assertTrue($results['count'] == 0);
@@ -139,7 +139,7 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //check that that there is a password mismatch text
-    $this->assertElementContainsText("css=#crm-notification-container", "Password mismatch", "No form error given on password missmatch");
+    $this->assertElementContainsText("xpath=//table[@class='form-layout-compressed']/tbody/tr[3]/td/span[@class='crm-error']", "Password mismatch", "No form error given on password missmatch");
 
     //check that no user was created;
     $results = $this->webtest_civicrm_api("UFMatch", "get", array('contact_id' => $cid));
@@ -161,13 +161,13 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //the civicrm messages section should not indicate that a user has been created
-    $this->assertElementNotContainsText("css=#crm-notification-container", "User has been added", "CiviCRM messages say that a user was created when username left blank");
+    $this->assertElementNotContainsText("xpath=//span[@class='crm-error']", "User has been added", "CiviCRM messages say that a user was created when username left blank");
 
     //the civicrm message should say username is required
-    $this->assertElementContainsText("css=#crm-notification-container", "Username is required", "The CiviCRM messae does not indicate that the username is required");
+    $this->assertElementContainsText("xpath=//span[@class='crm-error']", "Username is required", "The CiviCRM messae does not indicate that the username is required");
 
     //the civicrm message should say password is required
-    $this->assertElementContainsText("css=#crm-notification-container", "Password is required", "The CiviCRM messae does not indicate that the password is required");
+    $this->assertElementContainsText("xpath=//table[@class='form-layout-compressed']/tbody/tr[3]/td/span[@class='crm-error']", "Password is required", "The CiviCRM messae does not indicate that the password is required");
 
     //check that no user was created;
     $results = $this->webtest_civicrm_api("UFMatch", "get", array('contact_id' => $cid));
index a11f7892528f0cf0118e240f3bf9cf74aef8ac32..695f7fcc04d4b9ac93c3ca737fc79a814227ebc4 100644 (file)
@@ -71,7 +71,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->type('title', $params['name']);
     $this->click('_qf_Search_refresh');
     $this->waitForVisible('crm-group-selector_processing');
-    $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[contains(text(), '{$params['name']}')]");
+    $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[contains(., '{$params['name']}')]");
     $createdBy = $this->getText("xpath=//table[@id='crm-group-selector']/tbody/tr/td[3]/a");
     $this->click("xpath=//table[@id='crm-group-selector']/tbody/tr/td[7]/span/a[2]");
     $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/table[2]/tbody/tr/td[2]/select");
@@ -92,11 +92,11 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->select("xpath=//select[@name='crm-group-selector_length']", '100');
     $this->waitForVisible('crm-group-selector_processing');
 
-    $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody//tr/td[contains(text(), '{$params['name']}')]");
-    $this->assertTrue($this->isElementPresent("xpath=//table[@id='crm-group-selector']/tbody//tr/td[1][text()='{$params['name']}']/following-sibling::td[2]/a[text()='{$createdBy}']"));
+    $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[contains(., '{$params['name']}')]");
+    $this->assertTrue($this->isElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[contains(., '{$params['name']}')]/following-sibling::td[2]/a[text()='{$createdBy}']"));
 
     //check link of the contact who created the group
-    $this->click("xpath=//table[@id='crm-group-selector']/tbody//tr/td[1][text()='{$params['name']}']/following-sibling::td[2]/a");
+    $this->click("xpath=//table[@id='crm-group-selector']/tbody//tr/td[1][contains(.,'{$params['name']}')]/following-sibling::td[2]/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $name = explode(',', $createdBy);
     $name1 = isset($name[1]) ? trim($name[1]) : NULL;
index 8540f169d0ec6e668a10e53376eeddd3841af081..048c91348cedcc1488a6e860f7c6d6ec757230e8 100644 (file)
@@ -44,6 +44,7 @@ class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase
     //Name of profile
     $profileTitle = 'profile_' . substr(sha1(rand()), 0, 7);
     $this->type('title', $profileTitle);
+    $this->click('uf_group_type_Profile');
 
     //Drupal user account registration option
     $this->click('CIVICRM_QFID_0_8');
@@ -113,14 +114,12 @@ class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase
 
     $this->click('_qf_Edit_next');
 
-    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // assert for subscription message
-    $this->assertElementContainsText('css=div.messages', "Your subscription request has been submitted for",
-      "Subscription message is not shown");
 
+    $this->isTextPresent("Your subscription request has been submitted for");
     //check if profile is saved
-    $this->assertElementContainsText('css=span.msg-text', 'Your information has been saved.', 'Profile is not saved');
+    $this->waitForText('crm-notification-container','Your information has been saved.');
 
     // delete the profile
     $this->openCiviPage('admin/uf/group', 'reset=1');