From: Ravish Nair Date: Mon, 1 Apr 2013 10:48:02 +0000 (+0530) Subject: -- webtest improvement X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d226f7d8809b40c88cdc04540983431585534ecd;p=civicrm-core.git -- webtest improvement --- diff --git a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php index 459377b12f..cd211e813f 100644 --- a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php @@ -90,10 +90,9 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { $this->select("status_id", "value=2"); // click save - $this->click("_qf_Campaign_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Campaign_upload-bottom'); - $this->assertTrue($this->isTextPresent("Campaign $title Campaign has been saved."), "Status message didn't show up after saving!"); + $this->waitForText('crm-notification-container', "Campaign $title Campaign has been saved."); ////////////// Create petition using New Individual profile ////////////////////// @@ -113,10 +112,9 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { $this->select("contact_profile_id", "value=4"); // click save - $this->click("_qf_Petition_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Petition_next-bottom'); - $this->assertTrue($this->isTextPresent("Petition has been saved.")); + $this->waitForText('crm-notification-container', "Petition has been saved."); $this->waitForElementPresent("link=Add Petition"); @@ -151,9 +149,8 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { $this->type("email-Primary", $email); // click Sign the petition. - $this->click("_qf_Signature_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Thank You")); + $this->clickLink('_qf_Signature_next-bottom', NULL); + $this->waitForText('page-title', "Thank You"); // login $this->webtestLogin(); @@ -207,10 +204,9 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { $this->fillRichTextField('thankyou_text', "Thank you for your kind contribution to support $title", 'CKEditor'); // click save - $this->click("_qf_Petition_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Petition_next-bottom'); - $this->assertTrue($this->isTextPresent("Petition has been saved.")); + $this->waitForText('crm-notification-container', "Petition has been saved."); $this->waitForElementPresent("link=Add Petition"); @@ -243,12 +239,11 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { $this->type("email-Primary", $email); // click Sign the petition. - $this->click("_qf_Signature_next-bottom"); - $this->waitForElementPresent("thankyou_text"); + $this->clickLink('_qf_Signature_next-bottom', 'thankyou_text'); // check that thank-you page has appropriate title and message - $this->assertTrue($this->isTextPresent("Awesome $title donation")); - $this->assertTrue($this->isTextPresent("Thank you for your kind contribution to support $title")); + $this->waitForText('page-title', "Awesome $title donation"); + $this->waitForText('thankyou_text', "Thank you for your kind contribution to support $title"); // login $this->webtestLogin();