From ea83a78e6cf6a77d127756da6677371704086e62 Mon Sep 17 00:00:00 2001 From: pratikshad Date: Thu, 9 Apr 2015 15:02:54 +0530 Subject: [PATCH] Fixed webtest for civi-4.6 --- tests/phpunit/WebTest/Case/AddCaseTypeTest.php | 6 +++--- .../Contribute/UpdateBatchPendingContributionTest.php | 2 +- .../phpunit/WebTest/Contribute/UpdateContributionTest.php | 3 +++ tests/phpunit/WebTest/Event/AddPricesetTest.php | 4 ++-- tests/phpunit/WebTest/Mailing/ABMailingTest.php | 8 ++++---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php index f571ff78d7..63dea94cd7 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php @@ -76,7 +76,7 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { $this->select2("xpath=//tr[@class='addRow']/td[contains(text(),'Add activity:')]/span/div/a", $tActivityType, FALSE, TRUE); } - $this->clickAjaxLink("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']"); + $this->click('css=.crm-submit-buttons button:first-child'); $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); $client = $this->createDialogContact("client_id"); @@ -126,7 +126,7 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//*[@id='crm-main-content-wrapper']/div/div/div[2]/a/span[contains(text(),'New Case Type')]"); $this->click("xpath=//table/tbody//tr/td[1][text()='{$caseTypeLabel}']/../td[5]/span/a[text()='Edit']"); - $this->waitForElementPresent("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']"); + $this->waitForElementPresent("css=.crm-submit-buttons button:first-child"); $editCaseTypeLabel = "Case Type Edit" . substr(sha1(rand()), 0, 7); $this->waitForElementPresent('title'); @@ -138,7 +138,7 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { $this->click("xpath=//a[text()='Standard Timeline']"); $this->select2("xpath=//tr[@class='addRow']/td[contains(text(),'Add activity:')]/span/div/a", 'SMS', FALSE, TRUE); - $this->click("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']"); + $this->click('css=.crm-submit-buttons button:first-child'); $this->waitForElementPresent("xpath=//*[@id='crm-main-content-wrapper']/div/div/div[2]/a/span[contains(text(),'New Case Type')]"); $this->verifyText("xpath=//table/tbody//tr/td[contains(text(),'$editCaseTypeLabel')]", $editCaseTypeLabel); diff --git a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php index 12a96b50cb..a31334f684 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php @@ -117,7 +117,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->waitForElementPresent("contribution_date_low"); $this->type("sort_name", "Anderson"); - $this->click('contribution_status_id'); + $this->multiselect2('contribution_status_id', array("Completed")); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index 96f5994046..d79fb2e4f5 100755 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -56,6 +56,9 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE); $this->type("total_amount", "90"); $this->clickLink('_qf_Contribution_upload', '', FALSE); + $this->waitForText('crm-notification-container', "The sum of fee amount and net amount must be equal to total amount"); + $this->type("net_amount", "90"); + $this->clickLink('_qf_Contribution_upload', '', FALSE); // Is status message correct? $this->waitForText('crm-notification-container', "The contribution record has been saved."); diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 8576c3a0a6..0d0f2d9a72 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -711,6 +711,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { // Enter Event Title, Summary and Description $this->select("event_type_id", "value=4"); $this->select("default_role_id", "value=1"); + $this->waitForAjaxContent(); $this->type("title", "Test Event"); $this->type("summary", "This is a great conference. Sign up now!"); @@ -730,8 +731,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table[@id='options']/tbody/tr/td[9]/span[2]"); $this->click("xpath=//table[@id='options']/tbody/tr/td[9]/span[2]/ul/li[2]/a"); //assert the message - $this->waitForText('price_set_used_by', - "it is currently in use by one or more active events or contribution pages or contributions or event templates."); + $this->waitForText('price_set_used_by', "Unable to delete the 'Test Field' Price Field - it is currently in use by one or more active events or contribution pages or contributions or event templates. If you no longer want to use this price set, click the event title below, and modify the fees for that event."); //check the delete for priceset $this->openCiviPage("admin/price", "reset=1"); diff --git a/tests/phpunit/WebTest/Mailing/ABMailingTest.php b/tests/phpunit/WebTest/Mailing/ABMailingTest.php index b9274ca126..6cd93fcffb 100644 --- a/tests/phpunit/WebTest/Mailing/ABMailingTest.php +++ b/tests/phpunit/WebTest/Mailing/ABMailingTest.php @@ -125,7 +125,7 @@ class WebTest_Mailing_ABMailingTest extends CiviSeleniumTestCase { $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$MailingSubject} Webtest.$tokens"); $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']"); - $this->waitForTextPresent("This is text formatted content for Mailing {$MailingSubject} Webtest.$tokens"); + $this->waitForTextPresent("This is text formatted content for Mailing {$MailingSubject} Webtest."); $this->waitForAjaxContent(); $this->click("xpath=//button[@title='Close']"); @@ -297,7 +297,7 @@ class WebTest_Mailing_ABMailingTest extends CiviSeleniumTestCase { $this->type("xpath=//*[@name='body_text']", "This is text formatted content for Mailing {$MailingSubject} Webtest.$tokens"); $this->click("xpath=//div[@class='preview-popup']//a[text()='Preview as Plain Text']"); - $this->waitForTextPresent("This is text formatted content for Mailing {$MailingSubject} Webtest.$tokens"); + $this->waitForTextPresent("This is text formatted content for Mailing {$MailingSubject} Webtest."); $this->waitForAjaxContent(); $this->click("xpath=//button[@title='Close']"); @@ -457,7 +457,6 @@ class WebTest_Mailing_ABMailingTest extends CiviSeleniumTestCase { // fill subject for mailing $BMailingSubject = substr(sha1(rand()), 0, 7); $this->type("xpath=//input[@name='subjectB']", "Test subject {$BMailingSubject} for Webtest"); - $this->waitForElementPresent("xpath=//div[@id='tab-mailingB']//div[text()='Plain Text']"); // HTML format message $BHTMLMessage = "This is HTML formatted content for Mailing {$BMailingSubject} Webtest."; @@ -470,7 +469,8 @@ class WebTest_Mailing_ABMailingTest extends CiviSeleniumTestCase { //$this->click("xpath=//button[@title='Close']"); // Open Plain-text Format pane and type text format msg - $this->click("xpath=//div[@id='tab-mailingB']//div[text()='Plain Text']"); + $this->waitForElementPresent("xpath=//div[@id='tab-mailingB']//div[contains(text(), 'Plain Text')]"); + $this->click("xpath=//div[@id='tab-mailingB']//div[contains(text(), 'Plain Text')]"); $this->type("xpath=//div[@id='tab-mailingB']//*[@name='body_text']", "This is text formatted content for Mailing {$BMailingSubject} Webtest.$tokens"); $this->click("xpath=//div[@crm-mailing='abtest.mailings.b']//div[@class='preview-popup']//a[text()='Preview as Plain Text']"); -- 2.25.1