From 08936462e4a7c5603d494aebffae033c3cc6c20a Mon Sep 17 00:00:00 2001 From: Web Access Date: Fri, 30 Oct 2015 18:45:00 +0530 Subject: [PATCH] Webtest fix --- .../WebTest/Contribute/AddPricesetTest.php | 16 +++++++++++----- .../Contribute/OnlineContributionTest.php | 11 ++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php index 15930a3c72..fa8b8c5cc8 100644 --- a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php @@ -378,8 +378,9 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $firstName = 'Ma' . substr(sha1(rand()), 0, 4); $lastName = 'An' . substr(sha1(rand()), 0, 7); + $email = $firstName . "@example.com"; $this->waitForElementPresent('_qf_Main_upload-bottom'); - $this->type('email-5', $firstName . '@example.com'); + $this->type("email-5", $email); $this->type("xpath=//input[@class='four crm-form-text required']", "1"); $this->click("xpath=//input[@class='crm-form-radio']"); $this->click("xpath=//input[@class='crm-form-checkbox']"); @@ -420,13 +421,15 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low'); $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); - $this->type('sort_name', "$lastName $firstName"); + $this->type("sort_name", "$email"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='crm-accordion-wrapper crm-contribution_search_form-accordion ']/div[2]/table/tbody/tr[8]/td[1]/table/tbody/tr[3]/td[2]/label[1]"); $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 and test for expected values $expected = array( - 'From' => "{$firstName} {$lastName}", + 'From' => "{$email}", 'Financial Type' => $financialType, // as per changes made in CRM-15407 'Fee Amount' => '$ 1.50', @@ -500,8 +503,9 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $firstName = 'Ma' . substr(sha1(rand()), 0, 4); $lastName = 'An' . substr(sha1(rand()), 0, 7); + $email = $firstName . "@example.com"; $this->waitForElementPresent('_qf_Main_upload-bottom'); - $this->type('email-5', $firstName . '@example.com'); + $this->type('email-5', $email); $this->click("xpath=//input[@class='crm-form-radio']"); $this->click("xpath=//input[@class='crm-form-checkbox']"); @@ -538,7 +542,9 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { //Find Contribution $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low'); $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); - $this->type('sort_name', "$lastName $firstName"); + $this->type("sort_name", "$email"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='crm-accordion-wrapper crm-contribution_search_form-accordion ']/div[2]/table/tbody/tr[8]/td[1]/table/tbody/tr[3]/td[2]/label[1]"); $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", FALSE); $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE); diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index 945a0fdeda..bc77c29a82 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -268,8 +268,8 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $firstName = 'Ma' . substr(sha1(rand()), 0, 4); $lastName = 'An' . substr(sha1(rand()), 0, 7); - - $this->type("email-5", $firstName . "@example.com"); + $email = $firstName . "@example.com"; + $this->type("email-5", $email); if ($priceSet) { $this->click("xpath=//div[@id='priceset']/div/div[2]/div/span/input"); @@ -303,14 +303,15 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { //Find Contribution $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); - - $this->type("sort_name", "$lastName $firstName"); + $this->type("sort_name", "$email"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='crm-accordion-wrapper crm-contribution_search_form-accordion ']/div[2]/table/tbody/tr[8]/td[1]/table/tbody/tr[3]/td[2]/label[1]"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", FALSE); $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); //View Contribution Record and verify data $expected = array( - 'From' => "{$firstName} {$lastName}", + 'From' => "{$email}", 'Financial Type' => 'Donation', $amountLabel => $amountValue, 'Contribution Status' => 'Completed', -- 2.25.1