X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FEvent%2FEventListingTest.php;h=dde4a8004df4a6297ae33f0c265be8e3a6a82e52;hb=63e91f559645ec20ff4bcce59ea8c5cad7ced61e;hp=4839502cf4d29a1a842dd3dfce2690759ad4b220;hpb=8d33e12be1cfc6226cada7978de1306924fb6040;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Event/EventListingTest.php b/tests/phpunit/WebTest/Event/EventListingTest.php index 4839502cf4..dde4a8004d 100644 --- a/tests/phpunit/WebTest/Event/EventListingTest.php +++ b/tests/phpunit/WebTest/Event/EventListingTest.php @@ -1,5 +1,9 @@ open($this->sboxPath); - // Log in using webtestLogin() method - $this->webtestLogin(TRUE); + $this->webtestLogin('admin'); //Closed Event $eventTitle1 = 'My Conference - ' . substr(sha1(rand()), 0, 7); @@ -38,27 +37,27 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { //go to manage event and check for presence of ongoing and //upcomming events $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->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()); $this->assertFalse($this->isTextPresent("{$eventTitle1}")); - $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle2); + $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $eventTitle2); $this->click("_qf_SearchEvent_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertFalse($this->isTextPresent("{$eventTitle2}")); - $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle3); + $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->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle4); + $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->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle5); + $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->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",""); + $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 $this->waitForElementPresent('CIVICRM_QFID_1_eventsByDates'); @@ -68,8 +67,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}")); @@ -78,14 +77,14 @@ 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 - $this->openCiviPage("logout", "reset=1", NULL); - $this->webtestLogin(TRUE); + $this->webtestLogout(); + $this->webtestLogin('admin'); $this->open($this->sboxPath . 'admin/structure/block/manage/civicrm/6/configure'); $this->waitForElementPresent('edit-submit'); @@ -103,8 +102,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'); @@ -114,18 +113,19 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { $this->waitForTextPresent("The block settings have been updated."); } + /** + * @param $eventTitle + * @param $startdate + * @param $enddate + */ function _testCreateEvent($eventTitle, $startdate, $enddate) { - // Go directly to the URL of the screen that you will be testing (New Event). + $this->openCiviPage("event/add", "reset=1&action=add"); // $eventTitle = 'My Conference - '.substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; - - // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit - // button at the end of this page to show up, to make sure it's fully loaded. $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); - // Let's start filling the form with values. $this->select("event_type_id", "value=1"); // Attendee role s/b selected now. @@ -154,18 +154,13 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { $this->type("max_participants", "6"); $this->click("is_public"); - $this->click("_qf_EventInfo_upload-bottom"); - - // Wait for Location tab form to load - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Location_upload_done-bottom"); + $this->clickLink("_qf_EventInfo_upload-bottom", "_qf_Location_upload_done-bottom"); $this->click("_qf_Location_upload_done-bottom"); // Wait for "saved" status msg $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForTextPresent("'Location' information has been saved."); + $this->waitForText("crm-notification-container", "'Event Location' information has been saved."); } } -