Merge pull request #9783 from mattwire/back_to_single_lang
[civicrm-core.git] / tests / phpunit / WebTest / Contact / EditContactTest.php
index 0dfb111839f427a4357aaae03a795b250ce6ab14..c1635e3b0cbd586ae3309885bfed6bc923207dac 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -113,4 +113,58 @@ class WebTest_Contact_EditContactTest extends CiviSeleniumTestCase {
 
   }
 
+  /**
+   * CRM-17273
+   */
+  public function testdisallowEditLocationType() {
+    $this->webtestLogin();
+
+    // create contact
+    $firstName = 'WebTest' . substr(sha1(rand()), 0, 7);
+    $lastName = 'ContactEdit' . substr(sha1(rand()), 0, 7);
+    $this->openCiviPage("contact/add", "reset=1&ct=Individual");
+    $this->waitForElementPresent('_qf_Contact_cancel-bottom');
+
+    $this->type("first_name", $firstName);
+    $this->type("last_name", $lastName);
+
+    //fill email
+    $this->type("email_1_email", substr(sha1(rand()), 0, 7) . "email1@gmail.com");
+    $this->click("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[1]/td[1]/a[text()='add']");
+    $this->waitForElementPresent('email_2_email');
+    $this->type("email_2_email", substr(sha1(rand()), 0, 7) . "email2@gmail.com");
+
+    //fill in phone  1
+    $this->type("phone_1_phone", "111113333");
+    $this->type("phone_1_phone_ext", "101");
+
+    //fill in IM
+    $this->type("im_1_name", "testYahoo");
+
+    //address section
+    $this->click("addressBlock");
+    $this->waitForElementPresent("address_1_street_address");
+    //fill in address 1
+    $this->type("address_1_street_address", "902C El Camino Way SW");
+    $this->type("address_1_city", "Dumfries");
+    $this->type("address_1_postal_code", "1234");
+
+    // Submit form
+    $this->click("_qf_Contact_upload_view-top");
+    $this->waitForPageToLoad($this->getTimeoutMsec());
+
+    // Get Contact id
+    $cid = $this->urlArg('cid');
+    $this->openCiviPage("contact/add", "reset=1&action=update&cid=$cid");
+
+    $this->waitForElementPresent('_qf_Contact_cancel-bottom');
+    $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='Email_Block_1']/td[1]/a/i");
+    $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='Email_Block_2']/td[1]/a/i");
+    $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='Phone_Block_1']/td[2]/a/i");
+    $this->waitForElementNotPresent("xpath=//div[@id='contactDetails']/table[1]/tbody/tr[@id='IM_Block_1']/td[2]/a/i");
+
+    $this->click("addressBlockId");
+    $this->waitForElementNotPresent("xpath=//div[@id='addressBlock']/div/table/tbody/tr[1]/td[1]/span[1]/a/i");
+  }
+
 }