From: Web Access Date: Tue, 10 May 2016 13:08:55 +0000 (+0530) Subject: CRM-18454: Webtests Fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=16dc87ac829ab5f9bc26a7f619f540019778be3c;p=civicrm-core.git CRM-18454: Webtests Fix --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index c719f503e4..234b36abec 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1526,17 +1526,17 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { // select the radio first since the element id changes after membership org search results are loaded switch ($auto_renew) { case 'optional': - $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); + $this->click("xpath=//table[@class='form-layout-compressed']/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); break; case 'required': - $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Auto-renew required')]"); + $this->click("xpath=//table[@class='form-layout-compressed']/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Auto-renew required')]"); break; default: //check if for the element presence (the Auto renew options can be absent when proper payment processor not configured) if ($this->isElementPresent("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'No auto-renew option')]")) { - $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'No auto-renew option')]"); + $this->click("xpath=//table[@class='form-layout-compressed']/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'No auto-renew option')]"); } break; } @@ -1547,6 +1547,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->select('financial_type_id', "label={$memTypeParams['financial_type']}"); $this->type('duration_interval', $duration_interval); + $this->waitForElementPresent('duration_unit'); $this->select('duration_unit', "label={$duration_unit}"); $this->waitForElementPresent('period_type'); $this->select('period_type', "value={$period_type}"); @@ -1591,7 +1592,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { } // Clicking save. - $this->clickLink('_qf_Edit_upload-bottom'); + $this->click('_qf_Edit_upload-bottom'); // Is status message correct? $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved."); @@ -2498,8 +2499,8 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { ); $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a", FALSE); $this->waitForAjaxContent(); - $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); + $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); + $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); return $contact; } diff --git a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php index 09ec9e4a16..8e664a3d37 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php @@ -301,7 +301,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", FALSE); $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); //View Contribution Record - $this->assertElementContainsText("xpath=//table[@class='crm-info-panel']/tbody/tr[11]/td[2]", $campaignTitle); + $this->assertElementContainsText("xpath=//form[@class='CRM_Contribute_Form_ContributionView']/div[2]//table[1]/tbody/tr[10]/td[2]", $campaignTitle); } } diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index 6c4bb2d6be..e93f205abc 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -198,7 +198,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->assertElementContainsText("css=div.crm-case-roles-block", $role); } // check that case creator role has been assigned to logged in user - $this->assertElementContainsText("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[2]", $creatorName); + $this->assertElementContainsText("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[1]/td[2]", $creatorName); } /** diff --git a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php index 8be86fbefe..9390781246 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php @@ -91,10 +91,9 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { $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("case_type_id", "label=$caseTypeLabel"); $this->select("status_id", "label={$caseStatusLabel}"); - $this->webtestFillDate('start_date', 'now'); $today = date('F jS, Y', strtotime('now')); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 1eb8ad4dde..8a127f9084 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -75,9 +75,9 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->type('title', $params['name']); $this->click('title'); $this->waitForAjaxContent(); - $this->waitForElementPresent("xpath=//table/tbody/tr/td/div[contains(text(), '{$params['name']}')]"); - $createdBy = $this->getText("xpath=//table/tbody/tr/td[3]/a"); - $this->click("xpath=//table/tbody/tr/td[7]//span/a[text()='Settings']"); + $this->waitForElementPresent("xpath=//table/tbody//tr/td/div[contains(text(), '{$params['name']}')]"); + $createdBy = $this->getText("xpath=//table/tbody//tr/td[3]/a"); + $this->click("xpath=//table/tbody//tr/td[7]//span/a[text()='Settings']"); $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/table[1]/tbody/tr[2]/td[contains(text(), '{$createdBy}')]"); $this->openCiviPage('group', 'reset=1'); diff --git a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php index 1763cbf68a..76e1c85b5b 100644 --- a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php +++ b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php @@ -166,8 +166,6 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->click("_qf_Contact_upload_view"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->_searchBuilder('Email', NULL, NULL, 'IS NULL'); - $this->type('CRM_Contact_Form_Search_Builder-rows-per-page-select', '100'); - $this->waitForElementPresent('CRM_Contact_Form_Search_Builder-rows-per-page-select'); $names = array( 1 => $firstName1, 2 => $firstName2, @@ -183,8 +181,6 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { } //searching contacts whose phone field is not empty $this->_searchBuilder('Phone', NULL, $firstName, 'IS NOT EMPTY'); - $this->type('CRM_Contact_Form_Search_Builder-rows-per-page-select', '100'); - $this->waitForElementPresent('CRM_Contact_Form_Search_Builder-rows-per-page-select'); $this->assertTrue($this->isTextPresent($firstName)); $firstName4 = "AB" . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index 93bcb4f1ed..59f40ca743 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -151,7 +151,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", "$lastName $firstName"); $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); - $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']"); + $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", FALSE); $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); //View Contribution Record and verify data