From 933ee1e421f272f15e6c691ba476b8ae57fa68a7 Mon Sep 17 00:00:00 2001 From: Web Access Date: Mon, 4 Jan 2016 18:51:30 +0530 Subject: [PATCH] Webtests Fixes --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 4 ++-- tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php | 1 - tests/phpunit/WebTest/Contact/AddressParsingTest.php | 8 ++++---- tests/phpunit/WebTest/Event/ParticipantCountTest.php | 5 ++--- .../WebTest/Mailing/AddMessageTemplateTest.php | 4 ++-- .../Member/OnlineAutoRenewMembershipGCTest.php | 8 -------- .../WebTest/Member/OnlineMembershipCreateTest.php | 11 ++++++----- 7 files changed, 16 insertions(+), 25 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 1a1cd621eb..05918b957b 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -861,8 +861,8 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { elseif ($processorType == 'Google_Checkout') { // FIXME: we 'll need to make a new separate account for testing $processorSettings = array( - 'test_user_name' => '559999327053114', - 'test_password' => 'R2zv2g60-A7GXKJYl0nR0g', + 'user_name' => '559999327053114', + 'password' => 'R2zv2g60-A7GXKJYl0nR0g', ); } elseif ($processorType == 'PayPal') { diff --git a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php index 10f39e3b24..4d14b863af 100755 --- a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php +++ b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php @@ -153,7 +153,6 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { $label = "TestAclRole" . substr(sha1(rand()), 0, 4); $this->waitForElementPresent("label"); $this->type("label", $label); - $this->type("value", "Acl value" . $label); $this->click("_qf_Options_next-bottom"); $this->waitForText('crm-notification-container', "The ACL Role '{$label}' has been saved."); diff --git a/tests/phpunit/WebTest/Contact/AddressParsingTest.php b/tests/phpunit/WebTest/Contact/AddressParsingTest.php index bdf7b0b0af..1717014a8c 100644 --- a/tests/phpunit/WebTest/Contact/AddressParsingTest.php +++ b/tests/phpunit/WebTest/Contact/AddressParsingTest.php @@ -137,8 +137,8 @@ class WebTest_Contact_AddressParsingTest extends CiviSeleniumTestCase { ), 2 => array( 'street_number' => '121', - 'street_name' => 'Sherman Street', - 'street_unit' => '#15', + 'street_name' => 'SW Sherman Way', + 'street_unit' => 'Suite 15', ), 3 => array( 'street_number' => '121', @@ -147,8 +147,8 @@ class WebTest_Contact_AddressParsingTest extends CiviSeleniumTestCase { ), 4 => array( 'street_number' => '121', - 'street_name' => 'SW Sherman Way', - 'street_unit' => 'Suite 15', + 'street_name' => 'Sherman Street', + 'street_unit' => '#15', ), ); foreach ($verifyData as $loc => $values) { diff --git a/tests/phpunit/WebTest/Event/ParticipantCountTest.php b/tests/phpunit/WebTest/Event/ParticipantCountTest.php index 036c947959..da22922aec 100644 --- a/tests/phpunit/WebTest/Event/ParticipantCountTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantCountTest.php @@ -219,7 +219,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { $this->click('link=Register Now'); $this->waitForElementPresent('_qf_Register_upload-bottom'); - $this->type("xpath=//input[@class='four crm-form-text required']", '1'); + $this->type("xpath=//div[@id='priceset']/div[@class='crm-section full_conference-section']//div/input[@class='four crm-form-text required']", '1'); $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org'; $participants[1] = array( @@ -253,8 +253,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { // register for event $this->click('link=Register Now'); $this->waitForElementPresent('_qf_Register_upload-bottom'); - - $this->type("xpath=//input[@class='four crm-form-text required']", '2'); + $this->type("xpath=//div[@id='priceset']/div[@class='crm-section full_conference-section']//div/input[@class='four crm-form-text required']", '2'); $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org'; $participants[2] = array( diff --git a/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php b/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php index a5aa507134..446588ff85 100644 --- a/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php +++ b/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php @@ -80,10 +80,10 @@ class WebTest_Mailing_AddMessageTemplateTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "The Message Template '$msgTitle' has been saved."); // Verify text. - $this->assertTrue($this->isElementPresent("xpath=id('user')/div[2]/div[1]/table/tbody//tr/td[1][contains(text(), '$msgTitle')]"), + $this->assertTrue($this->isElementPresent("xpath=id('user')//div//div/table[@class='display dataTable no-footer']/tbody//tr/td[1][contains(text(), '$msgTitle')]"), 'Message Template Title not found!'); if (!$useTokens) { - $this->assertTrue($this->isElementPresent("xpath=id('user')/div[2]/div[1]/table/tbody//tr/td[2][contains(text(), '$msgSubject')]"), + $this->assertTrue($this->isElementPresent("xpath=id('user')//div//div/table[@class='display dataTable no-footer']/tbody//tr/td[2][contains(text(), '$msgSubject')]"), 'Message Subject not found!'); } } diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php index ab76effdc9..15d48f9e99 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php @@ -55,10 +55,6 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); $this->click("_qf_Confirm_next_checkout"); - // Because it tends to cause problems, all uses of sleep() must be justified in comments - // Sleep should never be used for wait for anything to load from the server - // Justification for this instance: FIXME - sleep(5); // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) @@ -88,10 +84,6 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); $this->click("_qf_Confirm_next_checkout"); - // Because it tends to cause problems, all uses of sleep() must be justified in comments - // Sleep should never be used for wait for anything to load from the server - // Justification for this instance: FIXME - sleep(5); // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php index b4d30a770f..73f073ecd1 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php @@ -127,7 +127,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->click("xpath=//tr/td[1]/p/label[contains(text(),'Membership is a Test?')]/../label[contains(text(),'Yes')]/preceding-sibling::input[1]"); $this->type("sort_name", "$lastName $firstName"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr"); - $this->click("xpath=//div[@id='memberSearch']/table/tbody/tr/td[11]/span/a[text()='View']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr/td[11]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); //View Membership Record @@ -232,7 +232,8 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->type("xpath=//div[@class='content other_amount-content']/input", $otherAmount); } if ($payLater) { - $this->click("xpath=//div[@class='crm-section payment_processor-section']/div[2]//label[text()='Pay later label {$hash}']"); + $this->waitForAjaxContent(); + $this->click("xpath=//label[text()='Pay later label {$hash}']"); } $this->type("email-5", $firstName . "@example.com"); $this->waitForElementPresent("first_name"); @@ -349,8 +350,8 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->type("sort_name", "$lastName $firstName"); $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[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); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[10]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); //View Contribution Record and verify data $expected = array( @@ -477,7 +478,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->type("sort_name", "$lastName $firstName"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr"); - $this->click("xpath=//div[@id='memberSearch']/table/tbody/tr/td[11]/span/a[text()='View']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr/td[11]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); //View Membership Record -- 2.25.1