From 77f1e6b1552fd81d1a6243f5ca3c22319a45397f Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 7 Apr 2014 19:51:33 +0530 Subject: [PATCH] Web Test Fixes --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 3 +-- .../Contribute/ContributionPageAddTest.php | 21 ++++++++++--------- .../WebTest/Profile/ProfileAddTest.php | 9 +++----- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index c4be6ed3ba..5e82d8f44b 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -930,7 +930,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->type('label_1', "Label $hash"); $this->type('value_1', "$rand"); } - $this->click('CIVICRM_QFID_1_2'); + $this->click('CIVICRM_QFID_1_4'); } else { $this->click('amount_block_is_active'); @@ -1509,7 +1509,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->uncheck('is_default'); } $this->click('_qf_FinancialAccount_next-botttom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); } /** diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index 03621677d5..b88561758d 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -214,6 +214,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->type('first_name', $firstName); $this->type('last_name', $lastName); + $this->select('state_province-1',"value=1002"); $this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom'); $this->click('_qf_Confirm_next-bottom'); @@ -228,7 +229,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->type('sort_name', "$firstName $lastName"); $this->select('financial_type_id',"label=Member Dues"); $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'); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE); $expected = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Member Dues', @@ -247,7 +248,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->select('financial_type_id',"label=Donation"); $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'); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE); $expected = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Donation', @@ -259,8 +260,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { //Find Member $this->openCiviPage("member/search", "reset=1", 'member_source'); $this->type('sort_name', "$firstName $lastName"); - $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->clickLink("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_MembershipView_cancel-bottom'); + $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", FALSE); + $this->clickLink("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_MembershipView_cancel-bottom', FALSE); //View Membership Record $expected = array( @@ -334,7 +335,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->type('value_2', 2); $this->type('label_3', 'Fixed Amount 3'); $this->type('value_3', 3); - $this->click('CIVICRM_QFID_1_2'); + $this->click('CIVICRM_QFID_1_4'); $this->click('_qf_Amount_submit_savenext-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -382,10 +383,10 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->click('_qf_SearchContribution_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->isElementPresent("xpath=//table[@id='option11_wrapper']/tbody/tr/td/strong[text()='$pageTitle']"); - $this->waitForElementPresent("xpath=//table[@id='option11']/tbody/tr/td[5]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']"); - $this->click("xpath=//table[@id='option11']/tbody/tr/td[5]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']"); - $this->waitForElementPresent("xpath=//table[@id='option11']/tbody/tr/td[5]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']"); - $this->click("xpath=//table[@id='option11']/tbody/tr/td[5]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']"); + $this->waitForElementPresent("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']"); + $this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']"); + $this->waitForElementPresent("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']"); + $this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForElementPresent('premiums_active'); $this->waitForElementPresent('_qf_Premium_cancel-bottom'); @@ -410,7 +411,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { // check if clicking Save & Next button // required validation error appears // for No Thank-you Label textfield - $this->waitForElementPresent("xpath=//ul[@id='errorList']"); + $this->waitForElementPresent("xpath=//*[@id='premiumSettings']/div/div[2]/table/tbody/tr[6]/td[2]/span[1]"); $this->assertTrue($this->isTextPresent($premiumRequiredText)); // fill in value for Premiums No Thank-you Label textfield diff --git a/tests/phpunit/WebTest/Profile/ProfileAddTest.php b/tests/phpunit/WebTest/Profile/ProfileAddTest.php index 984a58ead1..ba37922251 100644 --- a/tests/phpunit/WebTest/Profile/ProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileAddTest.php @@ -190,7 +190,6 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $this->openCiviPage('group', 'reset=1'); $this->type('title', $groupName); $this->click('_qf_Search_refresh'); - $this->waitForVisible('crm-group-selector_processing'); $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[contains(., '$groupName')]/following-sibling::td[@class='crm-group-group_links']/span/a"); $this->clickLink("xpath=//table[@id='crm-group-selector']/tbody/tr/td[1][contains(., '$groupName')]/following-sibling::td[@class='crm-group-group_links']/span/a"); $contactEmails = array( @@ -280,16 +279,14 @@ 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']/div[4]/a[2]"); - $this->waitForElementPresent("xpath=//div[@id='field_page']/div[4]/a[4]"); - $this->waitForElementPresent("xpath=//div[@id='field_page']/div[3]/table/tbody/tr[1]/td[9]/span/a[text()='Edit']"); + $this->waitForElementPresent("xpath=//div[@id='field_page']/div[2]/table/tbody/tr[1]/td[9]/span/a[text()='Edit']"); // extract profile Id - $id = explode("gid=", $this->getAttribute("xpath=//div[@id='field_page']/div[3]/table/tbody/tr/td[9]/span/a[text()='Edit']/@href")); + $id = explode("gid=", $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody/tr/td[9]/span/a[text()='Edit']/@href")); $id = $id[1]; // click on Edit Settings - $this->clickLink("xpath=//div[@id='field_page']/div[4]/a[2]", '_qf_Group_next-bottom'); + $this->clickLink("xpath=//div[@id='field_page']/div[3]/a[2]", '_qf_Group_next-bottom', FALSE); // check for description field $this->waitForElementPresent('description'); -- 2.25.1