Webtest Fixes
authorRohan Katkar <rohan.katkar@webaccessglobal.com>
Wed, 10 Sep 2014 15:18:31 +0000 (20:48 +0530)
committerRohan Katkar <rohan.katkar@webaccessglobal.com>
Wed, 10 Sep 2014 15:18:31 +0000 (20:48 +0530)
tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php
tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php
tests/phpunit/WebTest/Case/AddCaseTypeTest.php

index d5d0d8ab19d873c268884274bb017ed9a0b8724f..7e9e1a9df51223783379fc9473dd3f8ff4f702db 100644 (file)
@@ -192,7 +192,9 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase
 
     // Fill in address fields
     $streetAddress = "100 Main Street";
+    $this->waitForElementPresent('address_1_street_address');
     $this->type("address_1_street_address", $streetAddress);
+    $this->waitForElementPresent('address_1_city');
     $this->type("address_1_city", "San Francisco");
     $this->type("address_1_postal_code", "94117");
     $this->select('address_1_country_id', 'United States');
index 8402f226d6ef2e9b52c30221d1d6034822cb5438..5b51d103ff8c990191d3a52664f5fbffc4ba7cd9 100644 (file)
@@ -79,19 +79,19 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->webtestLogin();
 
     $this->openCiviPage("campaign/add", "reset=1", "_qf_Campaign_upload-bottom");
-
+    $this->waitForElementPresent('title');
     $this->type("title", "Campaign $title");
 
     // select the campaign type
+    $this->waitForElementPresent('campaign_type_id');
     $this->select("campaign_type_id", "value=2");
 
     // fill in the description
     $this->type("description", "This is a test campaign");
 
     // include groups for the campaign
-    $this->addSelection("includeGroups-f", "label=$groupName");
+    $this->addSelection("includeGroups", "label=$groupName");
     $this->click("//option[@value=4]");
-    $this->click("add");
 
     // fill the end date for campaign
     $this->webtestFillDate("end_date", "+1 year");
@@ -120,6 +120,9 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // add a custom field to the custom group
+    $this->waitForElementPresent('newCustomField');
+    $this->click('newCustomField');
+    $this->waitForElementPresent('label');
     $this->type("label", "Field $title");
 
     $this->select("data_type[1]", "value=Radio");
@@ -134,7 +137,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->type("option_value_2", "2");
 
     // save the custom field
-    $this->click("_qf_Field_next-bottom");
+    $this->click("_qf_Field_done-bottom");
 
     $this->waitForElementPresent("newCustomField");
     $this->waitForText('crm-notification-container', "$title");
@@ -148,16 +151,17 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     // save the profile
     $this->click("_qf_Group_next-bottom");
 
-    $this->waitForElementPresent("_qf_Field_next-bottom");
-    $this->waitForText('crm-notification-container', "$title");
+    $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/div[2]/a/span");
+    $this->click("xpath=//div[@id='crm-main-content-wrapper']/div/div[2]/a/span");
 
     // add a profile field for activity
+    $this->waitForElementPresent('field_name[0]');
     $this->select("field_name[0]", "value=Activity");
     $this->waitForElementPresent("field_name[1]");
     $this->select("field_name[1]", "label=Field $title :: Group $title");
 
-    $this->click("_qf_Field_next-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[1]/span[2]");
+    $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[1]/span[2]");
     $this->waitForText('crm-notification-container', "$title");
 
     // create a survey
@@ -210,11 +214,9 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->select("campaign_survey_id", "label=Survey $title");
 
     $this->click("_qf_Search_refresh");
-
-    $this->waitForElementPresent("Go");
-    $this->click("CIVICRM_QFID_ts_all_4");
+    $this->waitForElementPresent('toggleSelect');
+    $this->click('toggleSelect');
     $this->select('task', "Reserve Respondents");
-    $this->click("Go");
 
     $this->waitForElementPresent("_qf_Reserve_done_reserve-bottom");
     $this->click("_qf_Reserve_done_reserve-bottom");
@@ -223,26 +225,24 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
 
     // Interview Respondents
     $this->openCiviPage("survey/search", "reset=1&op=interview", "_qf_Search_refresh");
-
     // search for the respondents
+    $this->waitForElementPresent('campaign_survey_id');
     $this->select("campaign_survey_id", "label=Survey $title");
-
     $this->click("_qf_Search_refresh");
 
-    $this->waitForElementPresent("Go");
-    $this->click("CIVICRM_QFID_ts_all_4");
-    $this->click("Go");
-
+    $this->waitForElementPresent('toggleSelect');
+    $this->click('toggleSelect');
+    $this->select('task', "Record Survey Responses");
     $this->waitForElementPresent("_qf_Interview_cancel_interview");
 
     $this->click("CIVICRM_QFID_1_2");
-    $this->select("css=#voterRecords .odd .result select", "value=Label $title 1");
-    $this->click("css=#voterRecords .odd td a");
+    $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/select","value=Label $title 1");
+    $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[9]/a");
 
     $this->click("CIVICRM_QFID_2_8");
-    $this->select("css=#voterRecords .even .result select", "value=Label $title 2");
-    $this->click("css=#voterRecords .even td a");
 
+    $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/select","value=Label $title 2");
+    $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[9]/a");
     $this->click("_qf_Interview_cancel_interview");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
@@ -269,15 +269,12 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->select("campaign_survey_id", "label=Survey $title");
 
     $this->click("_qf_Search_refresh");
-
-    $this->waitForElementPresent("Go");
-    $this->click("CIVICRM_QFID_ts_all_4");
+    $this->waitForElementPresent('toggleSelect');
+    $this->click('toggleSelect');
+    $this->waitForElementPresent('task');
     $this->select('task', "Reserve Respondents");
-    $this->click("Go");
-
     $this->waitForElementPresent("_qf_Reserve_done_reserve-bottom");
     $this->click("_qf_Reserve_done_reserve-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "1 Contact\(s\) have been reserved");
 
     // Release Respondents
@@ -287,13 +284,12 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     $this->select("campaign_survey_id", "label=Survey $title");
 
     $this->click("_qf_Search_refresh");
-
-    $this->waitForElementPresent("Go");
-    $this->click("xpath=id('mark_x_$id')");
-    $this->click("CIVICRM_QFID_ts_sel_2");
+    $this->waitForElementPresent('toggleSelect');
+    $this->click('toggleSelect');
+    $this->waitForElementPresent('task');
     $this->select("task", "label=Release Respondents");
-    $this->clickLink("Go", "_qf_Release_done-bottom", FALSE);
-    $this->clickLink("_qf_Release_done-bottom", 'access', FALSE);
+    $this->waitForElementPresent('_qf_Release_done-bottom');
+    $this->click("_qf_Release_done-bottom");
     $this->waitForText('crm-notification-container', "released");
 
     // check whether contact is available for reserving again
@@ -302,9 +298,10 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     // search for the respondents
     $this->select("campaign_survey_id", "label=Survey $title");
 
+    $this->waitForElementPresent('_qf_Search_refresh');
     $this->click("_qf_Search_refresh");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("1 Result"), "Result didn't show up after saving!");
+    $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]",'1 Result');
   }
 
   function testSurveyReportTest() {
index 8c15ed909a766d9a2547f6d62598de9a92b06f78..9bd7121b89f26eb538b70d8198be1b2bcec6dcd7 100644 (file)
@@ -90,8 +90,9 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase {
     $this->fireEvent('activity_details', 'focus');
     $this->fillRichTextField("activity_details", $details, 'CKEditor');
     $this->type("activity_subject", $subject);
-
+    $this->waitForElementPresent('case_type_id');
     $this->select("case_type_id", "label={$caseTypeLabel}");
+    $this->waitForElementPresent('status_id');
     $this->select("status_id", "label={$caseStatusLabel}");
 
     $this->webtestFillDate('start_date', 'now');