From: jitendrapurohit Date: Wed, 17 Sep 2014 07:21:53 +0000 (+0530) Subject: Webtest Fix 4.5.0 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7df6dc249199fcffe211829289f28385def14efd;p=civicrm-core.git Webtest Fix 4.5.0 --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index e9fadeb82e..33c9a60022 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1917,7 +1917,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->clickLink('link=Add Profile', '_qf_Group_cancel-bottom'); $this->type('title', $profileTitle); - $this->clickLink('_qf_Group_next-bottom', "xpath=//a/span[text()='Add Field']"); + $this->clickLink('_qf_Group_next-bottom'); $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."); diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index fe83fcc48e..1776f0295f 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -354,9 +354,7 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->click("extends[0]"); $this->select("extends[0]", "value=Activity"); $this->click("//option[@value='Activity']"); - $this->click('_qf_Group_next-bottom'); - $this->waitForElementPresent('newCustomField'); - $this->click('newCustomField'); + $this->clickLink('_qf_Group_next-bottom'); $this->waitForElementPresent('_qf_Field_cancel-bottom'); //Is custom group created? diff --git a/tests/phpunit/WebTest/Contact/AddTest.php b/tests/phpunit/WebTest/Contact/AddTest.php index da8e5926f3..a0bd13c812 100644 --- a/tests/phpunit/WebTest/Contact/AddTest.php +++ b/tests/phpunit/WebTest/Contact/AddTest.php @@ -104,7 +104,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->click("address_1_country_id"); $this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID()); - if ($this->assertElementContainsText('address_1', "Latitude")) { + if ($this->assertElementContainsText('address_table_1', "Latitude")) { $this->type("address_1_geo_code_1", "1234"); $this->type("address_1_geo_code_2", "5678"); } @@ -119,7 +119,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->click("address_2_country_id"); $this->select("address_2_country_id", "value=" . $this->webtestGetValidCountryID()); - if ($this->assertElementContainsText('address_2', "Latitude")) { + if ($this->assertElementContainsText('address_table_2', "Latitude")) { $this->type("address_2_geo_code_1", "1234"); $this->type("address_2_geo_code_2", "5678"); } @@ -235,7 +235,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->click("address_1_country_id"); $this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID()); - if ($this->assertElementContainsText('address_1', "Latitude")) { + if ($this->assertElementContainsText('address_table_1', "Latitude")) { $this->type("address_1_geo_code_1", "1234"); $this->type("address_1_geo_code_2", "5678"); } @@ -344,7 +344,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->click("address_1_country_id"); $this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID()); - if ($this->assertElementContainsText('address_1', "Latitude")) { + if ($this->assertElementContainsText('address_table_1', "Latitude")) { $this->type("address_1_geo_code_1", "1234"); $this->type("address_1_geo_code_2", "5678"); } diff --git a/tests/phpunit/WebTest/Contact/AddViaProfileTest.php b/tests/phpunit/WebTest/Contact/AddViaProfileTest.php index f9664bef5a..9aad1c54e7 100644 --- a/tests/phpunit/WebTest/Contact/AddViaProfileTest.php +++ b/tests/phpunit/WebTest/Contact/AddViaProfileTest.php @@ -38,7 +38,7 @@ class WebTest_Contact_AddViaProfileTest extends CiviSeleniumTestCase { function testAddViaCreateProfile() { $this->webtestLogin(); - $this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_cancel'); + $this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_next'); $firstName = 'Jo' . substr(sha1(rand()), 0, 4); $lastName = 'Ad' . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php index 81cc43e5ee..edc04efed0 100644 --- a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php +++ b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php @@ -49,12 +49,10 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->click("extends[0]"); $this->select("extends[0]", "value=Contact"); $this->click("//option[@value='Contact']"); - $this->click("_qf_Group_next-bottom"); - $this->waitForElementPresent('newCustomField'); + $this->clickLink("_qf_Group_next-bottom"); //Is custom group created? $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); - $this->click('newCustomField'); $this->waitForElementPresent("_qf_Field_cancel-bottom"); //add custom field - alphanumeric checkbox @@ -173,12 +171,10 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->click("extends[0]"); $this->select("extends[0]", "value=Contact"); $this->click("//option[@value='Contact']"); - $this->click("_qf_Group_next-bottom"); - $this->waitForElementPresent('newCustomField'); + $this->clickLink("_qf_Group_next-bottom"); //Is custom group created? $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); - $this->click('newCustomField'); $this->waitForElementPresent("_qf_Field_cancel-bottom"); //add custom field - money text @@ -259,10 +255,8 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->type("id=title", $customFieldSet); $this->select("id=extends_0", "label=Individual"); $this->click("id=collapse_display"); - $this->click("id=_qf_Group_next-bottom"); - $this->waitForElementPresent('newCustomField'); + $this->clickLink("id=_qf_Group_next-bottom"); $this->waitForText('crm-notification-container', "Your custom field set '$customFieldSet' has been added."); - $this->click('newCustomField'); $this->waitForElementPresent('_qf_Field_done-bottom'); // Add field to fieldset @@ -308,7 +302,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->click("address_1_country_id"); $this->select("address_1_country_id", "value=1228"); - if ($this->assertElementContainsText("address_1", "Latitude")) { + if ($this->assertElementContainsText("address_table_1", "Latitude")) { $this->type("address_1_geo_code_1", "1234"); $this->type("address_1_geo_code_2", "5678"); } diff --git a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php index f8fd446d0a..49aa5a23b5 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', 'newPriceField'); + $this->clickLink('_qf_Set_next-bottom'); } /** diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index 0ec39e516b..1e919e1528 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -161,8 +161,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->select('extends[1][]', 'value=2'); $this->click("//option[@value='Contact']"); - $this->click('_qf_Group_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Group_next', 'label'); //Is custom group created? $this->waitForText('crm-notification-container', "Your custom field set '$customGroupTitle' has been added. You can add custom fields now."); @@ -198,14 +197,13 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->click('is_searchable'); //clicking save - $this->click('_qf_Field_done-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Field_done-bottom', 'newCustomField', FALSE); //Is custom field created? $this->waitForText('crm-notification-container', "Custom field '$checkboxFieldLabel' has been saved."); //create another custom field - Integer Radio - $this->clickLink("//a[@id='newCustomField']/span", '_qf_Field_cancel', FALSE); + $this->clickLink('newCustomField', '_qf_Field_cancel', FALSE); $this->click('data_type[0]'); $this->select('data_type[0]', 'value=1'); $this->click("//option[@value='1']"); diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 4a43b68b6d..6f680e628e 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -88,7 +88,7 @@ class WebTest_Event_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', 'newPriceField'); + $this->clickLink('_qf_Set_next-bottom'); } /** @@ -97,7 +97,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { * @param bool $dateSpecificFields */ function _testAddPriceFields(&$fields, &$validateStrings, $dateSpecificFields = FALSE) { - $this->clickLink('newPriceField', '_qf_Field_cancel-bottom', FALSE); + $this->waitForElementPresent('_qf_Field_cancel-bottom'); foreach ($fields as $label => $type) { $validateStrings[] = $label; @@ -618,7 +618,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // 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->waitForText("crm-notification-container", "Event registration for $displayName has been added"); $this->waitForElementPresent("xpath=//form[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the participant view screen diff --git a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php index 5d7845cfa1..db7aec4c8b 100644 --- a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php +++ b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php @@ -1049,7 +1049,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type('help_pre', 'This is test priceset.'); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); - $this->clickLink('_qf_Set_next-bottom', 'newPriceField'); + $this->clickLink('_qf_Set_next-bottom'); } /** @@ -1058,7 +1058,6 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { function _testAddPriceFields($fields) { $fieldCount = count($fields); $count = 1; - $this->click('newPriceField'); $this->waitForElementPresent('label'); foreach ($fields as $label => $field) { $this->type('label', $label); diff --git a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php index d76c5f3a19..e722ef3c42 100644 --- a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php +++ b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php @@ -70,10 +70,8 @@ class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase { $this->select('id=extends_0', 'label=Grants'); $this->addSelection('id=extends_1', "label=$grantType"); $this->click('id=collapse_display'); - $this->click('id=_qf_Group_next-bottom'); - $this->waitForElementPresent('newCustomField'); + $this->clickLink('id=_qf_Group_next-bottom'); $this->waitForText('crm-notification-container', "Your custom field set '$grantFieldSet' has been added."); - $this->click('newCustomField'); $this->waitForElementPresent('_qf_Field_done-bottom'); // Add field to fieldset diff --git a/tests/phpunit/WebTest/Import/AddressImportTest.php b/tests/phpunit/WebTest/Import/AddressImportTest.php index 099a608f85..0f76fb87eb 100644 --- a/tests/phpunit/WebTest/Import/AddressImportTest.php +++ b/tests/phpunit/WebTest/Import/AddressImportTest.php @@ -127,13 +127,11 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->click('extends[0]'); $this->select('extends[0]', "value=Address"); $this->click("//option[@value='Address']"); - $this->click('_qf_Group_next-bottom'); - $this->waitForElementPresent('newCustomField'); + $this->clickLink('_qf_Group_next-bottom'); //Is custom group created? $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); $gid = $this->urlArg('gid'); - $this->click('newCustomField'); $this->waitForElementPresent('_qf_Field_cancel-bottom'); // create custom field "alphanumeric text" diff --git a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php index 0010dd2dc5..ec4ccdc2e4 100644 --- a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php +++ b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php @@ -161,12 +161,10 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase { $this->click('extends[0]'); $this->select('extends[0]', "value=Contact"); $this->click("//option[@value='Contact']"); - $this->click('_qf_Group_next-bottom'); - $this->waitForElementPresent('newCustomField'); + $this->clickLink('_qf_Group_next-bottom'); //Is custom group created? $this->waitForText('crm-notification-container', $customGroupTitle); - $this->click('newCustomField'); $this->waitForElementPresent('_qf_Field_cancel-bottom'); $gid = $this->urlArg('gid'); diff --git a/tests/phpunit/WebTest/Import/CustomDataTest.php b/tests/phpunit/WebTest/Import/CustomDataTest.php index 2e5f2859df..cd603ba4b2 100644 --- a/tests/phpunit/WebTest/Import/CustomDataTest.php +++ b/tests/phpunit/WebTest/Import/CustomDataTest.php @@ -172,12 +172,10 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase { $this->click("extends[0]"); $this->select("extends[0]", "value=Contact"); $this->click("//option[@value='Contact']"); - $this->click('_qf_Group_next-bottom'); - $this->waitForElementPresent('newCustomField'); + $this->clickLink('_qf_Group_next-bottom'); //Is custom group created? $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.")); - $this->click('newCustomField'); $this->waitForElementPresent('_qf_Field_cancel-bottom'); $url = explode('gid=', $this->getLocation()); $gid = $url[1]; diff --git a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php index d9a9cea3e5..d33aa0fd72 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', 'newPriceField'); + $this->clickLink('_qf_Set_next-bottom'); $this->assertTrue($this->isTextPresent("Your Set '{$setTitle}' has been added. You can add fields to this set now.")); } diff --git a/tests/phpunit/WebTest/Profile/ProfileAddTest.php b/tests/phpunit/WebTest/Profile/ProfileAddTest.php index 3e72157b3a..2874fc8377 100644 --- a/tests/phpunit/WebTest/Profile/ProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileAddTest.php @@ -105,7 +105,6 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { //Add field to profile - $this->click("xpath=//a/span[text()='Add Field']"); $this->waitForElementPresent("field_name[0]"); $this->click('field_name[0]'); $this->select('field_name[0]', 'value=Contact'); @@ -276,12 +275,9 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { // Wait for "saved" status msg $this->waitForText('crm-notification-container', 'Profile Added'); - $this->waitForElementPresent("xpath=//a/span[text()='Add Field']"); - $this->click("xpath=//a/span[text()='Add Field']"); $this->waitForElementPresent("field_name_0"); // select field(s) to be added in profile - $this->select("field_name_0", "value=Contact"); $this->select("field_name_1", "value=email"); $this->select("field_name_2", "value=2"); @@ -292,7 +288,6 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { // Wait for "saved" status msg $this->waitForText('crm-notification-container', "Profile Field Saved"); - $this->waitForElementPresent("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span/a[text()='Edit']"); // extract profile Id $id = explode("gid=", $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr/td[9]/span/a[text()='Edit']/@href"));