X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FCampaign%2FOfflineEventRegistrationTest.php;h=f67d426525154cf99a1588d2e705a1ebf5abd412;hb=1eba7e53d120e8801a43fa7878174914865fec8d;hp=aa35659302b62d3bcf63cd61d1d5013b38db03c2;hpb=997a3533bdaf41983a13c27b078f64bca12436fb;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php index aa35659302..f67d426525 100644 --- a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php @@ -25,6 +25,10 @@ */ require_once 'CiviTest/CiviSeleniumTestCase.php'; + +/** + * Class WebTest_Campaign_OfflineEventRegistrationTest + */ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase { protected function setUp() { @@ -77,7 +81,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->openCiviPage("campaign", "reset=1", "link=Add Campaign"); - if ($this->isTextPresent('No campaigns found.')) { + if ($this->isTextPresent('None found.')) { $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom"); $this->assertTrue($this->isTextPresent('There are currently no active Campaigns.')); } @@ -93,9 +97,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->type("description", "This is a test campaign"); // include groups for the campaign - $this->addSelection("includeGroups-f", "label=$groupName"); - $this->click("//option[@value=4]"); - $this->click("add"); + $this->multiselect2("includeGroups", array("$groupName", "Advisory Board")); // fill the end date for campaign $this->webtestFillDate("end_date", "+1 year"); @@ -111,12 +113,16 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase "Status message didn't show up after saving campaign!" ); - $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]"); - $id = (int) $this->getText("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]"); + $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]"); + $id = (int) $this->getText("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]"); $this->offlineParticipantAddTest($campaignTitle, $id); } + /** + * @param $campaignTitle + * @param $id + */ function offlineParticipantAddTest($campaignTitle, $id) { // connect campaign with event $this->openCiviPage("event/manage", "reset=1"); @@ -129,8 +135,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->click("campaign_id"); $this->select("campaign_id", "value=$id"); $this->waitForElementPresent('_qf_EventInfo_upload_done-bottom'); - $this->click("_qf_EventInfo_upload_done-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_EventInfo_upload_done-bottom"); // Adding contact with randomized first name (so we can then select that contact when creating event registration) // We're using Quick Add block on the main page for this. @@ -142,13 +147,13 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom"); // Type contact last name in contact auto-complete, wait for dropdown and click first result - $this->webtestFillAutocomplete($firstName, 'contact_id'); + $this->webtestFillAutocomplete($firstName); // Select event. Based on label for now. $this->select2("event_id", $eventName); // Select role - $this->click("role_id[2]"); + $this->multiselect2("role_id", array('Volunteer')); // Choose Registration Date. // Using helper webtestFillDate function. @@ -188,7 +193,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct? - $this->assertTrue($this->isTextPresent("Event registration for $displayName has been added"), "Status message didn't show up after saving!"); + $this->waitForText("crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!"); $this->waitForElementPresent("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the participant view screen @@ -204,7 +209,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->click("remove"); $this->click("_qf_Component_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Changes Saved.")); + $this->assertTrue($this->isTextPresent("Changes Saved")); $this->openCiviPage("event/search", "reset=1", "_qf_Search_refresh"); @@ -216,6 +221,9 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->assertTrue($this->isTextPresent("$campaignTitle")); } + /** + * @return mixed + */ function registerUrl() { $this->openCiviPage("event/manage", "reset=1"); $eventId = explode('-', $this->getAttribute("//div[@id='event_status_id']//div[2]/table/tbody/tr@id"));