From acd289911733c528bc00afb4781ddc15d7198e97 Mon Sep 17 00:00:00 2001 From: Ravish Nair Date: Mon, 4 Mar 2013 13:37:12 +0530 Subject: [PATCH] -- webtests cleanup --- tests/phpunit/WebTest/Event/EventListingTest.php | 13 +++++-------- tests/phpunit/WebTest/Export/ContactTest.php | 1 - tests/phpunit/WebTest/Mailing/SpoolTest.php | 3 +-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/phpunit/WebTest/Event/EventListingTest.php b/tests/phpunit/WebTest/Event/EventListingTest.php index 4b3fca86fcc..6a75b02fab9 100644 --- a/tests/phpunit/WebTest/Event/EventListingTest.php +++ b/tests/phpunit/WebTest/Event/EventListingTest.php @@ -37,8 +37,7 @@ function testEventListing() { //go to manage event and check for presence of ongoing and //upcomming events - $this->open($this->sboxPath . "civicrm/event/manage?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/manage", "reset=1"); $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle1); $this->click("_qf_SearchEvent_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -76,8 +75,7 @@ function testEventListing() { $this->assertFalse($this->isTextPresent("{$eventTitle5}")); //go to ical and check for presence of ongoing and upcomming events - $this->open($this->sboxPath . "civicrm/event/ical?reset=1&page=1&html=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/ical", "reset=1&page=1&html=1"); $this->assertFalse($this->isTextPresent("{$eventTitle1}")); $this->assertFalse($this->isTextPresent("{$eventTitle2}")); $this->assertTrue($this->isTextPresent("{$eventTitle3}")); @@ -86,8 +84,7 @@ function testEventListing() { //go to block listing to enable Upcomming Events Block // you need to be admin user for below operation - $this->open($this->sboxPath . "civicrm/logout?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("logout", "reset=1"); $this->webtestLogin(TRUE); $this->open($this->sboxPath . 'admin/structure/block/manage/civicrm/6/configure'); @@ -102,7 +99,7 @@ function testEventListing() { $this->waitForTextPresent("The block settings have been updated."); //go to civicrm home and check for presence of upcomming events - $this->open($this->sboxPath . "civicrm/dashboard?reset=1"); + $this->openCiviPage("dashboard", "reset=1"); $this->assertFalse($this->isTextPresent("{$eventTitle1}")); $this->assertFalse($this->isTextPresent("{$eventTitle2}")); $this->assertFalse($this->isTextPresent("{$eventTitle3}")); @@ -119,7 +116,7 @@ function testEventListing() { function _testCreateEvent($eventTitle, $startdate, $enddate) { // Go directly to the URL of the screen that you will be testing (New Event). - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); // $eventTitle = 'My Conference - '.substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; diff --git a/tests/phpunit/WebTest/Export/ContactTest.php b/tests/phpunit/WebTest/Export/ContactTest.php index 3760756b65b..b8fb7d1b0cf 100644 --- a/tests/phpunit/WebTest/Export/ContactTest.php +++ b/tests/phpunit/WebTest/Export/ContactTest.php @@ -91,7 +91,6 @@ function testContactExport() { // Visit contact search page. $this->openCiviPage("contact/search", "reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); // Select contact type as Indiividual. $this->select("contact_type", "value=Individual"); diff --git a/tests/phpunit/WebTest/Mailing/SpoolTest.php b/tests/phpunit/WebTest/Mailing/SpoolTest.php index 9533bf3a86b..8d17025dfd5 100644 --- a/tests/phpunit/WebTest/Mailing/SpoolTest.php +++ b/tests/phpunit/WebTest/Mailing/SpoolTest.php @@ -54,8 +54,7 @@ function testSpooledMailing() { $this->assertNotEmpty( $cid, 'Could not find cid after adding contact' ); // Send an email to the added contact - $this->open( $this->sboxPath . 'civicrm/activity/email/add?action=add&reset=1&cid=' . $cid . '&selectedChild=activity&atype=3' ); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("activity/email/add", "action=add&reset=1&cid={$cid}&selectedChild=activity&atype=3"); $this->type( 'subject', 'test spool' ); $this->fillRichTextField( 'html_message', 'Unit tests keep children safe.' ); $this->click( "_qf_Email_upload" );