From: Ravish Nair Date: Tue, 26 Mar 2013 13:24:49 +0000 (+0530) Subject: -- webtest improvements X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2ac4a694c02c3a12edbb13fc06a8d4180b27040a;p=civicrm-core.git -- webtest improvements --- diff --git a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php index e1189771d2..9fd7c93f1c 100644 --- a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php +++ b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php @@ -77,9 +77,6 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { //fill in IM $this->type("im_1_name", "testYahoo"); - //fill in openID - $this->type("openid_1_openid", "http://" . substr(sha1(rand()), 0, 7) . "openid.com"); - //fill in website $this->type("website_1_url", "http://www.john.com"); @@ -172,8 +169,8 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { $this->assertElementContainsText('css=.crm-contact_type_label', "Parent"); //custom data check - $this->assertTrue($this->isTextPresent("dummy text for customData{$customGroupIdForParent}")); - $this->assertTrue($this->isTextPresent("dummy text for customData{$customGroupIdForStudent}")); + $this->waitForText("custom-set-content-{$customGroupIdForParent}", "dummy text for customData{$customGroupIdForParent}"); + $this->waitForText("custom-set-content-{$customGroupIdForStudent}", "dummy text for customData{$customGroupIdForStudent}"); // Get contact id $cid = $this->urlArg('cid'); @@ -208,8 +205,8 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { $this->assertElementContainsText('css=.crm-contact_type_label', "Parent"); //custom data check - $this->assertTrue($this->isTextPresent("dummy text for customData{$customGroupIdForParent}")); - $this->assertTrue($this->isTextPresent("dummy text for customData{$customGroupIdForStaff}")); + $this->waitForText("custom-set-content-{$customGroupIdForParent}", "dummy text for customData{$customGroupIdForParent}"); + $this->waitForText("custom-set-content-{$customGroupIdForStaff}", "dummy text for customData{$customGroupIdForStaff}"); } /** @@ -236,7 +233,7 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_Field_cancel-bottom'); //Is custom group created? - $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added.")); + $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added."); $gid = $this->urlArg('gid'); $fieldLabel = "custom_field_for_{$contactSubType}" . substr(sha1(rand()), 0, 4); diff --git a/tests/phpunit/WebTest/Event/EventListingTest.php b/tests/phpunit/WebTest/Event/EventListingTest.php index c0dd9b2c0f..be6693317e 100644 --- a/tests/phpunit/WebTest/Event/EventListingTest.php +++ b/tests/phpunit/WebTest/Event/EventListingTest.php @@ -44,15 +44,15 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle3); $this->click("_qf_SearchEvent_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("{$eventTitle3}")); + $this->waitForText("SearchEvent", "{$eventTitle3}"); $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle4); $this->click("_qf_SearchEvent_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("{$eventTitle4}")); + $this->waitForText("SearchEvent", "{$eventTitle4}"); $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle5); $this->click("_qf_SearchEvent_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("{$eventTitle5}")); + $this->waitForText("SearchEvent", "{$eventTitle5}"); $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",""); //check if closed Event is present @@ -63,8 +63,8 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { $this->click('_qf_SearchEvent_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("{$eventTitle1}")); - $this->assertTrue($this->isTextPresent("{$eventTitle2}")); + $this->waitForText("option11", "{$eventTitle1}"); + $this->waitForText("option11", "{$eventTitle2}"); $this->assertFalse($this->isTextPresent("{$eventTitle3}")); $this->assertFalse($this->isTextPresent("{$eventTitle4}")); $this->assertFalse($this->isTextPresent("{$eventTitle5}")); @@ -73,9 +73,9 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { $this->openCiviPage("event/ical", "reset=1&page=1&html=1", NULL); $this->assertFalse($this->isTextPresent("{$eventTitle1}")); $this->assertFalse($this->isTextPresent("{$eventTitle2}")); - $this->assertTrue($this->isTextPresent("{$eventTitle3}")); - $this->assertTrue($this->isTextPresent("{$eventTitle4}")); - $this->assertTrue($this->isTextPresent("{$eventTitle5}")); + $this->waitForText("option11", "{$eventTitle3}"); + $this->waitForText("option11", "{$eventTitle4}"); + $this->waitForText("option11", "{$eventTitle5}"); //go to block listing to enable Upcomming Events Block // you need to be admin user for below operation @@ -98,8 +98,8 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { $this->assertFalse($this->isTextPresent("{$eventTitle1}")); $this->assertFalse($this->isTextPresent("{$eventTitle2}")); $this->assertFalse($this->isTextPresent("{$eventTitle3}")); - $this->assertTrue($this->isTextPresent("{$eventTitle4}")); - $this->assertTrue($this->isTextPresent("{$eventTitle5}")); + $this->waitForText("block-civicrm-6", "{$eventTitle4}"); + $this->waitForText("block-civicrm-6", "{$eventTitle5}"); //go to block listing to disable Upcomming Events Block $this->open($this->sboxPath . 'admin/structure/block'); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index 22f417dad6..3c700fc0c4 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -50,7 +50,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { // this contribution page for membership signup // select newly created processor $xpath = "xpath=//label[text() = '{$processorName}']/preceding-sibling::input[1]"; - $this->assertTrue($this->isTextPresent($processorName)); + $this->waitForText('css=.crm-contribution-contributionpage-amount-form-block-payment_processor', $processorName); $this->check($xpath); // save @@ -224,7 +224,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { //this contribution page for membership signup $xpath = "xpath=//label[text() = '{$processorName}']/preceding-sibling::input[1]"; - $this->assertTrue($this->isTextPresent($processorName)); + $this->waitForText('css=.crm-contribution-contributionpage-amount-form-block-payment_processor', $processorName); $this->check($xpath); // save @@ -378,7 +378,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->click('_qf_Contact_upload_view'); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Organization $title has been created.")); + $this->waitForText('crm-notification-container', "Organization $title has been created."); $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); @@ -404,7 +404,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->click('_qf_MembershipType_upload-bottom'); $this->waitForElementPresent('link=Add Membership Type'); - $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved.")); + $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved."); $url = $this->getAttribute("xpath=//div[@id='membership_type']//div[@class='dataTables_wrapper']//table/tbody//tr/td[1][text()='{$membershipTypeTitle}']/../td[12]/span/a[3][text()='Delete']/@href");