From bf333c479c4e8400f683f53b6364ce101ff200e7 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Mon, 8 Sep 2014 18:36:40 +0530 Subject: [PATCH] Web Test Fix --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 4 +-- .../Activity/ContactContextAddTest.php | 4 +-- .../Campaign/CampaignDescriptionTest.php | 8 ++--- .../phpunit/WebTest/Campaign/MailingTest.php | 11 +++--- .../WebTest/Contact/ContactTagTest.php | 2 +- .../WebTest/Contact/MergeContactsTest.php | 22 ++++++------ .../WebTest/Contact/ProfileChecksumTest.php | 21 ++++++------ .../Contact/TaskActionAddToGroupTest.php | 12 +++---- .../WebTest/Generic/CheckDashboardTest.php | 6 ++-- .../WebTest/Grant/ContactContextAddTest.php | 3 +- tests/phpunit/WebTest/Mailing/MailingTest.php | 6 ++-- .../WebTest/Profile/ProfileAddTest.php | 34 ++++++++++++------- 12 files changed, 67 insertions(+), 66 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 2de3b3cee1..83cd0fc1aa 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1474,10 +1474,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { // Is status message correct? $this->waitForText('crm-notification-container', "Activity '$subject' has been saved."); - $this->waitForElementPresent("xpath=//div[@id='contact-activity-selector-activity_wrapper']//table/tbody/tr[2]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody/tr[2]/td[8]/span/a[text()='View']"); // click through to the Activity view screen - $this->click("xpath=//div[@id='contact-activity-selector-activity_wrapper']//table/tbody/tr[2]/td[8]/span/a[text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']//table/tbody/tr[2]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_Activity_cancel-bottom'); // parse URL to grab the activity id diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index ad6f664d69..c905623114 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -118,10 +118,10 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', $subject); $this->waitForElementPresent( - "xpath=//table[@id='contact-activity-selector-activity']//tbody//tr[2]/td[8]/span/a[text()='View']"); + "xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']//tbody//tr[2]/td[8]/span/a[text()='View']"); // click through to the Activity view screen - $this->click("xpath=//table[@id='contact-activity-selector-activity']//tbody//tr[2]/td[8]/span/a[text()='View']"); + $this->click("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']//tbody//tr[2]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_Activity_cancel-bottom'); // verify Activity created diff --git a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php index 9c7b663446..9fbe1585b2 100644 --- a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php +++ b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php @@ -60,9 +60,7 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase { $this->type("description", $campaignDescription); // 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"); @@ -77,8 +75,8 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "Campaign $title"); //Opening Edit Page of the created Campaign - $this->waitForElementPresent("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']"); - $this->clickLink("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']", "//textarea[@id='description']"); + $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']"); + $this->clickLink("//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']", "//textarea[@id='description']"); $fetchedVaue = $this->getValue('description'); $this->assertEquals($campaignDescription, $fetchedVaue); } diff --git a/tests/phpunit/WebTest/Campaign/MailingTest.php b/tests/phpunit/WebTest/Campaign/MailingTest.php index fc5d675920..6693fee5a0 100644 --- a/tests/phpunit/WebTest/Campaign/MailingTest.php +++ b/tests/phpunit/WebTest/Campaign/MailingTest.php @@ -81,9 +81,7 @@ class WebTest_Campaign_MailingTest 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"); @@ -97,8 +95,8 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "Campaign $title"); - $this->waitForElementPresent("//div[@id='campaignList']/div[@id='campaigns_wrapper']/table/tbody/tr/td[text()='{$campaignTitle}']/../td[1]"); - $id = (int) $this->getText("//div[@id='campaignList']/div[@id='campaigns_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->mailingAddTest($groupName, $campaignTitle, $id); } @@ -131,8 +129,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase { $this->select("campaign_id", "value=$id"); // Add the test mailing group - $this->select("includeGroups-f", "$groupName"); - $this->click("add"); + $this->select("includeGroups", "$groupName"); // click next $this->click("_qf_Group_next"); diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index 6c5d31afb4..dcf4d0ec2d 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -72,7 +72,7 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=div#tagtree"); // check tag we have created - $this->click("xpath=//ul/li/label[text()=\"$tagName\"]"); + $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]"); $this->waitForElementPresent("css=.success"); // Is status message correct? diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 629aa71ec6..096d39e089 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -81,7 +81,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $tag = 'Government Entity'; $this->click("css=li#tab_tag a"); $this->waitForElementPresent('tagtree'); - $this->click("xpath=//div[@id='tagtree']/ul//li/input/../label[text()='$tag']"); + $this->click("xpath=//div[@id='tagtree']/ul//li/input/../span/label[text()='$tag']"); $this->click("css=#tab_summary a"); $this->assertElementContainsText('css=.crm-summary-block #tags', $tag); @@ -158,7 +158,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Ensure that the duplicate contact has been deleted $this->openCiviPage("contact/search/advanced", "reset=1", '_qf_Advanced_refresh'); $this->type('sort_name', $firstName); - $this->check('deleted_contacts'); + $this->click('deleted_contacts'); $this->click('_qf_Advanced_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue($this->isTextPresent('1 Contact'), "Deletion of duplicate contact during merge was not successful. Dupe contact not found when searching trash."); @@ -399,11 +399,11 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent('Contacts Merged')); $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[1][contains(text(), 'Home')]")); - $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[text() = '{$firstName}.{$lastName}@example.com']")); + $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[contains(text(), '{$firstName}.{$lastName}@example.com')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[1][contains(text(), 'Home')]")); - $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[text() ='{$firstName}.{$lastName}@example.com']")); + $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[contains(text(), '{$firstName}.{$lastName}@example.com')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[1][contains(text(), 'Billing')]")); - $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[2]/a[text() ='$firstName.$lastName@billing.com']")); + $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[2]/a[contains(text(), '$firstName.$lastName@billing.com')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[1][contains(text(), 'Home')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[2][contains(text(), '9876543211')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[1][contains(text(), 'Home')]")); @@ -470,8 +470,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Select the contacts to be merged $this->select("name=option51_length", "value=100"); - $this->waitForElementPresent("xpath=//*[@id='DedupeFind']//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='57e10a6 9a3de85']/../../td[2]/a[text()='57e10a6 9a3de85']"); - $this->click("xpath=//*[@id='DedupeFind']//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[4]/a[text()='merge']"); + $this->waitForElementPresent("xpath=//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']"); + $this->click("xpath=//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[4]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']"); $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']"); @@ -490,9 +490,9 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent('Contacts Merged')); $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[1][contains(text(), 'Home')]")); - $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[text() ='{$firstName1}.{$lastName1}@example.com']")); + $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[contains(text(), '{$firstName1}.{$lastName1}@example.com')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[1][contains(text(), 'Main')]")); - $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[text() ='{$firstName1}.{$lastName1}@example.com']")); + $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[contains(text(), '{$firstName1}.{$lastName1}@example.com')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[1][contains(text(), 'Billing')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[2][contains(text(), '9876543120')]")); $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[1][contains(text(), 'Home')]")); @@ -845,7 +845,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { //check the status message $this->waitForText('crm-notification-container', "Relationship created."); - $this->waitForElementPresent("xpath=//table[@id='crm-contact-relationship-selector-current']/tbody//tr/td[9]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//table[@class='crm-contact-relationship-selector-current dataTable no-footer']/tbody//tr/td[9]/span/a[text()='View']"); $this->waitForElementPresent("xpath=//a[text()='$sortName']"); $this->click("xpath=//a[text()='$sortName']"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -894,7 +894,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { //check the status message $this->isTextPresent("Relationship created."); - $this->waitForElementPresent("xpath=//table[@id='crm-contact-relationship-selector-current']/tbody//tr/td[9]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//table[@class='crm-contact-relationship-selector-current dataTable no-footer']/tbody//tr/td[9]/span/a[text()='View']"); // go directly to contact merge page. $this->openCiviPage("contact/merge", "reset=1&cid={$contactIds['mainId']}&oid={$contactIds['duplicateId']}&action=update&rgid=2"); diff --git a/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php b/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php index 89b97ba0dc..cfe220b39a 100644 --- a/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php +++ b/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php @@ -70,16 +70,6 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase { 'update_value' => substr(sha1(rand()), 0, 7), 'element_name' => 'city-Primary', ), - 'state_province' => array( - 'type' => 'Contact', - 'label' => 'State', - 'location' => 0, - 'default_value' => '1004', - 'update_value' => '1031', - 'update_value_label' => 'NY', - 'element_name' => 'state_province-Primary', - 'html_type' => 'select', - ), 'country' => array( 'type' => 'Contact', 'label' => 'Country', @@ -90,6 +80,16 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase { 'element_name' => 'country-Primary', 'html_type' => 'select', ), + 'state_province' => array( + 'type' => 'Contact', + 'label' => 'State', + 'location' => 0, + 'default_value' => '1004', + 'update_value' => '1031', + 'update_value_label' => 'NY', + 'element_name' => 'state_province-Primary', + 'html_type' => 'select', + ), ); // Create a contact. @@ -120,6 +120,7 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase { foreach ($fields as $field) { $this->assertTrue($this->isElementPresent($field['element_name']), "Missing Field: {$field['label']}."); if (isset($field['html_type']) && $field['html_type'] == 'select') { + $this->waitForVisible($field['element_name']); $this->select($field['element_name'], "value={$field['update_value']}"); } else { diff --git a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php index c5713deae0..337937759d 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php +++ b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php @@ -42,7 +42,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $this->WebtestAddGroup($newGroupName); // Create two new contacts with a common random string in email address - $emailString = substr(sha1(rand()), 0, 7) . '@example.com_'; + $emailString = substr(sha1(rand()), 0, 7) . '@example.com'; $cids = array(); for ($i = 0; $i < 2; $i++) { // create new contact @@ -72,12 +72,8 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { // Click "check all" box and act on "Add to group" action $this->click('toggleSelect'); + $this->waitForText("xpath=//input[@value='ts_sel']/following-sibling::label/span", '2'); $this->select("task", "label=Add Contacts to Group"); - // 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 - sleep(1); - $this->click("Go"); $this->waitForPageToLoad($this->getTimeoutMsec()); // Select the new group and click to add @@ -117,14 +113,14 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $this->click("_qf_Basic_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->type("xpath=//*[@id='Basic-rows-per-page-select']", '25'); + $this->type("xpath=//*[@id='CRM_Contact_Form_Search_Basic-rows-per-page-select']", '25'); $this->waitForElementPresent("toggleSelect"); $this->click("toggleSelect"); $this->click("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a"); $this->waitForText("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a", "First"); $this->click("toggleSelect"); + $this->waitForText("xpath=//input[@value='ts_sel']/following-sibling::label/span", '50'); $this->select("task", "label=Add Contacts to Group"); - $this->click("Go"); $this->waitForPageToLoad($this->getTimeoutMsec()); // Select the new group and click to add diff --git a/tests/phpunit/WebTest/Generic/CheckDashboardTest.php b/tests/phpunit/WebTest/Generic/CheckDashboardTest.php index 131a9a8904..912ca2ab5d 100644 --- a/tests/phpunit/WebTest/Generic/CheckDashboardTest.php +++ b/tests/phpunit/WebTest/Generic/CheckDashboardTest.php @@ -94,7 +94,7 @@ class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase { // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME sleep(5); - $this->click("xpath=//*[@class='ui-button-text'][contains(text(), 'close')]"); + $this->click("xpath=//button[@title='Close']"); } /** @@ -145,11 +145,11 @@ class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase { // If CiviCase enabled, click 'more' link for context menu pop-up in the widget selector if ($this->isElementPresent("//table[@id='contact-activity-selector-dashlet']/tbody/tr[1]/td[8]/span[text()='more ']")) { // click 'Delete Activity' link - $this->click("//table[@id='contact-activity-selector-dashlet']/tbody/tr[1]/td[8]/span[text()='more ']/ul/li[2]/a[text()='Delete']"); + $this->click("//table[@class='contact-activity-selector-dashlet dataTable no-footer']/tbody/tr[1]/td[8]/span[text()='more ']/ul/li[2]/a[text()='Delete']"); } else { // click 'Delete Activity' link - $this->click("//table[@id='contact-activity-selector-dashlet']/tbody/tr[1]/td[8]/span//a[text()='Delete']"); + $this->click("//table[@class='contact-activity-selector-dashlet dataTable no-footer']/tbody/tr[1]/td[8]/span//a[text()='Delete']"); } $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForElementPresent("_qf_Activity_next-bottom"); diff --git a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php index 8226c9d307..696a2e286a 100644 --- a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php @@ -69,7 +69,8 @@ class WebTest_Grant_ContactContextAddTest extends CiviSeleniumTestCase { $this->click('link=Add Grant'); // wait for grant form to load completely - $this->waitForText('css=span.ui-dialog-title', "$firstName $lastName"); + $this->waitForText('css=span.ui-dialog-title', "New Grant"); + $this->waitForElementPresent('status_id'); // check contact name on Grant form diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index 4a10eb1fde..426018b27b 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -87,8 +87,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->type("name", "Mailing $mailingName Webtest"); // Add the test mailing group - $this->select("includeGroups-f", "$groupName"); - $this->click("add"); + $this->select("includeGroups", "$groupName"); // click next $this->clickLink("_qf_Group_next", "_qf_Settings_cancel", FALSE); @@ -344,8 +343,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->type("name", "Mailing $mailingName Webtest"); // Add the test mailing group - $this->select("includeGroups-f", "$groupName"); - $this->click("add"); + $this->select("includeGroups", "$groupName"); // click next $this->click("_qf_Group_next"); diff --git a/tests/phpunit/WebTest/Profile/ProfileAddTest.php b/tests/phpunit/WebTest/Profile/ProfileAddTest.php index 93bdfcf2f5..917f25a543 100644 --- a/tests/phpunit/WebTest/Profile/ProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileAddTest.php @@ -106,6 +106,9 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."); //Add field to profile + $this->waitForElementPresent("xpath=//a/span[text()='Add Field']"); + $this->click("xpath=//a/span[text()='Add Field']"); + $this->waitForElementPresent("field_name[0]"); $this->click('field_name[0]'); $this->select('field_name[0]', 'value=Contact'); $this->click("//option[@value='Contact']"); @@ -114,7 +117,7 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { //click on save $this->click('_qf_Field_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("xpath=//a/span[text()='Add Field']"); // delete the profile $this->openCiviPage('admin/uf/group', 'reset=1'); @@ -160,13 +163,17 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { 'last_name' => 'Individual', 'email' => 'Contact' ); + $this->waitForElementPresent("xpath=//a/span[text()='Add Field']"); + $this->click("xpath=//a/span[text()='Add Field']"); + $this->waitForElementPresent("field_name_0"); foreach ($fields as $field => $type) { $this->click('field_name_0'); $this->select('field_name_0', "value=$type"); $this->click("//option[@value='$type']"); $this->click('field_name_1'); $this->select('field_name_1', "value=$field"); - $this->clickLink('_qf_Field_next_new-top'); + $this->clickLink('_qf_Field_next_new-top', 'field_name_0', FALSE); + $this->waitForElementPresent("xpath=//select[@id='field_name_1'][@style='display: none;']"); } // create mode @@ -194,8 +201,8 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $this->openCiviPage('group', 'reset=1'); $this->type('title', $groupName); $this->click('_qf_Search_refresh'); - $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); - $this->clickLink("xpath=//table[@id='crm-group-selector']/tbody/tr/td[1]/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); + $this->waitForElementPresent("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); + $this->clickLink("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td[1]/span[text() = '$groupName']/parent::td/following-sibling::td[@class=' crm-group-group_links']/span/a"); $contactEmails = array( 1 => "$lastName1, $firstName1", 2 => "$lastName2, $firstName2" @@ -235,8 +242,8 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { */ function _testdeleteProfile($profileTitle) { //$this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul/li[4]/a[text()='Delete']"); - $this->click("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul/li[4]/a[text()='Delete']"); + $this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul//li/a[text()='Delete']"); + $this->click("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul//li/a[text()='Delete']"); $this->waitForElementPresent('_qf_Group_next-bottom'); $this->click('_qf_Group_next-bottom'); @@ -273,27 +280,30 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { // Wait for "saved" status msg $this->waitForText('crm-notification-container', 'Profile Added'); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent("xpath=//a/span[text()='Add Field']"); + $this->click("xpath=//a/span[text()='Add Field']"); + $this->waitForElementPresent("field_name_0"); // select field(s) to be added in profile + $this->select("field_name_0", "value=Contact"); $this->select("field_name_1", "value=email"); $this->select("field_name_2", "value=2"); // click on Save buttonProfile Field Saved - $this->clickLink('_qf_Field_next-bottom'); + $this->clickLink('_qf_Field_next-bottom', "xpath=//a/span[text()='Add Field']", FALSE); // Wait for "saved" status msg $this->waitForText('crm-notification-container', "Profile Field Saved"); - $this->waitForElementPresent("xpath=//div[@id='field_page']/div[2]/table/tbody/tr[1]/td[9]/span/a[text()='Edit']"); + $this->waitForElementPresent("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span/a[text()='Edit']"); // extract profile Id - $id = explode("gid=", $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody/tr/td[9]/span/a[text()='Edit']/@href")); + $id = explode("gid=", $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr/td[9]/span/a[text()='Edit']/@href")); $id = $id[1]; // click on Edit Settings - $this->clickLink("xpath=//div[@id='field_page']/div[3]/a[2]", '_qf_Group_next-bottom', FALSE); + $this->clickLink("xpath=//a/span[text()='Edit Settings']", '_qf_Group_next-bottom', FALSE); // check for description field $this->waitForElementPresent('description'); @@ -301,7 +311,7 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $this->assertEquals($this->getValue('description'), $profileDescription); // click on save button - $this->clickLink('_qf_Group_next-bottom', "xpath=//div[@id='field_page']/div[3]/a[2]", FALSE); + $this->clickLink('_qf_Group_next-bottom', "xpath=//a/span[text()='Edit Settings']", FALSE); // Wait for "saved" status msg $this->waitForText('crm-notification-container', 'Profile Saved'); -- 2.25.1