From 91a8b4571b328ed33bfa2cb337ebad4c362477e5 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Wed, 2 Apr 2014 20:18:36 +0530 Subject: [PATCH] Web Test Fix --- .../WebTest/Contact/CreateCmsUserFromContactTest.php | 10 +++++----- tests/phpunit/WebTest/Contact/GroupAddTest.php | 8 ++++---- .../WebTest/Profile/ProfileGroupSubscriptionTest.php | 7 +++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php b/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php index 639431602e..84c3d68c51 100644 --- a/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php +++ b/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php @@ -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)); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index a11f789252..695f7fcc04 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -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; diff --git a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php index 8540f169d0..048c91348c 100644 --- a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php @@ -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'); -- 2.25.1