From 9fdcdf6f8151140ed90fea8c0d79e111a1b67537 Mon Sep 17 00:00:00 2001 From: Web Access Date: Mon, 9 Nov 2015 18:50:29 +0530 Subject: [PATCH] Webtests Fixes - Master --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 2 ++ .../WebTest/Activity/ContactContextAddTest.php | 6 ++---- .../WebTest/Campaign/SurveyUsageScenarioTest.php | 6 ++---- tests/phpunit/WebTest/Case/AddCaseTypeTest.php | 5 +++-- .../phpunit/WebTest/Contact/MergeContactsTest.php | 10 +++++----- .../WebTest/Financial/FinancialAccountTypeTest.php | 14 +++++++------- tests/phpunit/WebTest/Report/AddTest.php | 8 ++++---- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 11926a3ebe..c72bc9fded 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -2522,7 +2522,9 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->type("last_name", $lastName); //address section + $this->waitForElementPresent('street_address-1'); $this->type("street_address-1", "902C El Camino Way SW"); + $this->waitForElementPresent('city-1'); $this->type("city-1", "Dumfries"); $this->type("postal_code-1", "1234"); $this->assertSelected('country-1', "UNITED STATES"); diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index 6faf6bfa9a..af0c801153 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -44,7 +44,6 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->webtestAddContact($firstName1, "Summerson", $firstName1 . "@summerson.name"); $firstName2 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName2, "Anderson", $firstName2 . "@anderson.name"); - $this->click("css=li#tab_activity a"); // waiting for the activity dropdown to show up @@ -116,11 +115,10 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // Is status message correct? $this->waitForText('crm-notification-container', $subject); - - $this->waitForElementPresent("xpath=//div[@class='crm-activity-selector-activity']/div[2]/table/tbody/tr[2]/td[8]/span[1]/a[1][text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[8]/span[1]/a[1][text()='View']"); // click through to the Activity view screen - $this->click("xpath=//div[@class='crm-activity-selector-activity']/div[2]/table/tbody/tr[2]/td[8]/span[1]/a[1][text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[8]/span[1]/a[1][text()='View']"); $this->waitForElementPresent('_qf_Activity_cancel-bottom'); // verify Activity created diff --git a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php index 69f9888332..734aef7def 100644 --- a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php @@ -233,10 +233,10 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->select('task', "Record Survey Responses"); $this->waitForElementPresent("_qf_Interview_cancel_interview"); $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[@class='result']/select", "value=Label $title 1"); - $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/a"); + $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[9]/a[1]"); $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[@class='result']/select", "value=Label $title 2"); - $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/a"); + $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[9]/a[1]"); $this->click("_qf_Interview_cancel_interview"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -603,8 +603,6 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->waitForElementPresent('activity_survey_id'); $this->select('activity_survey_id', "label=$surveyTitle"); $this->click('_qf_Search_refresh'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']"); $this->verifyText("xpath=//table[@class='selector row-highlight']/tbody//tr/td[5]/a[text()='Smith, $firstName1']/../../td[3]", preg_quote("$surveyTitle - Respondent Interview") diff --git a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php index 4de0a8f0a2..8a435badbb 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php @@ -91,7 +91,7 @@ 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->select("case_type_id", "label=$caseTypeLabel"); $this->waitForElementPresent('status_id'); $this->select("status_id", "label={$caseStatusLabel}"); @@ -109,6 +109,7 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { } $this->click("xpath=//div[contains(text(), 'Roles')]"); + $this->waitForAjaxContent(); // check that expected roles are listed in the Case Roles pane foreach ($caseRoles as $key => $role) { @@ -133,7 +134,7 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { $this->type('title', $editCaseTypeLabel); $this->select2("xpath=//div[@id='crm-main-content-wrapper']/div/div/form/div/div[4]/table/tfoot/tr/td/span/div/a", 'Sibling of', FALSE, TRUE); - $this->click("xpath=//*[@id='crm-main-content-wrapper']/div/div/form/div/div[4]/table/tbody/tr[4]/td[2]/input[@type='checkbox']"); + $this->click("xpath=//form[@name='editCaseTypeForm']/div/div[4]/table/tbody/tr[4]/td[2]/input[@type='checkbox']"); $this->click("xpath=//a[text()='Standard Timeline']"); $this->select2("xpath=//tr[@class='addRow']/td/span[@placeholder='Add activity']/div/a", 'SMS', FALSE, TRUE); diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 417c986962..228ea1973d 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -384,7 +384,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent('dupePairs_length'); $this->select("name=dupePairs_length", "value=100"); $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']"); - $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); + $this->click("xpath=//a[text()='$firstName $lastName']/../../td[8]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(overwrite)']", FALSE); $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[5]/td[4]/span[text()='(add)']"); @@ -473,8 +473,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Select the contacts to be merged $this->waitForElementPresent('dupePairs_length'); $this->select("name=dupePairs_length", "value=100"); - $this->waitForElementPresent("xpath=//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']"); - $this->click("xpath=//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[4]/a[text()='merge']"); + $this->waitForElementPresent("xpath=//table[@id='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']"); + $this->click("xpath=//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[8]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']"); $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']"); @@ -857,9 +857,9 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "Relationship created."); $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[text()='View']"); - $this->waitForElementPresent("xpath=//a[text()='$sortName']"); + $this->waitForAjaxContent(); $this->click("xpath=//a[text()='$sortName']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForAjaxContent(); // Check if Membership for the individual is created $this->waitForElementPresent("xpath=//li[@id='tab_member']/a/em"); diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php index a97f2b6b36..b2ca872a22 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php @@ -64,7 +64,7 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { ); $this->waitForElementPresent('newFinancialType'); - $this->click("xpath=id('ltype')/div/table/tbody/tr/td[1]/div[text()='$financialType[name]']/../../td[7]/span/a[text()='Accounts']"); + $this->click("xpath=id('ltype')/div/table/tbody//tr/td[1]/div[text()='$financialType[name]']/../../td[7]/span/a[text()='Accounts']"); $this->waitForElementPresent('newfinancialTypeAccount'); foreach ($expected as $value => $label) { @@ -72,10 +72,10 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { } $this->openCiviPage('admin/financial/financialType', 'reset=1', 'newFinancialType'); - $this->verifyText("xpath=id('ltype')/div/table/tbody/tr/td[1]/div[text()='$financialType[name]']/../../td[3]", 'Accounts Receivable,Banking Fees,Premiums,' . $financialType['name']); - $this->click("xpath=id('ltype')/div/table/tbody/tr/td[1]/div[text()='$financialType[name]']/../../td[7]/span/a[text()='Accounts']"); + $this->verifyText("xpath=id('ltype')/div/table/tbody//tr/td[1]/div[text()='$financialType[name]']/../../td[3]", 'Accounts Receivable,Banking Fees,Premiums,' . $financialType['name']); + $this->click("xpath=id('ltype')/div/table/tbody//tr/td[1]/div[text()='$financialType[name]']/../../td[7]/span/a[text()='Accounts']"); $this->waitForElementPresent('newfinancialTypeAccount'); - $this->click("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Banking Fees']/../td[7]/span/a[text()='Edit']"); + $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[2][text()='Banking Fees']/../td[7]/span/a[text()='Edit']"); $this->waitForElementPresent('_qf_FinancialTypeAccount_next'); $this->select('account_relationship', "value=select"); $this->waitForElementPresent("xpath=//select[@id='account_relationship']/option[text()='- Select Financial Account Relationship -']"); @@ -83,9 +83,9 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']"); $this->select('financial_account_id', "label=Premiums inventory"); $this->click('_qf_FinancialTypeAccount_next'); - $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Premiums inventory']/../td[7]/span/a[text()='Edit']"); - $this->verifyText("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Premiums inventory']/../td[1]", preg_quote('Premiums Inventory Account is')); - $this->clickLink("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='Premiums inventory']/../td[7]/span/a[text()='Delete']", '_qf_FinancialTypeAccount_next-botttom', FALSE); + $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[2][text()='Premiums inventory']/../td[7]/span/a[text()='Edit']"); + $this->verifyText("xpath=//div[@id='ltype']/div/table/tbody//tr/td[2][text()='Premiums inventory']/../td[1]", preg_quote('Premiums Inventory Account is')); + $this->clickLink("xpath=//div[@id='ltype']/div/table/tbody//tr/td[2][text()='Premiums inventory']/../td[7]/span/a[text()='Delete']", '_qf_FinancialTypeAccount_next-botttom', FALSE); $this->click('_qf_FinancialTypeAccount_next-botttom'); $this->waitForText('crm-notification-container', 'Selected financial type account has been deleted.'); diff --git a/tests/phpunit/WebTest/Report/AddTest.php b/tests/phpunit/WebTest/Report/AddTest.php index cb52bb823d..8e7852a2a9 100644 --- a/tests/phpunit/WebTest/Report/AddTest.php +++ b/tests/phpunit/WebTest/Report/AddTest.php @@ -70,7 +70,7 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { $this->assertElementContainsText('css=td.crm-report-civicrm_email_email', $emailId, "Email did not found!"); // check criteria - $this->click("xpath=//div[@id='mainTabContainer']/ul/li[3]/a"); + $this->click("xpath=//div[@id='mainTabContainer']/ul//li/a[text()='Filters']"); $this->waitForElementPresent("xpath=//div[@class='crm-submit-buttons']"); // Is Contact Name filter? @@ -88,7 +88,7 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { $reportDescription = "New Contact Summary Report"; $emaiSubject = "Contact Summary Report"; $emailCC = "tesmail@example.org"; - $this->click("xpath=//div[@id='mainTabContainer']/ul/li[4]/a"); + $this->click("xpath=//div[@id='mainTabContainer']/ul//li/a[text()='Developer']"); $this->waitForElementPresent("xpath=//div[@class='crm-submit-buttons']"); $this->click("_qf_Summary_submit_save"); @@ -103,7 +103,7 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_Summary_submit_save'); // Fill Email Subject - $this->click("xpath=//div[@id='mainTabContainer']/ul/li[5]/a"); + $this->click("xpath=//div[@id='mainTabContainer']/ul//li/a[text()='Title and Format']"); $this->waitForAjaxContent(); $this->type("email_subject", $emaiSubject); @@ -116,7 +116,7 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { $this->type("email_cc", $emailCC); // We want navigation menu - $this->click("xpath=//div[@id='mainTabContainer']/ul/li[6]/a"); + $this->click("xpath=//div[@id='mainTabContainer']/ul//li/a[text()='Email Delivery']"); $this->click("is_navigation"); // Navigation menu under Reports section -- 2.25.1