From: Ravish Nair Date: Wed, 6 Mar 2013 08:23:17 +0000 (+0530) Subject: -- applied patch and made some modifications X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bb21371efe9ba49875cfdff7ad20e47ab8daa52a;p=civicrm-core.git -- applied patch and made some modifications --- diff --git a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php index 69f00a9246..56b0df8c8c 100755 --- a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php +++ b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php @@ -37,29 +37,27 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { $this->webtestLogin(); // Go directly to the URL of the screen that will create new group. - $this->open($this->sboxPath . "civicrm/group/add?reset=1"); + $this->openCiviPage("group/add", "reset=1"); $groupTitle = "testGroup" . substr(sha1(rand()), 0, 4); $this->type("title", $groupTitle); $this->click("group_type[1]"); $this->click("_qf_Edit_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("The Group '{$groupTitle}' has been saved.")); + $this->assertElementContainsText('crm-notification-container', "The Group '{$groupTitle}' has been saved."); // Go directly to the URL that will create a new ACL role - $this->open($this->sboxPath . "civicrm/admin/options/acl_role?group=acl_role&action=add&reset=1"); - - $this->waitForElementPresent("_qf_Options_cancel-bottom"); + $this->openCiviPage("admin/options/acl_role", "group=acl_role&action=add&reset=1", "_qf_Options_cancel-bottom"); $label = "TestAclRole" . substr(sha1(rand()), 0, 4); $this->type("label", $label); $this->click("_qf_Options_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("The Acl Role '{$label}' has been saved ")); + $this->assertElementContainsText('crm-notification-container', "The Acl Role '{$label}' has been saved"); // Go directly to the URL of the screen that will assign users to role. - $this->open($this->sboxPath . "civicrm/acl/entityrole?action=add&reset=1"); + $this->openCiviPage("acl/entityrole", "action=add&reset=1"); $this->select("acl_role_id", "label=" . $label); $this->select("entity_id", "label={$groupTitle}"); @@ -69,7 +67,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { // Go directly to the URL of the screen that will manage ACLs - $this->open($this->sboxPath . "civicrm/acl?action=add&reset=1"); + $this->openCiviPage("acl", "action=add&reset=1"); $this->click("group_id"); $this->select("group_id", "label={$groupTitle}"); $this->select("operation", "label=View"); diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index 8f567fe9ba..606cae1b81 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -65,7 +65,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // Let's start filling the form with values. // ...and verifying if the page contains properly formatted display name for chosen contact. - $this->assertTrue($this->isTextPresent("Anderson, " . $firstName2), "Contact not found in line " . __LINE__); + $this->assertElementContainsText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook', 'Anderson, ' . $firstName2, 'Contact not found in line ' . __LINE__); // Now we're filling the "Assigned To" field. // Typing contact's name into the field (using typeKeys(), not type()!)... @@ -84,11 +84,11 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook"); // ...and verifying if the page contains properly formatted display name for chosen contact. - $this->assertTrue($this->isTextPresent("Summerson, " . $firstName1), "Contact not found in line " . __LINE__); + $this->assertElementContainsText('css=tr.crm-activity-form-block-assignee_contact_id td ul li.token-input-token-facebook', 'Summerson, ' . $firstName1, 'Contact not found in line ' . __LINE__); // Since we're here, let's check if screen help is being displayed properly - $this->assertTrue($this->isTextPresent("You can optionally assign this activity to someone"), "Help text is missing."); + $this->assertElementContainsText('css=tr.crm-activity-form-block-assignee_contact_id td span.description', 'You can optionally assign this activity to someone', 'Help text is missing.'); // Putting the contents into subject field - assigning the text to variable, it'll come in handy later $subject = "This is subject of test activity being added through activity tab of contact summary screen."; // For simple input fields we can use field id as selector @@ -127,7 +127,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct? - $this->assertTrue($this->isTextPresent("Activity '$subject' has been saved."), "Status message didn't show up after saving!"); + $this->assertElementContainsText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving."); $this->waitForElementPresent("xpath=//div[@id='Activities']//table/tbody/tr[2]/td[9]/span/a[text()='View']"); diff --git a/tests/phpunit/WebTest/Activity/IcalTest.php b/tests/phpunit/WebTest/Activity/IcalTest.php index 49b721349c..566f1ad1c0 100644 --- a/tests/phpunit/WebTest/Activity/IcalTest.php +++ b/tests/phpunit/WebTest/Activity/IcalTest.php @@ -45,11 +45,10 @@ class WebTest_Activity_IcalTest extends CiviSeleniumTestCase { $this->open($this->sboxPath); $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/display?reset=1"); - $this->waitForElementPresent("name=activity_assignee_notification_ics"); + $this->openCivipage("admin/setting/preferences/display", "reset=1", "name=activity_assignee_notification_ics"); // Notify assignees should be checked by default, so we just need to click the ical setting which is off by default. - $this->click("name=activity_assignee_notification_ics"); + $this->check("name=activity_assignee_notification_ics"); $this->click("_qf_Display_next"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -60,8 +59,7 @@ class WebTest_Activity_IcalTest extends CiviSeleniumTestCase { $firstName1 = substr(sha1(rand()), 0, 7); $this->webtestAddContact("$firstName1", "Anderson", $firstName1 . "@anderson.com"); - $this->open($this->sboxPath . "civicrm/activity?reset=1&action=add&context=standalone"); - $this->waitForElementPresent("_qf_Activity_upload"); + $this->openCivipage("activity", "reset=1&action=add&context=standalone", "_qf_Activity_upload"); $this->select("activity_type_id", "value=1"); @@ -85,7 +83,7 @@ class WebTest_Activity_IcalTest extends CiviSeleniumTestCase { $this->click("_qf_Activity_upload"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Activity '$subject' has been saved."), "Status message didn't show up after saving!"); + $this->assertElementContainsText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving!"); // check the resulting email $mail = $mailer->getMostRecentEmail( 'ezc' ); diff --git a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php index 421ea6a997..d91f909d44 100644 --- a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php @@ -54,11 +54,7 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { $this->webtestAddContact("$firstName2", "Summerson", $firstName2 . "@summerson.com"); // Go directly to the URL of the screen that you will be testing (New Activity-standalone). - $this->open($this->sboxPath . "civicrm/activity?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_Activity_upload"); + $this->openCiviPage("activity", "reset=1&action=add&context=standalone", "_qf_Activity_upload"); // Let's start filling the form with values. @@ -83,7 +79,7 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=tr.crm-activity-form-block-target_contact_id td ul li span.token-input-delete-token-facebook"); //..and verifying if the page contains properly formatted display name for chosen contact. - $this->assertTrue($this->isTextPresent("Anderson, $firstName1"), "Contact not found in line " . __LINE__); + $this->assertElementContainsText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook', "Anderson, $firstName1", 'Contact not found in line ' . __LINE__); // Now we're doing the same for "Assigned To" field. // Typing contact's name into the field (using typeKeys(), not type()!)... @@ -102,10 +98,10 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook"); // ...and verifying if the page contains properly formatted display name for chosen contact. - $this->assertTrue($this->isTextPresent("Summerson, $firstName2"), "Contact not found in line " . __LINE__); + $this->assertElementContainsText('css=tr.crm-activity-form-block-assignee_contact_id td ul li.token-input-token-facebook', "Summerson, $firstName2", 'Contact not found in line ' . __LINE__); // Since we're here, let's check of screen help is being displayed properly - $this->assertTrue($this->isTextPresent("You can optionally assign this activity to someone"), "Help text is missing."); + $this->assertElementContainsText('css=tr.crm-activity-form-block-assignee_contact_id td span.description', 'You can optionally assign this activity to someone', 'Help text is missing.'); // Putting the contents into subject field - assigning the text to variable, it'll come in handy later $subject = "This is subject of test activity being added through standalone screen."; @@ -152,8 +148,7 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { // Is status message correct? $this->assertTrue($this->isTextPresent("Activity '$subject' has been saved."), "Status message didn't show up after saving!"); - $this->open($this->sboxPath . "civicrm/activity/search?reset=1"); - $this->waitForElementPresent("_qf_Search_refresh"); + $this->openCiviPage("activity/search", "reset=1", "_qf_Search_refresh"); $this->type("sort_name", $firstName1); $this->click("_qf_Search_refresh"); diff --git a/tests/phpunit/WebTest/Admin/CustomAddTest.php b/tests/phpunit/WebTest/Admin/CustomAddTest.php index fbf35bad15..3c9d4c9959 100644 --- a/tests/phpunit/WebTest/Admin/CustomAddTest.php +++ b/tests/phpunit/WebTest/Admin/CustomAddTest.php @@ -46,10 +46,7 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase { $this->webtestLogin(); // Go directly to the URL of the screen that you will be testing (Custom data for contacts). - $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1"); - // 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->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/custom/group", "action=add&reset=1"); //fill custom group title $customGroupTitle = 'custom_group' . substr(sha1(rand()), 0, 3); @@ -64,7 +61,7 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase { $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 text $textFieldLabel = 'test_text_field' . substr(sha1(rand()), 0, 3); $this->click("header"); @@ -112,7 +109,7 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase { $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 - Number Radio $this->click("data_type[0]"); @@ -148,67 +145,64 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); //Is custom field created - $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved.")); + $this->assertElementContainsText('crm-notification-container', "Your custom field '$radioFieldLabel' has been saved."); //On New Individual contact form - $this->open($this->sboxPath . "civicrm/contact/add?ct=Individual&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("New Individual")); + $this->openCiviPage("contact/add", "ct=Individual&reset=1"); + $this->assertElementContainsText('page-title', "New Individual"); //expand all tabs $this->click("expand"); $this->waitForElementPresent("address_1_street_address"); //verify custom group fields are present on new Individual Contact Form - $this->assertTrue($this->isTextPresent($textFieldLabel)); - $this->assertTrue($this->isTextPresent($checkboxFieldLabel)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel1)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel2)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel3)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel4)); - $this->assertTrue($this->isTextPresent($radioFieldLabel)); - $this->assertTrue($this->isTextPresent($radioOptionLabel1)); - $this->assertTrue($this->isTextPresent($radioOptionLabel2)); + $this->assertElementContainsText('customData', $textFieldLabel); + $this->assertElementContainsText('customData', $checkboxFieldLabel); + $this->assertElementContainsText('customData', $checkboxOptionLabel1); + $this->assertElementContainsText('customData', $checkboxOptionLabel2); + $this->assertElementContainsText('customData', $checkboxOptionLabel3); + $this->assertElementContainsText('customData', $checkboxOptionLabel4); + $this->assertElementContainsText('customData', $radioFieldLabel); + $this->assertElementContainsText('customData', $radioOptionLabel1); + $this->assertElementContainsText('customData', $radioOptionLabel2); //On New Household contact form - $this->open($this->sboxPath . "civicrm/contact/add?ct=Household&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("New Household")); + $this->openCiviPage("contact/add", "ct=Household&reset=1"); + $this->assertElementContainsText('page-title', "New Household"); //expand all tabs $this->click("expand"); $this->waitForElementPresent("address_1_street_address"); //verify custom group fields are present on new household Contact Form - $this->assertTrue($this->isTextPresent($textFieldLabel)); - $this->assertTrue($this->isTextPresent($checkboxFieldLabel)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel1)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel2)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel3)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel4)); - $this->assertTrue($this->isTextPresent($radioFieldLabel)); - $this->assertTrue($this->isTextPresent($radioOptionLabel1)); - $this->assertTrue($this->isTextPresent($radioOptionLabel2)); + $this->assertElementContainsText('customData', $textFieldLabel); + $this->assertElementContainsText('customData', $checkboxFieldLabel); + $this->assertElementContainsText('customData', $checkboxOptionLabel1); + $this->assertElementContainsText('customData', $checkboxOptionLabel2); + $this->assertElementContainsText('customData', $checkboxOptionLabel3); + $this->assertElementContainsText('customData', $checkboxOptionLabel4); + $this->assertElementContainsText('customData', $radioFieldLabel); + $this->assertElementContainsText('customData', $radioOptionLabel1); + $this->assertElementContainsText('customData', $radioOptionLabel2); //On New Organization contact form - $this->open($this->sboxPath . "civicrm/contact/add?ct=Organization&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("New Organization")); + $this->openCiviPage("contact/add", "ct=Organization&reset=1"); + $this->assertElementContainsText('page-title', "New Organization"); //expand all tabs $this->click("expand"); $this->waitForElementPresent("address_1_street_address"); //verify custom group fields are present on new Organization Contact Form - $this->assertTrue($this->isTextPresent($textFieldLabel)); - $this->assertTrue($this->isTextPresent($checkboxFieldLabel)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel1)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel2)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel3)); - $this->assertTrue($this->isTextPresent($checkboxOptionLabel4)); - $this->assertTrue($this->isTextPresent($radioFieldLabel)); - $this->assertTrue($this->isTextPresent($radioOptionLabel1)); - $this->assertTrue($this->isTextPresent($radioOptionLabel2)); + $this->assertElementContainsText('customData', $textFieldLabel); + $this->assertElementContainsText('customData', $checkboxFieldLabel); + $this->assertElementContainsText('customData', $checkboxOptionLabel1); + $this->assertElementContainsText('customData', $checkboxOptionLabel2); + $this->assertElementContainsText('customData', $checkboxOptionLabel3); + $this->assertElementContainsText('customData', $checkboxOptionLabel4); + $this->assertElementContainsText('customData', $radioFieldLabel); + $this->assertElementContainsText('customData', $radioOptionLabel1); + $this->assertElementContainsText('customData', $radioOptionLabel2); } }