From b18eb8e1aeb0fcc0cc7ea6af04115ddffae86635 Mon Sep 17 00:00:00 2001 From: Rohan Katkar Date: Tue, 16 Dec 2014 18:51:56 +0530 Subject: [PATCH] Webtest Fixes --- .../WebTest/ACL/AssignUsersToRolesTest.php | 2 +- .../WebTest/Campaign/OnlineContributionTest.php | 5 ++--- tests/phpunit/WebTest/Case/AddCaseTest.php | 2 +- tests/phpunit/WebTest/Case/AddCaseTypeTest.php | 2 +- .../phpunit/WebTest/Report/LoggingReportTest.php | 16 ++++++++-------- .../WebTest/Report/RolePermissionReportTest.php | 2 +- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php index b3ad43088b..2d86dd8312 100755 --- a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php +++ b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php @@ -78,7 +78,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { //Create role $role = 'role' . substr(sha1(rand()), 0, 7); $this->open($this->sboxPath . "admin/people/permissions/roles"); - $this->waitForElementPresent("edit-add"); + $this->waitForElementPresent("edit-submit"); $this->type("edit-name", $role); $this->click("edit-add"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php index cfe5bd4e4a..6b4ad40cf4 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php @@ -297,12 +297,11 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { //Find Contribution $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); - $this->type("sort_name", "$firstName $lastName"); + $this->type("sort_name", "$lastName $firstName"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); - //View Contribution Record - $this->verifyText("xpath=id('ContributionView')/div[2]/table[1]/tbody/tr[10]/td[2]", preg_quote($campaignTitle)); + $this->verifyText("xpath=id('ContributionView')/div[2]/table[1]/tbody/tr[11]/td[2]", preg_quote($campaignTitle)); } } diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index 4a73b1d08a..9b226b8670 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -168,7 +168,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { function _testVerifyCaseSummary($validateStrings, $activityTypes) { $this->assertStringsPresent($validateStrings); foreach ($activityTypes as $aType) { - $this->assertText("add_activity_type_id", $aType); + $this->assertElementPresent("xpath=//div[@class='case-control-panel']/div/p/select", $aType); } $this->assertElementPresent("link=Assign to Another Client", "Assign to Another Client link is missing."); $this->assertElementPresent("xpath=//a[text()=' Print Report']", "Print Case Summary button is missing."); diff --git a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php index 443eb7b839..b97957f663 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php @@ -100,7 +100,7 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "Case opened successfully."); foreach ($activityTypes as $aType) { - $this->assertText("add_activity_type_id", $aType); + $this->assertElementPresent("xpath=//div[@class='case-control-panel']/div/p/select", $aType); } $this->click("xpath=//div[contains(text(), 'Roles')]"); diff --git a/tests/phpunit/WebTest/Report/LoggingReportTest.php b/tests/phpunit/WebTest/Report/LoggingReportTest.php index 5ce5c1938b..85f01aced6 100644 --- a/tests/phpunit/WebTest/Report/LoggingReportTest.php +++ b/tests/phpunit/WebTest/Report/LoggingReportTest.php @@ -100,15 +100,14 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->type('subject', $noteSubject); $this->type('note', $noteText); $this->click("_qf_Note_upload-top"); - $this->waitForElementPresent("xpath=//div[@id='notes']//a[text()='Edit']"); - $this->click("xpath=//div[@id='notes']//a[text()='Edit']"); - + $this->waitForElementPresent("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[1]/a[2][text()='Edit']"); + $this->click("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[1]/a[2][text()='Edit']"); $this->waitForElementPresent("_qf_Note_upload-top"); $this->type('subject', $noteSubject . "_edited"); $this->type('note', $noteText . "_edited"); $this->clickLink("_qf_Note_upload-top", "xpath=//div[@class='crm-results-block']/div[@id='notes']/div/table/tbody/tr//td/span[2]/ul/li[2]/a[text()='Delete']", FALSE); - $this->click("xpath=//div[@class='crm-results-block']/div[@id='notes']/div/table/tbody/tr//td/span[2]/ul/li[2]/a[text()='Delete']"); + $this->click("xpath=//div[@id='notes']/div/table/tbody/tr/td[7]/span[2]/ul/li[2]/a[text()='Delete']"); // Check confirmation alert. $this->waitForText("xpath=//form[@id='Note']/div[@class='view-content']/div[@class='status']", "Are you sure you want to delete the note ''?"); $this->click("xpath=//input[@id='_qf_Note_next']"); @@ -123,8 +122,9 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->select("relationship_type_id", "label=Employee of"); $this->select2('related_contact_id', 'Default', TRUE); $this->click('_qf_Relationship_upload-bottom'); - $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']"); - $this->click("xpath=//div[@class='crm-contact-relationship-current']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']"); + $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']"); + + $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Disable']"); $this->waitForText("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']", 'Are you sure you want to disable this relationship?'); $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[text()='Yes']"); $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-past']/div//table/tbody//tr/td[9]/span[2][text()='more']/ul/li[2]/a[text()='Delete']"); @@ -164,8 +164,8 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->type('activity_subject',"subject".rand()); $this->select('case_type_id','value=1'); $this->click('_qf_Case_upload-bottom'); - $this->waitForElementPresent("xpath=//div[@class='view-content']/table[@class='caseSelector']/tbody/tr[2]/td[9]//span//a[text()='Manage']"); - $this->click("xpath=//div[@class='view-content']/table[@class='caseSelector']/tbody/tr[2]/td[9]//span//a[text()='Manage']"); + $this->waitForElementPresent("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']"); + $this->click("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']"); $this->waitForElementPresent("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a"); $this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a"); $this->waitForElementPresent("_qf_Activity_cancel-bottom"); diff --git a/tests/phpunit/WebTest/Report/RolePermissionReportTest.php b/tests/phpunit/WebTest/Report/RolePermissionReportTest.php index 7156faef3a..7ef4a566fe 100644 --- a/tests/phpunit/WebTest/Report/RolePermissionReportTest.php +++ b/tests/phpunit/WebTest/Report/RolePermissionReportTest.php @@ -76,7 +76,7 @@ class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase { // change report setting to for a particular role $this->openCiviPage('report/instance/1', 'reset=1'); - $this->click("css=div.crm-report_setting-accordion div.crm-accordion-header"); + $this->click("xpath=//div[@id='mainTabContainer']/ul/li[6]/a"); $this->waitForElementPresent("_qf_Summary_submit_save"); $this->select("permission", "value=access CiviCRM"); $this->select("grouprole-f", "value=$role1"); -- 2.25.1