Webtest Fix
authorJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Wed, 3 Sep 2014 13:24:48 +0000 (18:54 +0530)
committerJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Wed, 3 Sep 2014 13:24:48 +0000 (18:54 +0530)
tests/phpunit/WebTest/Admin/CustomAddTest.php
tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php
tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php
tests/phpunit/WebTest/Event/PricesetMaxCountTest.php
tests/phpunit/WebTest/Import/ContactCustomDataTest.php
tests/phpunit/WebTest/Import/CustomDataTest.php

index 7336aebf15429bab436463b5c9ba687da345332c..fb0c220989f9594d72866fdf0ed77d5d5baed267 100644 (file)
@@ -51,15 +51,19 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase {
     $this->click("//option[@value='Contact']");
     $this->click("//form[@id='Group']/div[2]/div[3]/span[1]/input");
     $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent('newCustomField');
 
     //Is custom group created?
     $this->waitForText('crm-notification-container', "Your custom field set '$customGroupTitle' has been added. You can add custom fields now.");
+
     //add custom field - alphanumeric text
+    $this->click('newCustomField');
+    $this->waitForElementPresent('_qf_Field_cancel-bottom');
     $textFieldLabel = 'test_text_field' . substr(sha1(rand()), 0, 3);
     $this->click("header");
     $this->type("label", $textFieldLabel);
     $this->click("_qf_Field_next_new-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent('_qf_Field_cancel-bottom');
     $this->click("data_type[0]");
     $this->select("data_type[0]", "value=0");
     $this->click("//option[@value='0']");
@@ -98,7 +102,7 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase {
 
     //clicking save
     $this->click("_qf_Field_next_new-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent('_qf_Field_cancel-bottom');
 
     //create another custom field - Number Radio
     $this->click("data_type[0]");
@@ -130,8 +134,8 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase {
     $this->click("is_searchable");
 
     //clicking save
-    $this->click("_qf_Field_next-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->click("_qf_Field_done-bottom");
+    $this->waitForElementPresent('newCustomField');
 
     //On New Individual contact form
     $this->openCiviPage("contact/add", "ct=Individual&reset=1");
index a9a0110f543a507c81e132eea2308dbc230ccf6d..d5d0d8ab19d873c268884274bb017ed9a0b8724f 100644 (file)
@@ -92,9 +92,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
     $this->type("description", "This is a test campaign");
 
     // include groups for the campaign
-    $this->addSelection("includeGroups-f", "label=$groupName");
-    $this->click("//option[@value=4]");
-    $this->click("add");
+    $this->multiselect2("includeGroups", array("$groupName", "Advisory Board"));
 
     // fill the end date for campaign
     $this->webtestFillDate("end_date", "+1 year");
@@ -108,8 +106,8 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
 
     $this->waitForText('crm-notification-container', "Campaign $title");
 
-    $this->waitForElementPresent("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
-    $id = (int) $this->getText("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
+    $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
+    $id = (int) $this->getText("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]");
 
     $this->onlineParticipantAddTest($campaignTitle, $id);
   }
@@ -197,6 +195,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
     $this->type("address_1_street_address", $streetAddress);
     $this->type("address_1_city", "San Francisco");
     $this->type("address_1_postal_code", "94117");
+    $this->select('address_1_country_id', 'United States');
     $this->select("address_1_state_province_id", "value=1004");
     $this->type("email_1_email", "info@civicrm.org");
 
@@ -249,13 +248,14 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
     $this->click("link=Online Registration");
     $this->waitForElementPresent("_qf_Registration_upload-bottom");
 
-    $this->check("is_online_registration");
+    $this->click("is_online_registration");
     $this->assertChecked("is_online_registration");
     if ($multipleRegistrations) {
       $this->check("is_multiple_registrations");
       $this->assertChecked("is_multiple_registrations");
     }
 
+    $this->click('intro_text-plain');
     $this->fillRichTextField("intro_text", $registerIntro);
 
     // enable confirmation email
index 97b9da09016ab53a2f17de943d8a8e3c4c9d052b..71c68e7bb9bd5a3ea56cb79e925f01aceae31d45 100644 (file)
@@ -280,7 +280,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
 
       $this->type("label", $field3);
       $this->check("is_searchable");
-      $this->click("_qf_Field_next-bottom");
+      $this->click("_qf_Field_done-bottom");
       $this->waitForPageToLoad($this->getTimeoutMsec());
 
       // get id of custom fields
@@ -440,9 +440,9 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
 
     $cusId_1 = 'custom_' . $customId[0] . '_1';
     $cusId_2 = 'custom_' . $customId[1] . '_1';
-    $this->clickLink("css=#{$customGrp1} a.button");
+    $this->clickLink("css=#{$customGrp1} a.button", '_qf_CustomData_cancel-bottom', FALSE);
 
-    $this->assertElementContainsText("page-title", "Edit $customGrp1");
+    $this->assertElementContainsText("xpath=//span[@class='ui-dialog-title']", "Edit $customGrp1");
 
     $custFname = "Miky" . substr(sha1(rand()), 0, 7);
     $custLname = "Kristy" . substr(sha1(rand()), 0, 7);
index eb664fdb552eae5c85f1c72d3b5dd15a7cb6965b..5d7845cfa11ff0755db44178d38fea468f0d3eb4 100644 (file)
@@ -1049,7 +1049,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $this->type('help_pre', 'This is test priceset.');
 
     $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
-    $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom');
+    $this->clickLink('_qf_Set_next-bottom', 'newPriceField');
   }
 
   /**
@@ -1058,6 +1058,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
   function _testAddPriceFields($fields) {
     $fieldCount = count($fields);
     $count = 1;
+    $this->click('newPriceField');
+    $this->waitForElementPresent('label');
     foreach ($fields as $label => $field) {
       $this->type('label', $label);
       $this->select('html_type', "value={$field['type']}");
@@ -1100,7 +1102,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
       else {
         $this->click('_qf_Field_next-bottom');
       }
-      $this->waitForPageToLoad($this->getTimeoutMsec());
+      $this->waitForText('crm-notification-container', "Price Field '$label' has been saved.");
 
       $count++;
     }
index 3bc1a317ea2a0321a6c6878dfb902660eaf68a4a..0010dd2dc5cd6421a9b77d2cc351362136fd5181 100644 (file)
@@ -162,10 +162,12 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase {
     $this->select('extends[0]', "value=Contact");
     $this->click("//option[@value='Contact']");
     $this->click('_qf_Group_next-bottom');
-    $this->waitForElementPresent('_qf_Field_cancel-bottom');
+    $this->waitForElementPresent('newCustomField');
 
     //Is custom group created?
     $this->waitForText('crm-notification-container', $customGroupTitle);
+    $this->click('newCustomField');
+    $this->waitForElementPresent('_qf_Field_cancel-bottom');
     $gid = $this->urlArg('gid');
 
     // create another custom field - Date
@@ -182,10 +184,10 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase {
     $this->click("is_searchable");
 
     // clicking save
-    $this->click('_qf_Field_next-bottom');
+    $this->click('_qf_Field_done-bottom');
     $this->waitForElementPresent('newCustomField');
 
-    $this->assertTrue($this->isTextPresent("Custom field '{$customField}' has been saved."));
+    $this->waitForText('crm-notification-container', "Custom field '{$customField}' has been saved.");
     $customFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField']/../../td[8]/span/a@href"));
     $customFieldId = $customFieldId[1];
 
index 78282b0d99bde581e39dd99be7e424c88cde9f2f..2e5f2859dfd24bfbbe967f2890490cb6819a3f1e 100644 (file)
@@ -173,10 +173,12 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase {
     $this->select("extends[0]", "value=Contact");
     $this->click("//option[@value='Contact']");
     $this->click('_qf_Group_next-bottom');
-    $this->waitForElementPresent('_qf_Field_cancel-bottom');
+    $this->waitForElementPresent('newCustomField');
 
     //Is custom group created?
     $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."));
+    $this->click('newCustomField');
+    $this->waitForElementPresent('_qf_Field_cancel-bottom');
     $url = explode('gid=', $this->getLocation());
     $gid = $url[1];
 
@@ -207,11 +209,12 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase {
     $this->click("is_searchable");
 
     // clicking save
-    $this->click('_qf_Field_next-bottom');
+    $this->click('_qf_Field_done-bottom');
     $this->waitForElementPresent('newCustomField');
 
-    $this->assertTrue($this->isTextPresent("Custom field '{$dateFieldLabel}' has been saved."));
+    $this->waitForText('crm-notification-container', "Custom field '{$dateFieldLabel}' has been saved.");
 
+    $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$dateFieldLabel']");
     $dateFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$dateFieldLabel']/../../td[8]/span/a@href"));
     $dateFieldId = $dateFieldId[1];
 
@@ -247,7 +250,7 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase {
     $this->click("is_searchable");
 
     //clicking save
-    $this->click("_qf_Field_next");
+    $this->click("_qf_Field_done");
     $this->waitForElementPresent('newCustomField');
 
     //Is custom field created
@@ -288,7 +291,7 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase {
     $this->click("is_searchable");
 
     // clicking save
-    $this->click('_qf_Field_next-bottom');
+    $this->click('_qf_Field_done-bottom');
     $this->waitForElementPresent('newCustomField');
     $this->waitForText("crm-notification-container", "Custom field '{$multiSelectLabel}' has been saved.");
     $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$multiSelectLabel']/parent::td/parent::tr/");
@@ -313,10 +316,11 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase {
     $this->click("is_searchable");
 
     // clicking save
-    $this->click('_qf_Field_next-bottom');
+    $this->click('_qf_Field_done-bottom');
     $this->waitForElementPresent('newCustomField');
 
     $this->waitForText("crm-notification-container", "Custom field '{$contactReferenceLabel}' has been saved.");
+    $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$contactReferenceLabel']/parent::td/parent::tr/");
     $contactReferenceFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$contactReferenceLabel']/parent::td/parent::tr/td[8]/span/a@href"));
     $contactReferenceFieldId = $contactReferenceFieldId[1];