From ca70bd727ddc614701db0410a5af331276b70bc6 Mon Sep 17 00:00:00 2001 From: Rohan Katkar Date: Tue, 9 Sep 2014 09:33:09 +0530 Subject: [PATCH] Webtest fix --- .../WebTest/Case/ActivityToCaseTest.php | 33 +++++++++++-------- .../WebTest/Pledge/StandaloneAddTest.php | 1 - 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index d9bda6f2c9..df56a55bf8 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -88,7 +88,10 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { function testLinkCases() { $this->webtestLogin(); - + + // Enable CiviCase module if necessary + $this->enableComponents("CiviCase"); + //Add Case 1 $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); @@ -283,15 +286,18 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', $subject); // click through to the Activity view screen - $this->waitForElementPresent("xpath=//div[@id='contact-activity-selector-activity_wrapper']//table/tbody/tr[1]/td[8]"); - $this->click("xpath=//div[@id='contact-activity-selector-activity_wrapper']//table/tbody/tr[2]/td[8]/span[2]/ul/li/a[text()='File On Case']"); - $this->waitForElementPresent('file_on_case_activity_subject'); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span/a[1][text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span/a[1][text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span[2][text()='more']/ul[1]/li[1]/a"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span[2][text()='more']/ul[1]/li[1]/a"); // file activity on case + $this->waitForElementPresent('file_on_case_unclosed_case_id'); $this->select2('file_on_case_unclosed_case_id', $firstName); $this->assertElementContainsText("xpath=//div[@id='s2id_file_on_case_unclosed_case_id']", "$firstName", 'Contact not found in line ' . __LINE__); + $this->type('file_on_case_activity_subject', $subject); $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Save']"); - $this->waitForElementPresent("xpath=//div[@id='contact-activity-selector-activity_wrapper']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span/a[1][text()='View']"); // verify if custom data is present $this->openCiviPage('case', 'reset=1'); @@ -305,7 +311,6 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->waitForElementPresent('ActivityView'); $this->waitForElementPresent("css=table#crm-activity-view-table tr.crm-case-activityview-form-block-groupTitle"); - $this->assertElementContainsText('crm-activity-view-table', "$customDataParams[0]"); $this->assertElementContainsText('crm-activity-view-table', "$textField"); $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']"); $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_".$id."']/tbody/tr[1]/td[2]"); @@ -350,6 +355,8 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->select("extends[0]", "value=Activity"); $this->click("//option[@value='Activity']"); $this->click('_qf_Group_next-bottom'); + $this->waitForElementPresent('newCustomField'); + $this->click('newCustomField'); $this->waitForElementPresent('_qf_Field_cancel-bottom'); //Is custom group created? @@ -385,15 +392,15 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->click("is_searchable"); //clicking save - $this->click("_qf_Field_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[1]/span[2]"); //Is custom field created + $this->waitForElementPresent("newCustomField"); $this->waitForText('crm-notification-container', "Custom field '$radioFieldLabel' has been saved."); // create another custom field - text field - $this->click("//a[@id='newCustomField']/span"); - $this->waitForElementPresent('_qf_Field_cancel-bottom'); + $this->click("newCustomField"); + $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[1]/span[2]"); $textFieldLabel = 'Custom Field Text_' . substr(sha1(rand()), 0, 4); $this->type('label', $textFieldLabel); @@ -408,13 +415,13 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->click('is_searchable'); //clicking save - $this->click('_qf_Field_next'); + $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[1]/span[2]"); $this->waitForElementPresent("//a[@id='newCustomField']/span"); //Is custom field created $this->waitForText('crm-notification-container', "Custom field '$textFieldLabel' has been saved."); - $this->waitForElementPresent("xpath=//div[@id='field_page']//div//table/tbody//tr/td/span[text()='$textFieldLabel']"); - $textFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//div//table/tbody//tr/td/span[text()='$textFieldLabel']/../../td[8]/span/a[text()='Edit Field']/@href")); + //$this->waitForElementPresent("xpath=//div[@id='field_page']//div//table/tbody//tr/td/span[text()='$textFieldLabel']"); + $textFieldId = explode('&id=', $this->getAttribute("xpath=//table[@id='options']/tbody//tr/td[1]/span[text()='$textFieldLabel']/../../td[8]/span/a[1][text()='Edit Field']/@href")); $textFieldId = $textFieldId[1]; return array($radioOptionLabel1, "custom_{$textFieldId}_-1"); diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index bcca84a691..1cde952df6 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -91,7 +91,6 @@ class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); } } -- 2.25.1