Webtests fixes
[civicrm-core.git] / tests / phpunit / CiviTest / CiviSeleniumTestCase.php
index 2d8cea4dfdbbd2e0f10b49b58c5f39e38facbdad..abe1651220672750e519bbb1fe02e723cf5aba05 100644 (file)
@@ -2504,4 +2504,36 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
     return $contact;
   }
 
+  /**
+   * Add a contact via profile
+   */
+  public function webtestAddViaCreateProfile() {
+    $this->webtestLogin();
+
+    $this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_next');
+
+    $firstName = 'Jo' . substr(sha1(rand()), 0, 4);
+    $lastName = 'Ad' . substr(sha1(rand()), 0, 7);
+
+    //contact details section
+    //fill in first name
+    $this->type("first_name", $firstName);
+
+    //fill in last name
+    $this->type("last_name", $lastName);
+
+    //address section
+    $this->type("street_address-1", "902C El Camino Way SW");
+    $this->type("city-1", "Dumfries");
+    $this->type("postal_code-1", "1234");
+    $this->assertSelected('country-1', "UNITED STATES");
+    $this->select("state_province-1", "value=1019");
+
+    // Clicking save.
+    $this->click("_qf_Edit_next");
+    $this->waitForPageToLoad($this->getTimeoutMsec());
+
+    $this->assertElementContainsText('css=.msg-text', "Your information has been saved.");
+  }
+
 }