Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-- Used openCiviPage and assertElementContainsText methods in webtests #25

Merged
merged 1 commit into from
Mar 4, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions tests/phpunit/WebTest/Event/AddParticipationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ function testEventParticipationAdd() {
$displayName = "$firstName Anderson";

// Go directly to the URL of the screen that you will be testing (Register Participant for Event-standalone).
$this->open($this->sboxPath . 'civicrm/participant/add?reset=1&action=add&context=standalone');

// 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_Participant_upload-bottom');
$this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom");

// Let's start filling the form with values.
// Type contact last name in contact auto-complete, wait for dropdown and click first result
Expand Down Expand Up @@ -101,7 +97,7 @@ function testEventParticipationAdd() {
$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->assertElementContainsText("crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!");

$this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
//click through to the participant view screen
Expand Down Expand Up @@ -153,8 +149,7 @@ function testEventParticipationAddWithMultipleRoles() {
$displayName = "$firstName Anderson";

// add custom data for participant role
$this->open($this->sboxPath . 'civicrm/admin/custom/group?reset=1 ');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->openCiviPage("admin/custom/group", "reset=1");

//add new custom data
$this->click("//a[@id='newCustomDataGroup']/span");
Expand All @@ -177,7 +172,7 @@ function testEventParticipationAddWithMultipleRoles() {
$this->waitForPageToLoad($this->getTimeoutMsec());

//Is custom group created?
$this->assertTrue($this->isTextPresent("Your custom field set '$customGroupTitle' has been added. You can add custom fields now."));
$this->assertElementContainsText("crm-notification-container", "Your custom field set '$customGroupTitle' has been added. You can add custom fields now.");

//add custom field - alphanumeric checkbox
$checkboxFieldLabel = 'custom_field' . substr(sha1(rand()), 0, 4);
Expand Down Expand Up @@ -215,7 +210,7 @@ function testEventParticipationAddWithMultipleRoles() {
$this->waitForPageToLoad($this->getTimeoutMsec());

//Is custom field created?
$this->assertTrue($this->isTextPresent("Your custom field '$checkboxFieldLabel' has been saved."));
$this->assertElementContainsText("crm-notification-container", "Your custom field '$checkboxFieldLabel' has been saved.");

//create another custom field - Integer Radio
$this->click("//a[@id='newCustomField']/span");
Expand Down Expand Up @@ -257,11 +252,7 @@ function testEventParticipationAddWithMultipleRoles() {
$this->waitForPageToLoad($this->getTimeoutMsec());

// Go directly to the URL of the screen that you will be testing (Register Participant for Event-standalone).
$this->open($this->sboxPath . 'civicrm/participant/add?reset=1&action=add&context=standalone');

// 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_Participant_upload-bottom');
$this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom");

// Let's start filling the form with values.
// Type contact last name in contact auto-complete, wait for dropdown and click first result
Expand Down Expand Up @@ -312,9 +303,7 @@ function testEventParticipationAddWithMultipleRoles() {
$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->assertElementContainsText("crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!");

$this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
//click through to the participant view screen
Expand Down Expand Up @@ -369,7 +358,7 @@ function testEventAddMultipleParticipants() {
$lastName2 = 'Last' . $rand;

// Go directly to the URL of the screen that you will be testing (Register Participant for Event-standalone).
$this->open($this->sboxPath . 'civicrm/participant/add?reset=1&action=add&context=standalone&mode=test&eid=3');
$this->openCiviPage("participant/add", "reset=1&action=add&context=standalone&mode=test&eid=3");

$this->assertTrue($this->isTextPresent("Register New Participant"), "Page title 'Register New Participant' missing");
$this->assertTrue($this->isTextPresent("A TEST transaction will be submitted"), "test mode status 'A TEST transaction will be submitted' missing");
Expand All @@ -384,7 +373,7 @@ function testEventAddMultipleParticipants() {
$this->waitForPageToLoad($this->getTimeoutMsec());

//searching the paricipants
$this->open($this->sboxPath . 'civicrm/event/search?reset=1');
$this->openCiviPage("event/search", "reset=1");
$this->type('sort_name', $firstName);
$eventName = "Rain-forest Cup Youth Soccer Tournament";
$this->type("event_name", $eventName);
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/WebTest/Event/AddPricesetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ function testParticipantWithDateSpecificPriceSet() {
$this->click('_qf_Participant_upload-bottom');
$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->assertElementContainsText("css=#crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!");

$this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");

Expand Down Expand Up @@ -638,7 +638,7 @@ function testEventWithPriceSet() {
$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->assertElementContainsText("css=#crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!");

$this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
//click through to the participant view screen
Expand Down