From 2913f26f235c5158ec195feeb752df15cec284dc Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 19 Sep 2014 18:17:55 +0530 Subject: [PATCH] Webtest fix --- .../WebTest/Case/CaseDashboardTest.php | 41 +++++++++++++++++++ .../phpunit/WebTest/Contact/GroupAddTest.php | 2 +- .../OfflineRecurContributionTest.php | 6 +-- .../Contribute/UpdateContributionTest.php | 1 + tests/phpunit/WebTest/Event/AddEventTest.php | 2 +- .../WebTest/Pledge/AddCancelPaymentTest.php | 5 ++- 6 files changed, 50 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/WebTest/Case/CaseDashboardTest.php b/tests/phpunit/WebTest/Case/CaseDashboardTest.php index 8442d855df..86d5d93bba 100644 --- a/tests/phpunit/WebTest/Case/CaseDashboardTest.php +++ b/tests/phpunit/WebTest/Case/CaseDashboardTest.php @@ -68,6 +68,47 @@ class WebTest_Case_CaseDashboardTest extends CiviSeleniumTestCase { $this->clickLink("name=find_my_cases", "css=input.crm-form-submit"); $this->assertTrue($this->isChecked("name=case_owner value=2"), 'Find my cases button not properly setting search form value to my cases.'); + //Add case to get drilldown cell on Case dashboard + $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); + + // Adding contact with randomized first name (so we can then select that contact when creating case) + // We're using pop-up New Contact dialog + $firstName = substr(sha1(rand()), 0, 7); + $lastName = "Fraser"; + $contactName = "{$lastName}, {$firstName}"; + $displayName = "{$firstName} {$lastName}"; + $email = "{$lastName}.{$firstName}@example.org"; + $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id"); + + // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files. + $caseTypeLabel = "Adult Day Care Referral"; + // activity types we expect for this case type + $activityTypes = array("ADC referral", "Follow up", "Medical evaluation", "Mental health evaluation"); + $caseRoles = array("Senior Services Coordinator", "Health Services Coordinator", "Benefits Specialist", "Client"); + $caseStatusLabel = "Ongoing"; + $subject = "Safe daytime setting - senior female"; + $this->select("medium_id", "value=1"); + $location = "Main offices"; + $this->type("activity_location", $location); + $details = "65 year old female needs safe location during the day for herself and her dog. She is in good health but somewhat disoriented."; + $this->fireEvent('activity_details', 'focus'); + $this->fillRichTextField("activity_details", $details, 'CKEditor'); + $this->type("activity_subject", $subject); + + $this->select("case_type_id", "label={$caseTypeLabel}"); + $this->select("status_id", "label={$caseStatusLabel}"); + + // Choose Case Start Date. + // Using helper webtestFillDate function. + $this->webtestFillDate('start_date', 'now'); + $today = date('F jS, Y', strtotime('now')); + + $this->type("duration", "20"); + $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom"); + + // Is status message correct? + $this->waitForText('crm-notification-container', "Case opened successfully."); + // Go back to dashboard $this->openCivipage('case', 'reset=1', 'css=a.button'); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 9160f210c4..dbcadb778e 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -82,7 +82,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { //search groups using created by $this->type('created_by', $createdBy); - $this->clickLink('_qf_Search_refresh'); + $this->click('_qf_Search_refresh'); //show maximum no. of groups on first result set page //as many groups can be created by same creator diff --git a/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php index 757093533b..bda57804e7 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php @@ -62,8 +62,8 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa $this->waitForElementPresent('payment_processor_id'); $this->select('payment_processor_id', "label={$processorName}"); - $this->click('financial_type_id'); - $this->select('financial_type_id', 'label=Donation'); + $this->click('financial_type_id'); + $this->select('financial_type_id', 'label=Donation'); $this->type('total_amount', '10'); // recurring contribution fields @@ -73,7 +73,7 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa $this->type('installments', '12'); $this->click('is_email_receipt'); - $this->waitForElementPresent('credit_card_type'); + $this->waitForElementPresent('credit_card_type'); // enter credit card info on form $this->webtestAddCreditCardDetails(); diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index c65c400219..fabf2eb9be 100755 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -279,6 +279,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { //change payment processor to newly created value $this->select("payment_instrument_id", "label=$label"); $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE); + $this->waitForAjaxContent(); //Assertions $subtractedTotal = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account'); $this->assertEquals($subtractedTotal, -$amount, "Verify amount deleted from old account"); diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index 55586c7caa..7729645e75 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -448,7 +448,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { } if ($processorName) { - $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); + $this->check("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']/../input"); } $this->select("financial_type_id", "value=4"); if ($priceSet) { diff --git a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php index c9ac2db2d3..efa7b239a7 100644 --- a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php +++ b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php @@ -76,7 +76,8 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { ); //Edit and add the first payment for 300.00 $this->click('_qf_PledgeView_next-bottom'); - sleep(1); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForAjaxContent(); $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//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); $this->click("xpath=//div[@class='view-content']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a"); @@ -106,7 +107,7 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { $this->click("_qf_ContributionView_cancel-bottom"); $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); - sleep(1); + $this->waitForAjaxContent(); $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]"); -- 2.25.1