From: jitendrapurohit Date: Mon, 5 May 2014 14:48:40 +0000 (+0530) Subject: Web Test Fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f1690d4aa0713b3657980e05a17bf416c524a888;p=civicrm-core.git Web Test Fixes --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 44cda181bf..8e3db95dc3 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1896,4 +1896,16 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->clickAt("//*[@class='select2-result-label']"); } } + + /** + * function to select multiple options + */ + function multiselect2($fieldid, $params) { + foreach($params as $value) { + $this->clickAt("xpath=//*[@id='$fieldid']/../div/ul//li/input"); + $this->waitForElementPresent("xpath=//ul[@class='select2-results']"); + $this->clickAt("xpath=//ul[@class='select2-results']//li/div[text()='$value']"); + $this->waitForText("xpath=//*[@id='$fieldid']/../div", $value); + } + } } diff --git a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php index f6ebc5a011..8f364a60a6 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php @@ -61,8 +61,8 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector']/tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); $expected = array( 'Received Into' => "Deposit Bank Account", 'Contribution Status' => "Completed", @@ -91,12 +91,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->openCiviPage("event/search", "reset=1", '_qf_Search_refresh'); $eventName = 'Rain'; - $this->click("event_name"); - $this->type("event_name", $eventName); - $this->typeKeys("event_name", $eventName); - $this->waitForElementPresent("css=div.ac_results-inner li"); - $this->click("css=div.ac_results-inner li"); - $this->assertContains($eventName, $this->getValue("event_name"), "autocomplete expected $eventName but didn’t find it in " . $this->getValue("event_name")); + $this->select2("event_id", $eventName); $this->click('_qf_Search_refresh'); $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); @@ -123,7 +118,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector']/tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[text()='View']"); $this->waitForPageToLoad($this->getTimeoutMsec()); $expected = array( 'Received Into' => "Deposit Bank Account", @@ -141,10 +136,10 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->webtestFillAutocomplete($firstName); // Select event. Based on label for now. - $this->select('event_id', "label=regexp:Rain-forest Cup Youth Soccer Tournament."); + $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); // Select role - $this->click('role_id[2]'); + $this->multiselect2('role_id', array('Volunteer')); // Select participant status $this->select('status_id', 'value=1'); @@ -158,7 +153,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium // Select an event fee $this->waitForElementPresent('priceset'); - $this->click("xpath=//input[@class='form-radio']"); + $this->click("xpath=//input[@class='crm-form-radio']"); // Enter amount to be paid (note: this should default to selected fee level amount, s/b fixed during 3.2 cycle) $this->type('total_amount', '800'); @@ -170,13 +165,11 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct? - $this->assertTrue($this->isTextPresent("Event registration for $firstName Anderson has been added"), - "Status message didn't show up after saving!" - ); + $this->waitForText("crm-notification-container", "Event registration for $firstName Anderson has been added"); - $this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//form[@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=//form[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom'); $this->webtestVerifyTabularData( @@ -185,7 +178,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium 'Participant Role' => 'Attendee', 'Status' => 'Registered', 'Event Source' => 'Event StandaloneAddTest Webtest', - 'Event Fees' => '$ 800.00', + 'Fees' => '$ 800.00', ) ); } @@ -217,10 +210,10 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!"); // verify if Membership is created - $this->waitForElementPresent("xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[2]//tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the Membership view screen - $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//div[@class='view-content']//table[2]/tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); $expected = array( diff --git a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php index f4ad48467b..921003719f 100644 --- a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php +++ b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php @@ -68,7 +68,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); $this->type('sort_name', "Smiths_x"); $this->click('_qf_Basic_refresh'); - $this->waitForElementPresent('_qf_Basic_next_print'); + $this->waitForElementPresent('Go'); // Batch Update Via Profile $this->waitForElementPresent('CIVICRM_QFID_ts_all_4'); @@ -154,7 +154,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); $this->type('sort_name', $lastName); $this->click('_qf_Basic_refresh'); - $this->waitForElementPresent('_qf_Basic_next_print'); + $this->waitForElementPresent('Go'); // Batch Update Via Profile $this->waitForElementPresent('CIVICRM_QFID_ts_all_4'); @@ -335,7 +335,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); $this->type('sort_name', $lastName); $this->click('_qf_Basic_refresh'); - $this->waitForElementPresent('_qf_Basic_next_print'); + $this->waitForElementPresent('Go'); // Batch Update Via Profile $this->waitForElementPresent('CIVICRM_QFID_ts_all_4'); @@ -399,8 +399,8 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { //Reserve and interview respondents $this->openCiviPage('campaign', 'reset=1&subPage=survey'); - $this->waitForElementPresent("xpath=//table[@id='surveys']/tbody//tr/td[2]/a[text()='{$surveyTitle}']/../following-sibling::td[@class='crm-campaign-voterLinks']/span/ul/li/a"); - $this->click("xpath=//table[@id='surveys']/tbody//tr/td[2]/a[text()='{$surveyTitle}']/../following-sibling::td[@class='crm-campaign-voterLinks']/span/ul/li/a"); + $this->waitForElementPresent("xpath=//table[@id='surveys']/tbody//tr/td[2]/a[text()='{$surveyTitle}']/../following-sibling::td[@class=' crm-campaign-voterLinks']/span/ul/li/a"); + $this->click("xpath=//table[@id='surveys']/tbody//tr/td[2]/a[text()='{$surveyTitle}']/../following-sibling::td[@class=' crm-campaign-voterLinks']/span/ul/li/a"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("xpath=//div[@id='search_form_reserve']/div"); $this->waitForElementPresent('sort_name'); @@ -408,6 +408,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_Search_refresh'); $this->clickLink('_qf_Search_refresh', 'Go'); $this->click('toggleSelect'); + $this->select('task', "value=2"); $this->click('Go'); $this->waitForElementPresent('_qf_Reserve_next_reserveToInterview-top'); $this->clickLink('_qf_Reserve_next_reserveToInterview-top', '_qf_Interview_cancel_interview'); @@ -652,12 +653,12 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); //Is custom field created - $this->waitForText('crm-notification-container', "Your custom field '$checkLabel1' has been saved."); + $this->waitForText('crm-notification-container', "Custom field '$checkLabel1' has been saved."); $returnArray[1] = array($customGroupTitle, $checkLabel1); + $this->waitForElementPresent("xpath=//*[@id='newCustomField']/span"); // create another custom field - Integer Radio - $this->click("//a[@id='newCustomField']/span"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("xpath=//*[@id='newCustomField']/span", "_qf_Field_cancel-bottom", FALSE); //for checkbox 2 $checkLabel2 = 'Custom Check Two Text_' . substr(sha1(rand()), 0, 4); @@ -679,16 +680,14 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->type('option_value_3', 3); //clicking save - $this->click('_qf_Field_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Field_next', "xpath=//*[@id='newCustomField']", FALSE); //Is custom field created - $this->waitForText('crm-notification-container', "Your custom field '$checkLabel2' has been saved."); + $this->waitForText('crm-notification-container', "Custom field '$checkLabel2' has been saved."); $returnArray[2] = array($customGroupTitle, $checkLabel2); // create another custom field - Integer Radio - $this->click("//a[@id='newCustomField']/span"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("xpath=//*[@id='newCustomField']/span", "_qf_Field_cancel-bottom", FALSE); // create another custom field - Date $dateFieldLabel = 'Custom Date Field' . substr(sha1(rand()), 0, 4); @@ -708,16 +707,14 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->select('time_format', "value=2"); //clicking save - $this->click('_qf_Field_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Field_next', "xpath=//*[@id='newCustomField']", FALSE); //Is custom field created - $this->waitForText('crm-notification-container', "Your custom field '$dateFieldLabel' has been saved."); + $this->waitForText('crm-notification-container', "Custom field '$dateFieldLabel' has been saved."); $returnArray[3] = array($customGroupTitle, $dateFieldLabel); // create another custom field - Integer Radio - $this->click("//a[@id='newCustomField']/span"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("xpath=//*[@id='newCustomField']/span", "_qf_Field_cancel-bottom", FALSE); //create rich text editor field $richTextField = 'Custom Rich TextField_' . substr(sha1(rand()), 0, 4); @@ -727,16 +724,14 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->select('data_type[1]', "label=RichTextEditor"); //clicking save - $this->click('_qf_Field_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Field_next', "xpath=//*[@id='newCustomField']", FALSE); //Is custom field created - $this->waitForText('crm-notification-container', "Your custom field '$richTextField' has been saved."); + $this->waitForText('crm-notification-container', "Custom field '$richTextField' has been saved."); $returnArray[4] = array($customGroupTitle, $richTextField); // create another custom field - Integer Radio - $this->click("//a[@id='newCustomField']/span"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("xpath=//*[@id='newCustomField']/span", "_qf_Field_cancel-bottom", FALSE); //create radio button field //for radio 1 @@ -759,16 +754,14 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->type('option_value_3', 3); //clicking save - $this->click('_qf_Field_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Field_next', "xpath=//*[@id='newCustomField']", FALSE); //Is custom field created - $this->assertElementContainsText('crm-container', "Your custom field '$radioLabel1' has been saved."); + $this->waitForText('crm-notification-container', "Custom field '$radioLabel1' has been saved."); $returnArray[5] = array($customGroupTitle, $radioLabel1); // create another custom field - Integer Radio - $this->click("//a[@id='newCustomField']/span"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("xpath=//*[@id='newCustomField']/span", "_qf_Field_cancel-bottom", FALSE); //for radio 2 $radioLabel2 = 'Custom Radio Two Text_' . substr(sha1(rand()), 0, 4); @@ -790,11 +783,10 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->type('option_value_3', 3); //clicking save - $this->click('_qf_Field_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Field_next', "xpath=//*[@id='newCustomField']", FALSE); //Is custom field created - $this->waitForText('crm-notification-container', "Your custom field '$radioLabel2' has been saved."); + $this->waitForText('crm-notification-container', "Custom field '$radioLabel2' has been saved."); $returnArray[6] = array($customGroupTitle, $radioLabel2); return $returnArray; diff --git a/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php b/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php index cda15e4568..ec3a64975e 100644 --- a/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php @@ -72,6 +72,7 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { $profileTitle = 'profile_' . substr(sha1(rand()), 0, 7); $this->type('title', $profileTitle); + $this->click('uf_group_type_Profile'); //profile Used for $this->click('uf_group_type_User Account'); @@ -103,7 +104,6 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { //click on save $this->click('_qf_Group_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); //check for profile create $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."); @@ -183,7 +183,8 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { //click on save $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click('link=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'); $recordNew = $this->_addRecords('Create'); $this->waitForPageToLoad($this->getTimeoutMsec()); $elements = $this->parseURL(); @@ -210,15 +211,21 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { } $this->waitForElementPresent("//a/span[contains(text(), 'Add New Record')]"); $this->click("//a/span[contains(text(), 'Add New Record')]"); + $this->waitForElementPresent("_qf_Edit_cancel"); $record1 = $this->_addRecords(); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->verifyText("//div[@id='browseValues']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel'])); - $this->verifyText("//div[@id='browseValues']/div/div/table/tbody/tr[2]/td[1]", preg_quote($record1['text'])); - $this->openCiviPage('profile/edit', "reset=1&id=$id&gid=$gid", "//a/span[contains(text(), 'Add New Record')]"); + $this->waitForElementPresent("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[2]/td[1]"); + $alertText = $this->getAlert(); + $this->assertEquals("Thank you. Your information has been saved.", $alertText); + $this->waitForElementPresent("//a/span[contains(text(), 'Add New Record')]"); + $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel'])); + $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[2]/td[1]", preg_quote($record1['text'])); $this->click("//a/span[contains(text(), 'Add New Record')]"); $record2 = $this->_addRecords(); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->verifyText("//div[@id='browseValues']/div/div/table/tbody/tr[3]/td[1]", preg_quote($record2['text'])); + $this->waitForElementPresent("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[3]/td[1]"); + $alertText = $this->getAlert(); + $this->assertEquals("Thank you. Your information has been saved.", $alertText); + $this->waitForElementPresent("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[3]/td[1]"); + $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[3]/td[1]", preg_quote($record2['text'])); // Check Max Record Limit $this->verifyElementNotPresent("//a/span[contains(text(), 'Add New Record')]"); @@ -228,33 +235,36 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME sleep(3); - $this->click("//div[@id='browseValues']/div/div/table/tbody/tr/td[3]/span/a[text()='Edit']"); - $this->waitForElementPresent("//html/body/div[5]"); - $this->verifyText("//div[@id='browseValues']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel'])); - $this->type("//div[@id='profile-dialog']/div/form/div[2]/div/div[2]/input", $recordNew['text'].'edit'); - $this->click("//div[@id='profile-dialog']/div/form/div[3]/span/input[@id='_qf_Edit_next']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->verifyText("//div[@id='browseValues']/div/div/table/tbody/tr[1]/td[1]", preg_quote($recordNew['text'].'edit')); + $this->click("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr/td[3]/span/a[text()='Edit']"); + $this->waitForElementPresent("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate form-submit default crm-form-submit']"); + $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel'])); + $this->type("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']", $recordNew['text'].'edit'); + $this->click("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate form-submit default crm-form-submit']"); + $this->waitForText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[1]/td[1]", $recordNew['text'].'edit'); + $editalertText = $this->getAlert(); + $this->assertEquals("Thank you. Your information has been saved.", $editalertText); + $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[1]/td[1]", preg_quote($recordNew['text'].'edit')); // Check the delete functionality - $this->click("//div[@id='browseValues']/div/div/table/tbody/tr/td[3]/span/a[text()='Delete']"); - $this->waitForElementPresent("//html/body/div[5]"); + $this->click("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr/td[3]/span/a[text()='Delete']"); + $this->waitForElementPresent("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]/div"); + $this->assertElementContainsText("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]/div", 'Are you sure you want to delete this record?'); + $this->click('_qf_Edit_upload_delete'); // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME sleep(3); - $this->assertElementContainsText('profile-dialog', 'Are you sure you want to delete this record?'); - $this->click('_qf_Edit_upload_delete'); + $delText = $this->getAlert(); + $this->assertEquals("Deleted Your record has been deleted.", $delText); // Check the view functionality // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME sleep(3); - $this->click("//div[@id='browseValues']/div/div/table/tbody/tr/td[3]/span/a[text()='View']"); - $this->waitForElementPresent("//html/body/div[5]"); - $this->assertElementContainsText('ui-id-1', 'View '.$params['customGroupTitle']); - $this->assertElementContainsText('crm-container', $params['textFieldLabel']); + $this->click("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr/td[3]/span/a[text()='View']"); + $this->waitForText("xpath=//div[@class='ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix']", 'View '.$params['customGroupTitle']); + $this->assertElementContainsText("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']", $params['textFieldLabel']); if ($checkSearchable) { $this->verifyElementNotPresent("//div[@id='profile-dialog']/div/div/div/div/div[1]/div[2]/a"); return array($gid, $profileTitle); @@ -262,7 +272,7 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { // Check Search Functionality if (!$userCheck) { - $this->click("//div[@id='profile-dialog']/div/div/div/div/div/div[2]/a"); + $this->click("//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/div/div/div/div/div[2]/a"); $this->waitForElementPresent("//form[@id='Search']"); $this->verifyText("//form[@id='Search']/div[2]/div[2]/div[2]/table/tbody/tr[2]/td[2]", preg_quote($recordNew['firstname'])); $this->openCiviPage('profile/view', "reset=1&id=$id&gid=$gid", "//div[@id='row-first_name']/div[2]/a"); @@ -343,20 +353,17 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { $this->click("is_searchable"); //clicking save - $this->click("_qf_Field_next_new-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click("_qf_Field_next-bottom"); //Is custom field created? - $this->assertElementContainsText('crm-container', $params['selectFieldLabel']); + $this->waitForText('crm-notification-container', $params['selectFieldLabel']); return $params; } - function _addRecords($context = 'Edit', $waitAtStart = TRUE, $parentElement = '//') { - if ($waitAtStart) { - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + function _addRecords($context = 'Edit', $parentElement = '//') { $params['text'] = 'text' . substr(sha1(rand()), 0, 3); - $this->type("//div[@id='crm-profile-block']/div/div[2]/input[@type='text']", $params['text']); + $this->waitForElementPresent("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']"); + $this->type("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']", $params['text']); if ($context == 'Create') { $params['firstname'] = 'John' . substr(sha1(rand()), 0, 3); $this->type('first_name', $params['firstname']); @@ -364,10 +371,15 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { $this->type('last_name', $params['lastname']); $params['email'] = $params['firstname'].$params['lastname'].'@exa.com'; $this->type('email-Primary', $params['email']); + $this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select"); + $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1'); + $this->click("xpath=//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate form-submit default crm-form-submit']"); + } + else { + $this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select"); + $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1'); + $this->click("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate form-submit default crm-form-submit']"); } - $this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select"); - $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1'); - $this->click('_qf_Edit_next'); return $params; } }