From: Jitendra Purohit Date: Thu, 4 Sep 2014 13:33:11 +0000 (+0530) Subject: Webtest Fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ba6f320fe24b7414fb2c459b202b8a48744e9d83;p=civicrm-core.git Webtest Fix --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index e0110ef8b3..2de3b3cee1 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1868,12 +1868,12 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->click('_qf_FinancialType_next'); if ($option == 'new') { - $text = "Your Financial '{$financialType['name']}' Type has been created, along with a corresponding income account '{$financialType['name']}'. That income account, along with standard financial accounts 'Accounts Receivable', 'Banking Fees' and 'Premiums' have been linked to the financial type. You may edit or replace those relationships here."; + $text = "Your Financial \"{$financialType['name']}\" Type has been created, along with a corresponding income account \"{$financialType['name']}\". That income account, along with standard financial accounts \"Accounts Receivable\", \"Banking Fees\" and \"Premiums\" have been linked to the financial type. You may edit or replace those relationships here."; } else { $text = "The financial type '{$financialType['name']}' has been saved."; } - $this->waitForText('crm-notification-container', $text); + $this->waitForText("xpath=//div[@class='notify-content']", $text); } /** diff --git a/tests/phpunit/WebTest/Campaign/ActivityTest.php b/tests/phpunit/WebTest/Campaign/ActivityTest.php index 8619468152..e314cdad04 100644 --- a/tests/phpunit/WebTest/Campaign/ActivityTest.php +++ b/tests/phpunit/WebTest/Campaign/ActivityTest.php @@ -92,9 +92,7 @@ class WebTest_Campaign_ActivityTest 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_ActivityTest 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->activityAddTest($campaignTitle, $id); } @@ -196,15 +194,14 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase { // Is status message correct? $this->waitForText('crm-notification-container', $subject); - $this->waitForElementPresent(" - xpath=//table[@id='contact-activity-selector-activity']//tbody//tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr[1]/td[8]/span/a[text()='View']"); // click through to the Activity view screen - $this->click("xpath=//table[@id='contact-activity-selector-activity']//tbody//tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody//tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_Activity_cancel-bottom'); // verify Activity created - $this->verifyText("xpath=id('Activity')/div[2]/table[1]/tbody/tr[5]/td[2]/span", preg_quote($campaignTitle)); + $this->waitForText("xpath=id('Activity')/div[2]/table[1]/tbody/tr[5]/td[2]/span", $campaignTitle); } } diff --git a/tests/phpunit/WebTest/Campaign/MembershipTest.php b/tests/phpunit/WebTest/Campaign/MembershipTest.php index e5e7219b28..ce9d06c873 100644 --- a/tests/phpunit/WebTest/Campaign/MembershipTest.php +++ b/tests/phpunit/WebTest/Campaign/MembershipTest.php @@ -90,9 +90,7 @@ class WebTest_Campaign_MembershipTest 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"); @@ -106,8 +104,8 @@ class WebTest_Campaign_MembershipTest 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->memberAddTest($campaignTitle, $id); } diff --git a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php index ae3e5aab7e..964d20d1a3 100644 --- a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php +++ b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php @@ -151,6 +151,13 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { } break; + case 'multiselect2': + foreach ($field['values'] as $op) { + $this->waitForVisible($fldLocator); + $this->multiselect2($fldLocator, $op); + } + break; + case 'date': $this->webtestFillDate($fldLocator, current($field['values'])); break; @@ -177,8 +184,9 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { array( 'Location Type' => array( - 'type' => 'checkbox', - 'values' => array('location_type[1]', 'location_type[2]'), + 'type' => 'multiselect2', + 'locator' => 'location_type', + 'values' => array(array('Home', 'Work')), ), 'Country' => array( @@ -188,9 +196,9 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { ), 'State' => array( - 'type' => 'select', + 'type' => 'multiselect2', 'locator' => 'state_province', - 'values' => array('Alabama', 'California', 'New Jersey', 'New York'), + 'values' => array(array('Alabama', 'California', 'New Jersey', 'New York')), ), ), ), diff --git a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php index 130b3c4b0b..c579e79b0b 100644 --- a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php @@ -92,7 +92,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->type('help_pre', $setHelp); $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'); } /** @@ -103,6 +103,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { */ function _testAddPriceFields(&$fields, &$validateString, $financialType, $dateSpecificFields = FALSE) { $validateStrings[] = $financialType; + $this->click('newPriceField'); + $this->waitForElementPresent('label'); foreach ($fields as $label => $type) { $validateStrings[] = $label; @@ -177,7 +179,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { break; } $this->select('financial_type_id', "label={$financialType}"); - $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom', FALSE); + $this->waitForText('crm-notification-container', "Price Field '$label' has been saved."); } } diff --git a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php index f44f03b445..d9a9cea3e5 100755 --- a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php +++ b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php @@ -190,7 +190,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $this->type('help_pre', $setHelp); $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'); $this->assertTrue($this->isTextPresent("Your Set '{$setTitle}' has been added. You can add fields to this set now.")); } @@ -220,17 +220,17 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase elseif (!$defaultPriceSet) { $memTypeParams1 = $this->webtestAddMembershipType(); $memTypeTitle1 = $memTypeParams1['membership_type']; - $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href")); + $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href")); $memTypeId1 = $memTypeId1[1]; $memTypeParams2 = $this->webtestAddMembershipType(); $memTypeTitle2 = $memTypeParams2['membership_type']; - $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href")); + $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href")); $memTypeId2 = $memTypeId2[1]; $memTypeParams3 = $this->webtestAddMembershipType(); $memTypeTitle3 = $memTypeParams3['membership_type']; - $memTypeId3 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle3}']/../td[12]/span/a[3]@href")); + $memTypeId3 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle3}']/../td[12]/span/a[3]@href")); $memTypeId3 = $memTypeId3[1]; }