From 03ee12200840c6fccd8864f787ffbbd4d7840784 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Sun, 14 Sep 2014 22:32:56 -0400 Subject: [PATCH] CRM-15197 - Fixes for WebTest_Contact_InlineFieldsEditTest::testAddAndEditField ---------------------------------------- * CRM-15197: https://issues.civicrm.org/jira/browse/CRM-15197 --- .../WebTest/Contact/InlineFieldsEditTest.php | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php index 1a8200ea0e..37fe9b4a92 100644 --- a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php +++ b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php @@ -42,6 +42,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { $firstName = 'WebTest' . substr(sha1(rand()), 0, 7); $lastName = 'InlineFieldsEdit' . substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName, $lastName); + $contactId = $this->urlArg('cid'); $this->waitForElementPresent('css=.crm-inline-edit-container.crm-edit-ready'); // Set Communication Prefs @@ -139,9 +140,14 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { $this->waitForTextPresent('required'); // Share address with a new org $this->click('address[2][use_shared_address]'); - $this->select('profiles_2', 'label=New Organization'); $orgName = 'Test Org Inline' . substr(sha1(rand()), 0, 7); - $this->waitForElementPresent('css=#contact-dialog-2 form'); + + // create new organization with dialog + $this->clickAt("xpath=//div[@id='s2id_address_2_master_contact_id']/a"); + $this->click("xpath=//li[@class='select2-no-results']//a[contains(text(),' New Organization')]"); + $this->waitForElementPresent("css=div#crm-profile-block"); + $this->waitForElementPresent("_qf_Edit_next"); + $this->type('organization_name', $orgName); $this->type('street_address-1', 'Test Org Street'); $this->type('city-1', 'Test Org City'); @@ -179,7 +185,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { // Try an invalid email $this->inlineEdit('crm-email-content', array( 'email_2_email' => 'invalid@monkey,com', - ), 'error'); + ), 'errorJs'); // Delete email $this->inlineEdit('crm-email-content', array( @@ -192,7 +198,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { 'css=#crm-website-content a.add-more-inline' => TRUE, 'website_1_url' => 'http://example.com', 'website_2_url' => 'something.wrong', - ), 'error'); + ), 'errorJs'); // Correct invalid url and add a third website $this->inlineEdit('crm-website-content', array( @@ -214,7 +220,9 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { 'first_name' => 'NewName', 'prefix_id' => array('Mr.'), )); - // Page title should be updated with new name + $this->assertElementContainsText('css=div.crm-summary-display_name', "Mr. NewName $lastName"); + // Page title should be updated with new name on reload + $this->openCiviPage('contact/view', "reset=1&cid=$contactId", "crm-record-log"); $this->assertElementContainsText('css=title', "Mr. NewName $lastName"); } @@ -271,7 +279,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { } } $this->click("css=#$block input.crm-form-submit"); - if ($valid !== 'error') { + if ($valid !== 'error' && $valid !='errorJs') { // Verify the form saved $this->waitForElementPresent("css=#$block > .crm-inline-block-content"); $validate = FALSE; @@ -324,8 +332,14 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { } // Verify there was a form error else { - $this->waitForElementPresent('css=#crm-notification-container .error.ui-notify-message'); - $this->click('css=#crm-notification-container .error .ui-notify-cross'); + switch($valid) { + case 'errorJs': + $this->waitForElementPresent('css=label.error'); + break; + default: + $this->waitForElementPresent('css=#crm-notification-container .error.ui-notify-message'); + $this->click('css=#crm-notification-container .error .ui-notify-cross'); + } } } } -- 2.25.1