Webtests and CRM test fix
[civicrm-core.git] / tests / phpunit / WebTest / Contact / SignatureTest.php
index 6a98c2653b4ead056de55545a017b911f42b5027..5967bc590a4b0e38b70a4c1c5cc927e57bc1733a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Contact_SignatureTest
+ */
 class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
 
   protected function setUp() {
@@ -34,7 +38,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
   /**
    * Test Signature in TinyMC.
    */
-  function testTinyMCE() {
+  public function testTinyMCE() {
     $this->webtestLogin();
 
     $this->openCiviPage('dashboard', 'reset=1', 'crm-recently-viewed');
@@ -50,7 +54,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
 
     $this->openCiviPage("contact/add", "reset=1&action=update&cid=$contactId");
 
-    $this->click("//tr[@id='Email_Block_1']/td[1]/div[2]/div[1]");
+    $this->click("//tr[@id='Email_Block_1']/td[1]/div[3]/div[1]");
     // HTML format message
     $signature = 'Contact Signature in html';
 
@@ -67,8 +71,8 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
 
     // Go for Ckeck Your Editor, Click on Send Mail
     $this->click("//a[@id='crm-contact-actions-link']/span");
-    //after clicking on 'Send an Email', wait for the text in tinymce editor to load
-    $this->clickLink('link=Send an Email', "xpath=//body[@id='tinymce']/p[2]");
+    // the other test checks this in a popup, we'll try it full-page here
+    $this->clickLinkSuppressPopup('link=Send an Email', "xpath=//body[@id='tinymce']/p[2]");
 
     $this->click('subject');
     $subject = 'Subject_' . substr(sha1(rand()), 0, 8);
@@ -78,7 +82,6 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
     $this->_checkSignature('html_message', $signature, 'TinyMCE');
 
     $this->click('_qf_Email_upload-top');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Go for Activity Search
     $this->_checkActivity($subject, $signature);
@@ -90,7 +93,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
   /**
    *  Test Signature in CKEditor.
    */
-  function testCKEditor() {
+  public function testCKEditor() {
     $this->webtestLogin();
 
     $this->openCiviPage('dashboard', 'reset=1', 'crm-recently-viewed');
@@ -105,7 +108,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
     $this->_selectEditor('CKEditor');
 
     $this->openCiviPage("contact/add", "reset=1&action=update&cid={$contactId}");
-    $this->click("//tr[@id='Email_Block_1']/td[1]/div[2]/div[1]");
+    $this->click("//tr[@id='Email_Block_1']/td[1]/div[3]/div[1]");
 
     // HTML format message
     $signature = 'Contact Signature in html';
@@ -122,7 +125,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
 
     // Go for Ckeck Your Editor, Click on Send Mail
     $this->click("//a[@id='crm-contact-actions-link']/span");
-    $this->clickLink('link=Send an Email', 'subject');
+    $this->clickLink('link=Send an Email', 'subject', FALSE);
 
     $this->click('subject');
     $subject = 'Subject_' . substr(sha1(rand()), 0, 7);
@@ -132,7 +135,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
     $this->_checkSignature('html_message', $signature, 'CKEditor');
 
     $this->click('_qf_Email_upload-top');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("//a[@id='crm-contact-actions-link']/span");
 
     // Go for Activity Search
     $this->_checkActivity($subject, $signature);
@@ -141,7 +144,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
   /**
    * Helper function to select Editor.
    */
-  function _selectEditor($editor) {
+  public function _selectEditor($editor) {
     $this->openCiviPage('admin/setting/preferences/display', 'reset=1');
 
     // Change editor if not already selected
@@ -156,7 +159,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
   /**
    * Helper function for Check Signature in Editor.
    */
-  function _checkSignature($fieldName, $signature, $editor) {
+  public function _checkSignature($fieldName, $signature, $editor) {
     if ($editor == 'CKEditor') {
       $this->waitForElementPresent("xpath=//div[@id='cke_{$fieldName}']//iframe");
       $this->selectFrame("xpath=//div[@id='cke_{$fieldName}']//iframe");
@@ -172,7 +175,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
   /**
    * Helper function for Check Signature in Activity.
    */
-  function _checkActivity($subject, $signature) {
+  public function _checkActivity($subject, $signature) {
     $this->openCiviPage('activity/search', 'reset=1', '_qf_Search_refresh');
 
     $this->type('activity_subject', $subject);
@@ -180,10 +183,9 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
     $this->clickLink('_qf_Search_refresh', 'Search');
 
     // View your Activity
-    $this->clickLink("xpath=id('Search')/div[3]/div/div[2]/table/tbody/tr[2]/td[9]/span/a[text()='View']", '_qf_ActivityView_next-bottom');
+    $this->clickLink("xpath=id('Search')/div[3]/div/div[2]/table/tbody/tr[2]/td[9]/span/a[text()='View']", '_qf_ActivityView_cancel-bottom', FALSE);
 
     // Is signature correct? in Activity
     $this->assertTextPresent($signature);
   }
 }
-