Web Test Fix
authorjitendrapurohit <jitendra.purohit@webaccess.co.in>
Fri, 11 Apr 2014 12:20:49 +0000 (17:50 +0530)
committerjitendrapurohit <jitendra.purohit@webaccess.co.in>
Fri, 11 Apr 2014 12:20:49 +0000 (17:50 +0530)
tests/phpunit/WebTest/Event/AddPricesetTest.php
tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php
tests/phpunit/WebTest/Profile/SearchTest.php

index dbacc8e3c4819673c3e1782054142b53d17e6e08..369dc43909ccbac99d57f73335098168f889aeee 100644 (file)
@@ -234,21 +234,20 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->click('_qf_EventInfo_upload-bottom');
 
     // Wait for Location tab form to load
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent('_qf_Location_upload_done-bottom');
 
     // Go to Fees tab
     $this->click('link=Fees');
-    $this->waitForElementPresent('_qf_Fee_upload-bottom');
+    $this->waitForElementPresent('_qf_Fee_upload_done-bottom');
     $this->click('CIVICRM_QFID_1_is_monetary');
     $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
     $this->select('financial_type_id','label=Event Fee');
     $this->select('price_set_id', 'label=' . $setTitle);
 
-    $this->click('_qf_Fee_upload-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // intro text for registration page
     $registerIntro = 'Fill in all the fields below and click Continue.';
+    $this->clickLink('_qf_Fee_upload-bottom', 'link=Online Registration', FALSE);
 
     // Go to Online Registration tab
     $this->click('link=Online Registration');
@@ -265,8 +264,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->type('confirm_from_email', 'jane.doe@example.org');
 
     $this->click('_qf_Registration_upload-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForTextPresent("'Registration' information has been saved.");
+    $this->waitForTextPresent("'Online Registration' information has been saved.");
 
     // verify event input on info page
     // start at Manage Events listing
@@ -276,14 +274,16 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $eventInfoUrl = $this->getLocation();
 
+    $permissions = array("edit-1-register-for-events");
+    $this->changePermissions($permissions);
     $this->webtestLogout();
     $this->open($eventInfoUrl);
     $this->click('link=Register Now');
     $this->waitForElementPresent('_qf_Register_upload-bottom');
 
-    $this->type("xpath=//input[@class='form-text four required']", "1");
-    $this->click("xpath=//input[@class='form-radio']");
-    $this->click("xpath=//input[@class='form-checkbox']");
+    $this->type("xpath=//input[@class='four crm-form-text required']", "1");
+    $this->click("xpath=//input[@class='crm-form-radio']");
+    $this->click("xpath=//input[@class='crm-form-checkbox']");
     $this->type("first_name", "Jane");
     $lastName = "Smith" . substr(sha1(rand()), 0, 7);
     $this->type("last_name", $lastName);
@@ -328,7 +328,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
       4 => 'Evening Sessions - First Night',
     );
     foreach ($expected as $value => $label) {
-      $this->verifyText("xpath=id('ParticipantView')/div[2]/table[1]/tbody/tr[7]/td[2]/table/tbody/tr[$value]/td", $label);
+      $this->verifyText("xpath=id('ParticipantView')/div[2]/table[1]/tbody/tr[8]/td[2]/table/tbody/tr[$value]/td", $label);
     }
     // Fixme: We can't asset full string like - "Event Total: $ 590.00" as it has special char
     $this->assertStringsPresent(' 590.00');
@@ -404,8 +404,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->select('financial_type_id','label=Event Fee');
     $this->select('price_set_id', 'label=' . $setTitle);
 
-    $this->click('_qf_Fee_upload-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink('_qf_Fee_upload-bottom', 'link=Online Registration', FALSE);
 
     // intro text for registration page
     $registerIntro = 'Fill in all the fields below and click Continue.';
@@ -425,8 +424,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->type('confirm_from_email', 'jane.doe@example.org');
 
     $this->click('_qf_Registration_upload-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForTextPresent("'Registration' information has been saved.");
+    $this->waitForTextPresent("'Online Registration' information has been saved.");
 
     // verify event input on info page
     // start at Manage Events listing
@@ -447,12 +445,12 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->webtestFillAutocomplete($firstName);
 
     // Select event. Based on label for now.
-    $this->select('event_id', "label=regexp:$eventTitle");
+    $this->select2('s2id_event_id', "$eventTitle");
     // Select role
     $this->click('role_id[2]');
 
-    $this->click("xpath=//input[@class='form-radio']");
-    $this->click("xpath=//input[@class='form-checkbox']");
+    $this->click("xpath=//input[@class='crm-form-radio']");
+    $this->click("xpath=//input[@class='crm-form-checkbox']");
 
     // Choose Registration Date.
     // Using helper webtestFillDate function.
@@ -468,10 +466,10 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     // Is status message correct?
     $this->assertElementContainsText("css=#crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!");
 
-    $this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->waitForElementPresent("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
 
     //click through to the participant view screen
-    $this->click("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->click("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
     $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom');
   }
 
@@ -607,7 +605,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
         'Participant Role' => 'Attendee',
         'Status' => 'Registered',
         'Event Source' => 'Event StandaloneAddTest Webtest',
-        'Fees' => 'Event Total: $ 2,705.00',
+        'Fees' => 'Total Fee(s) Total Paid Balance $ 2,705.00',
       )
     );
     $expectedLineItems = array(
@@ -681,13 +679,16 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->clickLink('newEventTemplate');
     $this->select("template_id", "value=6");
     // Wait for event type to be filled in (since page reloads)
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("template_id");
     // Enter Event Title, Summary and Description
     $this->type('template_title', "Test Template");
+    $this->select("event_type_id", "value=4");
+    $this->select("default_role_id", "value=1");
     $this->type("title", "Test Event");
     $this->type("summary", "This is a great conference. Sign up now!");
-    $this->clickLink("_qf_EventInfo_upload-bottom");
     
+    $this->click("_qf_EventInfo_upload-bottom");
+    $this->waitForElementPresent('link=Fees');
     // Go to Fees tab
     $this->click('link=Fees');
     $this->waitForElementPresent('_qf_Fee_upload-bottom');
@@ -695,7 +696,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
     $this->select('financial_type_id','label=Event Fee');
     $this->select('price_set_id', 'label=' . $setTitle);
     $templateId = $this->urlArg('id');
-    $this->clickLink('_qf_Fee_upload-bottom');
+    $this->click('_qf_Fee_upload-bottom');
     
     //check the delete for price field
     $this->openCiviPage("admin/price/field", "reset=1&action=browse&sid={$sid}");
index 1cbee272d8650fbc59dc12448835c35273e1cb4d..350f5b4459be74a61ad4f7d961dffc8e215299a9 100644 (file)
@@ -56,10 +56,8 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     // Advanced Search by Tag
     $this->click("css=ul#civicrm-menu li.crm-Search");
     $this->click("css=ul#civicrm-menu li.crm-Advanced_Search a");
-    $this->waitForElementPresent('css=select#crmasmSelect3');
-    $this->click('crmasmSelect3');
-    $this->select('crmasmSelect3', 'label=Major Donor');
-    $this->waitForElementPresent("//ul[@id='crmasmList3']/li/span");
+    $this->waitForElementPresent('contact_tags');
+    $this->select('contact_tags', 'label=Major Donor');
     $this->click('_qf_Advanced_refresh');
     $this->waitForElementPresent('search-status');
     $this->assertText('search-status', 'Tagged IN Major Donor');
@@ -179,7 +177,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     $this->assertElementPresent("contribution_check_number");
     $this->assertTextPresent("Financial Type");
     $this->assertTextPresent("Contribution Page");
-    $this->assertElementPresent("contribution_in_honor_of");
+    $this->assertElementPresent("s2id_contribution_or_softcredits");
     $this->assertElementPresent("contribution_source");
     $this->assertTextPresent("Personal Campaign Page");
     $this->assertTextPresent("Personal Campaign Page Honor Roll");
@@ -270,7 +268,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
 
     $this->assertTextPresent("CiviCRM Profile");
     // Verify Reserved Profiles
-    $this->click("ui-id-2");
+    $this->click("ui-id-3");
     $this->assertTextPresent("New Household");
     $this->assertTextPresent("New Individual");
     $this->assertTextPresent("New Organization");
@@ -279,7 +277,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
     $this->assertTextPresent("Summary Overlay");
 
     // Verify profiles that are not reserved
-    $this->click("ui-id-1");
+    $this->click("ui-id-2");
     $this->assertTextPresent("Name and Address");
     $this->assertTextPresent("Supporter Profile");
 
index a4096feef6ea8543531f6803af881f0cfcfe347e..d5f0c3316ad07670e8aa33bf2f7e60326d52b6b1 100644 (file)
@@ -50,6 +50,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase {
     $profileTitle = 'profile_' . substr(sha1(rand()), 0, 7);
     $this->type('title', $profileTitle);
 
+    $this->click('uf_group_type_Profile');
     //click on save
     $this->click('_qf_Group_next-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -143,8 +144,9 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase {
 
     // click on save
     $this->clickLink('_qf_Field_next-bottom', "xpath=//div[@id='field_page']/div[1]/a[4]/span[text()='Use (create mode)']");
-    $this->click("xpath=//div[@id='field_page']/div[1]/a[4]/span[text()='Use (create mode)']");
 
+    $uselink = explode('?', $this->getAttribute("xpath=//*[@id='field_page']/div[1]/a[4]@href"));
+    $this->openCiviPage('profile/create', "$uselink[1]", '_qf_Edit_cancel');
     $this->waitForElementPresent('_qf_Edit_next');
     $lastName = substr(sha1(rand()), 0, 7);
 
@@ -168,7 +170,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase {
     $this->click('_qf_Edit_next');
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertElementContainsText('css=span.msg-text', 'Your information has been saved.');
+    $this->assertElementContainsText("css=span.msg-text", 'Your information has been saved.');
 
     // Search Contact via profile.
     $this->waitForElementPresent("xpath=//div[@id='crm-container']//div/a[text()='ยป Back to Listings']");
@@ -210,7 +212,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase {
 
     // Edit first profile field
     $this->waitForElementPresent("xpath=//table/tbody/tr[1]/td[9]");
-    $this->clickLink("xpath=//table/tbody/tr[1]/td[9]/span[1]/a[1]", '_qf_Field_next-bottom');
+    $this->clickLink("xpath=//table/tbody/tr[1]/td[9]/span[1]/a[1]", '_qf_Field_next-bottom', FALSE);
 
     // sleep 5 to make sure jQuery is not hiding field after page load
     // Because it tends to cause problems, all uses of sleep() must be justified in comments