From: jitendrapurohit Date: Tue, 29 Apr 2014 13:03:16 +0000 (+0530) Subject: Web Test Fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6acc185a00caa4c8e3bffecc206b5bb54850badf;p=civicrm-core.git Web Test Fix --- diff --git a/tests/phpunit/WebTest/Contact/AddTest.php b/tests/phpunit/WebTest/Contact/AddTest.php index 58ac49475c..f9b07abbe9 100644 --- a/tests/phpunit/WebTest/Contact/AddTest.php +++ b/tests/phpunit/WebTest/Contact/AddTest.php @@ -403,7 +403,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { //create new current employer $currentEmployer = substr(sha1(rand()), 0, 7) . "Web Access"; - $this->type('current_employer', $currentEmployer); //fill in email $this->type("email_1_email", substr(sha1(rand()), 0, 7) . "john@gmail.com"); @@ -423,10 +422,11 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->click('address[1][use_shared_address]'); // create new organization with dialog - $this->select("profiles_1", "label=New Organization"); + $this->clickAt("xpath=//div[@id='s2id_address_1_master_contact_id']/a"); + $this->click("xpath=//li[@class='select2-no-results']//a[contains(text(),' New Organization')]"); // create new contact using dialog - $this->waitForElementPresent("css=div#contact-dialog-1"); + $this->waitForElementPresent("css=div#crm-profile-block"); $this->waitForElementPresent("_qf_Edit_next"); $this->type('organization_name', $currentEmployer); @@ -434,11 +434,13 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->type("email-Primary", "john@gmail.com" . substr(sha1(rand()), 0, 7)); $this->type('city-1', 'Dumfries'); $this->type('postal_code-1', '1234'); + $this->select('state_province-1', 'value=1001'); $this->click("_qf_Edit_next"); // Is new contact created? $this->waitForText('crm-notification-container', "$currentEmployer has been created."); + $this->select2('employer_id', $currentEmployer); //make sure shared address is selected $this->waitForElementPresent('selected_shared_address-1'); @@ -452,10 +454,11 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->click('address[2][use_shared_address]'); // create new household with dialog - $this->select('profiles_2', "label=New Household"); + $this->clickAt("xpath=//div[@id='s2id_address_2_master_contact_id']/a"); + $this->click("xpath=//li[@class='select2-no-results']//a[contains(text(),' New Household')]"); // create new contact using dialog - $this->waitForElementPresent("css=div#contact-dialog-2"); + $this->waitForElementPresent("css=div#crm-profile-block"); $this->waitForElementPresent("_qf_Edit_next"); $sharedHousehold = substr(sha1(rand()), 0, 7) . 'Smith Household'; @@ -464,6 +467,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->type("email-Primary", substr(sha1(rand()), 0, 7) . "john@gmail.com"); $this->type('city-1', 'Birmingham'); $this->type('postal_code-1', '3456'); + $this->select('state_province-1', 'value=1001'); $this->click("_qf_Edit_next"); diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index f256b6b11b..7bc6b986fa 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -53,7 +53,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->type('title', $eventTitle); $this->click('_qf_SearchEvent_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); - $Id = explode('_', $this->getAttribute("xpath=//div[@id='event_status_id']/div[3]/table/tbody/tr@id")); + $Id = explode('-', $this->getAttribute("xpath=//div[@id='event_status_id']/div[2]/table/tbody/tr@id")); $eventId = $Id[1]; $params = array('label_a_b' => 'Owner of ' . rand(), @@ -97,10 +97,10 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes // wait for add Event link $this->waitForElementPresent("link=Add Event Registration"); $this->click("link=Add Event Registration"); - $this->waitForElementPresent("_qf_Participant_upload-bottom"); - $this->select("event_id", "value={$eventId}"); + $this->waitForText("s2id_event_id", "- select event -"); + $this->select2("event_id", $eventTitle); $this->click("_qf_Participant_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("link=Add Event Registration"); $this->openCiviPage('contact/search/advanced', 'reset=1'); @@ -177,8 +177,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->click("_qf_Location_upload-bottom"); // Wait for "saved" status msg - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForText('crm-notification-container', "'Location' information has been saved."); + $this->waitForElementPresent("_qf_Location_upload-bottom"); + $this->waitForText('crm-notification-container', "'Event Location' information has been saved."); } function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) { @@ -207,8 +207,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->click("_qf_Fee_upload-bottom"); // Wait for "saved" status msg - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForTextPresent("'Fee' information has been saved."); + $this->waitForElementPresent("_qf_Fee_upload-bottom"); + $this->waitForTextPresent("'Fees' information has been saved."); } function _testAddRelationship($ContactName, $relatedName, $relType) { @@ -233,9 +233,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->select('relationship_type_id', "label={$relType}"); //fill in the individual - $this->webtestFillAutocomplete($relatedName); - - $this->waitForElementPresent("quick-save"); + $this->select2('related_contact_id', $relatedName, TRUE); //fill in the relationship start date $this->webtestFillDate('start_date', '-2 year'); @@ -246,23 +244,23 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes //save the relationship //$this->click("_qf_Relationship_upload"); - $this->click("quick-save"); - $this->waitForElementPresent("current-relationships"); + $this->click('_qf_Relationship_upload-bottom'); + $this->waitForElementPresent("crm-contact-relationship-selector-current_wrapper"); //check the status message - $this->waitForText('crm-notification-container', "New relationship created."); + $this->waitForText('crm-notification-container', "Relationship created."); - $this->waitForElementPresent("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='View']"); - $this->click("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span/a[text()='View']"); + $this->click("xpath=//div[@id='crm-contact-relationship-selector-current_wrapper']//table/tbody//tr/td[9]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("xpath=//table[@class='crm-info-panel']"); $this->webtestVerifyTabularData( array( 'Description' => $description, 'Status' => 'Enabled', ) ); - $this->assertElementContainsText('option11', $relType); + $this->assertElementContainsText("xpath=//table[@class='crm-info-panel']", $relType); } function _testSearchResult($relType) { @@ -272,8 +270,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->select("component_mode", "label=Related Contacts"); $this->select("display_relationship_type", "label={$relType}"); $this->click("CiviEvent"); - $this->waitForElementPresent("event_type"); - $this->type("event_type", "Conference"); + $this->waitForElementPresent("event_type_id"); + $this->select2("event_type_id", "Conference"); $this->click("_qf_Advanced_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertElementContainsText('search-status', '2 Contacts'); diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index 78f19ce409..a9c0d4e5af 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -112,9 +112,9 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=div#tagtree"); //add Tagset to contact - $this->click("//div[@id='Tag']/div[2]/div[1]/div/ul/li[1]/input"); - $this->type("//div[@id='Tag']/div[2]/div[1]/div/ul/li[1]/input", 'tagset1'); - $this->typeKeys("//div[@id='Tag']/div[2]/div[1]/div/ul/li[1]/input", 'tagset1'); + $this->click("//div[@id='Tag']/div[2]/div[1]/span/ul/li[1]/input"); + $this->type("//div[@id='Tag']/div[2]/div[1]/span/ul/li[1]/input", 'tagset1'); + $this->typeKeys("//div[@id='Tag']/div[2]/div[1]/span/ul/li[1]/input", 'tagset1'); // ...waiting for drop down with results to show up... $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); @@ -124,9 +124,9 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); //$this->waitForElementPresent("//div[@id='Tag']/div[3]/div[1]/ul/li[1]/span"); - $this->click("//div[@id='Tag']/div[2]/div[1]/div/ul/li[2]/input"); - $this->type("//div[@id='Tag']/div[2]/div[1]/div/ul/li[2]/input", 'tagset2'); - $this->typeKeys("//div[@id='Tag']/div[2]/div[1]/div/ul/li[2]/input", 'tagset2'); + $this->click("//div[@id='Tag']/div[2]/div[1]/span/ul/li[2]/input"); + $this->type("//div[@id='Tag']/div[2]/div[1]/span/ul/li[2]/input", 'tagset2'); + $this->typeKeys("//div[@id='Tag']/div[2]/div[1]/span/ul/li[2]/input", 'tagset2'); // ...waiting for drop down with results to show up... $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); @@ -135,7 +135,7 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { // ...need to use mouseDownAt on first result (which is a li element), click does not work $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); - $this->click("//div[@id='Tag']/div[2]/div[1]/div/ul/li"); + $this->click("//div[@id='Tag']/div[2]/div[1]/span/ul/li"); // Type search name in autocomplete. $this->click("css=input#sort_name_navigation"); diff --git a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php index 910d9ce814..92b28bbb67 100644 --- a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php +++ b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php @@ -73,12 +73,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { $this->select('relationship_type_id', "label={$params['label_b_a']}"); //fill in the individual - $this->click("//*[@id='related_contact_id']/../div/ul/li/input"); - $this->keyDown("//*[@id='related_contact_id']/../div/ul/li/input", " "); - $this->type("//*[@id='related_contact_id']/../div/ul/li/input", $sortName); - $this->typeKeys("//*[@id='related_contact_id']/../div/ul/li/input", $sortName); - $this->waitForElementPresent("//*[@class='select2-result-label']"); - $this->clickAt("//*[@class='select2-results']/li[1]"); + $this->select2('related_contact_id', $sortName, TRUE); //fill in the relationship start date @@ -164,12 +159,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { $this->select('relationship_type_id', "label={$params['label_b_a']}"); //fill in the individual - $this->click("//*[@id='related_contact_id']/../div/ul/li/input"); - $this->keyDown("//*[@id='related_contact_id']/../div/ul/li/input", " "); - $this->type("//*[@id='related_contact_id']/../div/ul/li/input", $sortName); - $this->typeKeys("//*[@id='related_contact_id']/../div/ul/li/input", $sortName); - $this->waitForElementPresent("//*[@class='select2-result-label']"); - $this->clickAt("//*[@class='select2-results']/li[1]"); + $this->select2('related_contact_id', $sortName, TRUE); //fill in the relationship start date @@ -264,12 +254,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //fill in the individual - $this->click("//*[@id='related_contact_id']/../div/ul/li/input"); - $this->keyDown("//*[@id='related_contact_id']/../div/ul/li/input", " "); - $this->type("//*[@id='related_contact_id']/../div/ul/li/input", $sortName); - $this->typeKeys("//*[@id='related_contact_id']/../div/ul/li/input", $sortName); - $this->waitForElementPresent("//*[@class='select2-result-label']"); - $this->clickAt("//*[@class='select2-results']/li[1]"); + $this->select2('related_contact_id', $sortName, TRUE); //fill in the relationship start date $this->webtestFillDate('start_date', '-2 year'); diff --git a/tests/phpunit/WebTest/Import/ParticipantTest.php b/tests/phpunit/WebTest/Import/ParticipantTest.php index 3c722aaa0b..4037aad2c0 100644 --- a/tests/phpunit/WebTest/Import/ParticipantTest.php +++ b/tests/phpunit/WebTest/Import/ParticipantTest.php @@ -298,7 +298,7 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase { } $this->click("_qf_Fee_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("_qf_Fee_upload-bottom"); // Go to Online Registration tab $this->click("link=Online Registration"); @@ -315,8 +315,8 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase { $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->waitForElementPresent("_qf_Registration_upload-bottom"); + $this->waitForTextPresent("'Online Registration' information has been saved."); // verify event input on info page // start at Manage Events listing