From cba9346da6af121ec2a9221d29f841c1c32a6ed2 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 22 Apr 2014 20:09:33 +0530 Subject: [PATCH] Web Test Fix --- .../Activity/ContactContextAddTest.php | 66 ++++++++----------- tests/phpunit/WebTest/Activity/IcalTest.php | 14 ++-- .../WebTest/Activity/StandaloneAddTest.php | 43 ++++++------ tests/phpunit/WebTest/Case/AddCaseTest.php | 27 ++++---- .../WebTest/Case/CaseCustomFieldsTest.php | 19 ++---- .../phpunit/WebTest/Contact/GroupAddTest.php | 1 - .../WebTest/Generic/CheckActivityTest.php | 28 ++++---- .../Generic/GeneralClickAroundTest.php | 3 +- 8 files changed, 91 insertions(+), 110 deletions(-) diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index 2a8edac145..ec256c24c0 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -48,37 +48,32 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // Select the activity type from the activity dropdown $this->select("other_activity", "label=Meeting"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - // 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"); // ...and verifying if the page contains properly formatted display name for chosen contact. - $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__); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", 'Anderson, ' . $firstName2); // Now we're filling the "Assigned To" field. // Typing contact's name into the field (using typeKeys(), not type()!)... - $this->click("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id"); - $this->type("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", $firstName1); - $this->typeKeys("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", $firstName1); + $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); + $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName1); + $this->typeKeys("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName1); // ...waiting for drop down with results to show up... - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); // ...need to use mouseDownAt on first result (which is a li element), click does not work - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1"); // ...and verifying if the page contains properly formatted display name for chosen contact. - $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__); + $this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName1", 'Contact not found in line ' . __LINE__); - // Since we're here, let's check if screen help is being displayed properly - - $this->assertElementContainsText('css=tr.crm-activity-form-block-assignee_contact_id', '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 @@ -114,7 +109,6 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // Clicking save. $this->click("_qf_Activity_upload"); - $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct? $this->waitForText('crm-notification-container', $subject); @@ -131,7 +125,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { array( 'Subject' => $subject, 'Location' => 'Some location needs to be put in this field.', - 'Status' => 'Scheduled', + 'Activity Status' => 'Scheduled', 'Duration' => '30', // Tough luck filling in WYSIWYG editor, so skipping verification for now. //'Details' => 'Really brief details information.', @@ -144,7 +138,8 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { array( 'With Contact' => "Anderson, {$firstName2}", 'Assigned To' => "Summerson, {$firstName1}", - ) + ), + "/label" ); } @@ -166,46 +161,41 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // Select the activity type from the activity dropdown $this->select("other_activity", "label=Meeting"); - $this->waitForPageToLoad($this->getTimeoutMsec()); // ...and verifying if the page contains properly formatted display name for chosen contact. - $this->waitForText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook', 'Anderson, ' . $firstName3, 'Contact not found in line ' . __LINE__); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", 'Anderson, ' . $firstName3, 'Contact not found in line ' . __LINE__); //filling the second target Contact - $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1"); - $this->type("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName1); - $this->typeKeys("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName1); + $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); + $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName1); + $this->typeKeys("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName1); // ...waiting for drop down with results to show up... - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); // ...need to use mouseDownAt on first result (which is a li element), click does not work - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); - // ...again, waiting for the box with contact name to show up... - $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->waitForText('css=tr.crm-activity-form-block-target_contact_id td ul', 'Summerson, ' . $firstName1, 'Contact not found in line ' . __LINE__); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName1", 'Contact not found in line ' . __LINE__); //filling the third target contact - $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1"); - $this->type("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName2); - $this->typeKeys("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", $firstName2); + $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); + $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName2); + $this->typeKeys("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName2); // ...waiting for drop down with results to show up... - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); // ...need to use mouseDownAt on first result (which is a li element), click does not work - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); - // ...again, waiting for the box with contact name to show up... - $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->waitForText('css=tr.crm-activity-form-block-target_contact_id td ul', 'Andersonnn, ' . $firstName2, 'Contact not found in line ' . __LINE__); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName2", 'Contact not found in line ' . __LINE__); //check the checkbox to create a separate activity for the selected target contacts $this->check('is_multi_activity'); @@ -217,7 +207,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->select("status_id", "value=1"); // Clicking save. - $this->clickLink('_qf_Activity_upload'); + $this->click('_qf_Activity_upload'); // Is status message correct? $this->waitForText('crm-notification-container', $subject); diff --git a/tests/phpunit/WebTest/Activity/IcalTest.php b/tests/phpunit/WebTest/Activity/IcalTest.php index 7a077069cd..65686171e3 100644 --- a/tests/phpunit/WebTest/Activity/IcalTest.php +++ b/tests/phpunit/WebTest/Activity/IcalTest.php @@ -59,18 +59,18 @@ class WebTest_Activity_IcalTest extends CiviSeleniumTestCase { $this->select("activity_type_id", "value=1"); - $this->click("token-input-assignee_contact_id"); + $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: tokeninput has a slight delay sleep(1); - $this->type("token-input-assignee_contact_id", "$firstName1"); - $this->typeKeys("token-input-assignee_contact_id", "$firstName1"); + $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName1); + $this->typeKeys("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName1); - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); - $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1"); $subject = "Testing Ical attachment for activity assignee"; $this->type("subject", $subject); diff --git a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php index da154e654e..8f4abbed94 100644 --- a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php @@ -49,44 +49,41 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { // We're filling in ajaxiefied "With Contact" field: // We can not use id as selector for these input widgets. Use css selector, starting with the table row containing this field (which will have a unique class) // Typing contact's name into the field (using typeKeys(), not type()!)... - $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1"); - $this->type("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", "$firstName1"); - $this->typeKeys("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", "$firstName1"); + $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); + $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName1); + $this->typeKeys("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName1); // ...waiting for drop down with results to show up... - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); // ...need to use mouseDownAt on first result (which is a li element), click does not work - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)... - $this->waitForElementPresent("css=tr.crm-activity-form-block-target_contact_id td ul li span.token-input-delete-token-facebook"); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$firstName1"); //..and verifying if the page contains properly formatted display name for chosen contact. - $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__); + $this->assertElementContainsText("xpath=//div[@id='s2id_target_contact_id']", "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()!)... - $this->click("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id"); - $this->type("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", "$firstName2"); - $this->typeKeys("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", "$firstName2"); + $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); + $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName2); + $this->typeKeys("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName2); // ...waiting for drop down with results to show up... - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); //..need to use mouseDownAt on first result (which is a li element), click does not work - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName2"); // ...and verifying if the page contains properly formatted display name for chosen contact. - $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->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.'); + $this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName2", 'Contact not found in line ' . __LINE__); // 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."; @@ -115,7 +112,6 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { $this->select("priority_id", "value=1"); // Adding attachment - $this->click("css=.crm-activity-form-block-attachment div.crm-accordion-header"); //FIX ME: need to fix file uploading //$this->waitForElementPresent("attachFile_1"); //$filePath = $this->webtestAttachFile( "attachFile_1" ); @@ -136,7 +132,7 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { $this->type("sort_name", $firstName1); $this->click("_qf_Search_refresh"); - $this->waitForElementPresent("_qf_Search_next_print"); + $this->waitForElementPresent("Go"); $this->click("xpath=id('Search')/div[3]/div/div[2]/table/tbody/tr[3]/td[9]/span/a[text()='View']"); $this->waitForElementPresent("_qf_Activity_cancel-bottom"); @@ -145,7 +141,7 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { array( 'Subject' => $subject, 'Location' => $location, - 'Status' => 'Scheduled', + 'Activity Status' => 'Scheduled', 'Duration' => '30', // Tough luck filling in WYSIWYG editor, so skipping verification for now. //'Details' => 'Really brief details information.', @@ -159,7 +155,8 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { array( 'With Contact' => "Anderson, {$firstName1}", 'Assigned To' => "Summerson, {$firstName2}", - ) + ), + "/label" ); } diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index f7d3a131e2..70d62bfe5f 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -61,7 +61,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { // Try submitting the form without creating or selecting a contact (test for CRM-7971) $this->clickLink("_qf_Case_upload-bottom", "css=span.crm-error"); - $this->assertElementContainsText('Case', "Please select a contact or create new contact", "Expected form rule error for submit without selecting contact did not show up after clicking Save."); + $this->assertElementContainsText('Case', "Client is a required field.", "Expected form rule error for submit without selecting contact did not show up after clicking Save."); // Adding contact with randomized first name (so we can then select that contact when creating case) // We're using pop-up New Contact dialog @@ -70,7 +70,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $contactName = "{$lastName}, {$firstName}"; $displayName = "{$firstName} {$lastName}"; $email = "{$lastName}.{$firstName}@example.org"; - $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4); + $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id"); // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files. $caseTypeLabel = "Adult Day Care Referral"; @@ -101,10 +101,10 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "Case opened successfully."); $summaryStrings = array( - "Case Summary", + "Summary", $displayName, - "Case Type: {$caseTypeLabel}", - "Start Date: {$today}", + "Type: {$caseTypeLabel}", + "Open Date: {$today}", "Status: {$caseStatusLabel}", ); @@ -133,7 +133,6 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Activity_cancel-bottom"); $this->select("case_status_id","value=2"); $this->click("_qf_Activity_upload-top"); - $this->waitForPageToLoad($this->getTimeoutMsec()); $this->_testSearchbyDate($firstName, $lastName, "this.quarter"); $this->_testSearchbyDate($firstName, $lastName, "0"); @@ -158,10 +157,10 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { function _testVerifyCaseSummary($validateStrings, $activityTypes) { $this->assertStringsPresent($validateStrings); foreach ($activityTypes as $aType) { - $this->assertText("activity_type_id", $aType); + $this->assertText("add_activity_type_id", $aType); } $this->assertElementPresent("link=Assign to Another Client", "Assign to Another Client link is missing."); - $this->assertElementPresent("name=case_report_all", "Print Case Summary button is missing."); + $this->assertElementPresent("xpath=//a[text()=' Print Report']", "Print Case Summary button is missing."); } function _testVerifyCaseRoles($caseRoles, $creatorName) { @@ -175,26 +174,28 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { } function _testVerifyCaseActivities($activityTypes) { + $id = $this->urlArg('id'); // check that expected auto-created activities are listed in the Case Activities table foreach ($activityTypes as $aType) { - $this->assertText("activities-selector", $aType); + $this->assertText("case_id_$id", $aType); } } function _testVerifyOpenCaseActivity($subject, $openCaseData) { + $id = $this->urlArg('id'); // check that open case subject is present - $this->assertText("activities-selector", $subject); + $this->assertText("case_id_$id", $subject); // click open case activity pop-up dialog $this->click("link=$subject"); - $this->waitForElementPresent("view-activity"); + $this->waitForElementPresent("ActivityView"); $this->waitForElementPresent("css=tr.crm-case-activity-view-Activity"); // set page location of table containing activity view data - $activityViewPrefix = "//div[@id='activity-content']"; + $activityViewPrefix = "//*[@id='ActivityView']"; $activityViewTableId = "crm-activity-view-table"; // Probably don't need both tableId and prefix - but good examples for other situations where only one can be used $this->webtestVerifyTabularData($openCaseData, '', $activityViewTableId); - $this->click("xpath=//span[@class='ui-icon ui-icon-closethick']"); + $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']"); } function _testSearchbyDate($firstName, $lastName, $action) { diff --git a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php index b7299857c0..e52099e613 100644 --- a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php +++ b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php @@ -91,7 +91,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $custFname = "Mike" . substr(sha1(rand()), 0, 7); $custMname = "Dav" . substr(sha1(rand()), 0, 7); $custLname = "Krist" . substr(sha1(rand()), 0, 7); - $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4); + $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id"); // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files. $caseTypeLabel = "Adult Day Care Referral"; @@ -132,7 +132,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $this->openCiviPage('case', 'reset=1', "xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']"); $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']"); - $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']"); + $this->waitForElementPresent("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']"); // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME @@ -151,7 +151,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { "Priority" => "Normal", ); $this->webtestVerifyTabularData($openCaseData); - $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']"); + $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']"); // verify if custom data is present $this->openCiviPage('case', 'reset=1'); @@ -196,7 +196,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { "Priority" => "Normal", ); $this->webtestVerifyTabularData($openCaseChangeData); - $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']"); + $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']"); // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME @@ -357,7 +357,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $email = "{$lastName}.{$firstName}@example.org"; $custFname = "Mike" . substr(sha1(rand()), 0, 7); $custLname = "Krist" . substr(sha1(rand()), 0, 7); - $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4); + $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id"); // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files. $caseTypeLabel = "Adult Day Care Referral"; @@ -395,7 +395,6 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']"); $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[8]/a[text()='Open Case']"); - $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']"); $openCaseData = array( "Client" => $displayName, @@ -414,7 +413,6 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table/tbody/tr/td[text()='{$label}']/following-sibling::td"); } $this->webtestVerifyTabularData($openCaseData); - $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Done']"); // verify if custom data is present $this->openCiviPage('case', 'reset=1'); @@ -424,12 +422,9 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $cusId_1 = 'custom_' . $customId[0] . '_1'; $cusId_2 = 'custom_' . $customId[1] . '_1'; - $this->click("css=#{$customGrp1} a.button"); + $this->clickLink("css=#{$customGrp1} a.button"); - // wait for dialog element - $this->waitForElementPresent("css=div.ui-dialog div.ui-dialog-titlebar"); - // check for dialog box Title - $this->assertElementContainsText("css=div.ui-dialog div.ui-dialog-titlebar", 'Update Case Information'); + $this->assertElementContainsText("page-title", "Edit $customGrp1"); $custFname = "Miky" . substr(sha1(rand()), 0, 7); $custLname = "Kristy" . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 695f7fcc04..9e4fa165c7 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -70,7 +70,6 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->openCiviPage('group', 'reset=1'); $this->type('title', $params['name']); $this->click('_qf_Search_refresh'); - $this->waitForVisible('crm-group-selector_processing'); $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[contains(., '{$params['name']}')]"); $createdBy = $this->getText("xpath=//table[@id='crm-group-selector']/tbody/tr/td[3]/a"); $this->click("xpath=//table[@id='crm-group-selector']/tbody/tr/td[7]/span/a[2]"); diff --git a/tests/phpunit/WebTest/Generic/CheckActivityTest.php b/tests/phpunit/WebTest/Generic/CheckActivityTest.php index 75fa2a215c..9cf0f01625 100644 --- a/tests/phpunit/WebTest/Generic/CheckActivityTest.php +++ b/tests/phpunit/WebTest/Generic/CheckActivityTest.php @@ -48,35 +48,35 @@ class WebTest_Generic_CheckActivityTest extends CiviSeleniumTestCase { $this->select("activity_type_id", "label=Meeting"); - $this->click("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1"); - $this->type("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", "$contactFirstName1"); - $this->typeKeys("css=tr.crm-activity-form-block-target_contact_id input#token-input-contact_1", "$contactFirstName1"); + $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); + $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $contactFirstName1); + $this->typeKeys("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $contactFirstName1); // ...waiting for drop down with results to show up... - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); // ...need to use mouseDownAt on first result (which is a li element), click does not work - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)... - $this->waitForElementPresent("css=tr.crm-activity-form-block-target_contact_id td ul li span.token-input-delete-token-facebook"); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$contactFirstName1"); // Now we're doing the same for "Assigned To" field. // Typing contact's name into the field (using typeKeys(), not type()!)... - $this->click("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id"); - $this->type("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", "$contactFirstName2"); - $this->typeKeys("css=tr.crm-activity-form-block-assignee_contact_id input#token-input-assignee_contact_id", "$contactFirstName2"); + $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); + $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); + $this->type("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $contactFirstName2); + $this->typeKeys("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $contactFirstName2); // ...waiting for drop down with results to show up... - $this->waitForElementPresent("css=div.token-input-dropdown-facebook"); - $this->waitForElementPresent("css=li.token-input-dropdown-item2-facebook"); + $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); //..need to use mouseDownAt on first result (which is a li element), click does not work - $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); + $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$contactFirstName2"); } } diff --git a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php index eb38a6fef9..0ca99a4cb6 100644 --- a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php +++ b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php @@ -33,7 +33,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { function login() { $this->webtestLogin(); - $this->click("//a[contains(text(),'CiviCRM')]"); + $this->open($this->sboxPath . "civicrm"); $this->waitForPageToLoad($this->getTimeoutMsec()); } @@ -67,7 +67,6 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->login(); // Create New → Individual - $this->waitForElementPresent("xpath=//*[@id='crm-create-new-link']"); $this->click("crm-create-new-link"); $this->click("link=Individual"); $this->waitForPageToLoad($this->getTimeoutMsec()); -- 2.25.1