From fb93fc391dcb6112d78a56b0c271fc48a89e042c Mon Sep 17 00:00:00 2001 From: Web Access Date: Tue, 27 Oct 2015 18:31:38 +0530 Subject: [PATCH] Webtest Fix- Master --- .../WebTest/Admin/CustomAddTestSameField.php | 4 ++++ .../Admin/Form/ScheduleReminderTest.php | 3 +-- .../Admin/Form/Setting/LocalizationTest.php | 22 +++++++++---------- .../WebTest/Case/ActivityToCaseTest.php | 14 ++++++------ .../WebTest/Contact/AddressParsingTest.php | 2 ++ .../WebTest/Contact/AdvanceSearchPaneTest.php | 2 +- .../AdvancedSearchedRelatedContactTest.php | 1 + .../WebTest/Contact/ContactTagTest.php | 3 +-- .../phpunit/WebTest/Contact/GroupAddTest.php | 4 ++-- tests/phpunit/WebTest/Contact/TagAddTest.php | 2 +- 10 files changed, 31 insertions(+), 26 deletions(-) diff --git a/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php b/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php index 0908a88361..02cb0b8276 100644 --- a/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php +++ b/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php @@ -69,6 +69,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $this->openCiviPage('admin/custom/group/field/add', "reset=1&action=add&gid=$gid"); $textFieldLabel = 'test_text_field'; $this->click("header"); + $this->waitForElementPresent('label'); $this->type("label", $textFieldLabel); $this->click("_qf_Field_next_new-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -80,6 +81,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $this->click("//option[@value='CheckBox']"); $checkboxFieldLabel = 'test_checkbox'; + $this->waitForElementPresent('label'); $this->type("label", $checkboxFieldLabel); $checkboxOptionLabel1 = 'check1'; $this->type("option_label_1", $checkboxOptionLabel1); @@ -117,6 +119,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { //add custom field - alphanumeric text $textFieldLabel = 'test_text_field'; $this->click("header"); + $this->waitForElementPresent('label'); $this->type("label", $textFieldLabel); $this->clickLink("_qf_Field_next_new-bottom"); @@ -139,6 +142,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $this->click("//option[@value='Radio']"); $radioFieldLabel = 'test_radio'; + $this->waitForElementPresent('label'); $this->type("label", $radioFieldLabel); $radioOptionLabel1 = 'radio1'; $this->type("option_label_1", $radioOptionLabel1); diff --git a/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php b/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php index ee1c011e0b..f7af4aa024 100644 --- a/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php +++ b/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php @@ -63,8 +63,7 @@ class WebTest_Admin_Form_ScheduleReminderTest extends CiviSeleniumTestCase { //click on save $this->click('_qf_ScheduleReminders_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - + $this->waitForElementPresent("xpath=//div[@id='reminder']/div/table/tbody//tr/td[1]/div[text()='{$title}']/../../td[7]/span/a[text()='Edit']"); $this->click("xpath=//div[@id='reminder']/div/table/tbody//tr/td[1]/div[text()='{$title}']/../../td[7]/span/a[text()='Edit']"); $this->waitForElementPresent('_qf_ScheduleReminders_cancel-bottom'); diff --git a/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php b/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php index 33001a8240..0e9d046a43 100644 --- a/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php +++ b/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php @@ -38,17 +38,17 @@ class WebTest_Admin_Form_Setting_LocalizationTest extends CiviSeleniumTestCase { public function testDefaultCountryIsEnabled() { $this->webtestLogin(); $this->openCiviPage("admin/setting/localization", "reset=1"); - $this->addSelection("countryLimit-t", "label=UNITED STATES"); - $this->click("//select[@id='countryLimit-t']/option"); - $this->click("//input[@name='remove' and @value='<< Remove' and @type='button' and @onclick=\"QFAMS.moveSelection('countryLimit', this.form.elements['countryLimit-f[]'], this.form.elements['countryLimit-t[]'], this.form.elements['countryLimit[]'], 'remove', 'none'); return false;\"]"); - $this->addSelection("countryLimit-f", "label=AFGHANISTAN"); - $this->removeSelection("countryLimit-f", "label=AFGHANISTAN"); - $this->addSelection("countryLimit-f", "label=CAMBODIA"); - $this->removeSelection("countryLimit-f", "label=CAMBODIA"); - $this->addSelection("countryLimit-f", "label=CAMEROON"); - $this->removeSelection("countryLimit-f", "label=CAMEROON"); - $this->addSelection("countryLimit-f", "label=CANADA"); - $this->click("//input[@name='add' and @value='Add >>' and @type='button' and @onclick=\"QFAMS.moveSelection('countryLimit', this.form.elements['countryLimit-f[]'], this.form.elements['countryLimit-t[]'], this.form.elements['countryLimit[]'], 'add', 'none'); return false;\"]"); + $this->addSelection("countryLimit", "label=UNITED STATES"); + $this->click("//select[@id='countryLimit']/option"); + $this->click("//input[@name='remove']"); + $this->addSelection("countryLimit", "label=AFGHANISTAN"); + $this->removeSelection("countryLimit", "label=AFGHANISTAN"); + $this->addSelection("countryLimit", "label=CAMBODIA"); + $this->removeSelection("countryLimit", "label=CAMBODIA"); + $this->addSelection("countryLimit", "label=CAMEROON"); + $this->removeSelection("countryLimit", "label=CAMEROON"); + $this->addSelection("countryLimit", "label=CANADA"); + $this->click("//input[@name='add']"); $this->click("_qf_Localization_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); try { diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index 90db939451..65aeb606da 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -312,27 +312,27 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $id = $this->urlArg('id'); $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody/tr[1]/td[2]"); - $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody/tr[1]/td[2]//a[text()='{$subject}']"); + $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody/tr[1]/td[2]/div[text()='{$subject}']/../../td[8]/a[1]"); $this->waitForElementPresent('ActivityView'); $this->waitForElementPresent("css=table#crm-activity-view-table tr.crm-case-activityview-form-block-groupTitle"); $this->assertElementContainsText('crm-activity-view-table', "$textField"); - $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']"); + $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon fa-times']"); $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody/tr[1]/td[2]"); - $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/a[text()='{$subject}']/../../td[6]/div[text()='Scheduled']"); + $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/div[text()='{$subject}']/../../td[7]/div[text()='Scheduled']"); - $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/a[text()='{$subject}']/../../td[6]/div/form/select"); + $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/div[text()='{$subject}']/../../td[7]/div/form/select"); // change activity status - $this->select("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/a[text()='{$subject}']/../../td[6]/div/form/select", 'value=2'); - $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/a[text()='{$subject}']/../../td[6]/div/form/button[@type='submit']"); + $this->select("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/div[text()='{$subject}']/../../td[7]/div/form/select", 'value=2'); + $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id . "']/tbody//tr/td[2]/div[text()='{$subject}']/../../td[7]/div/form/button[@type='submit']"); $this->openCiviPage('case', 'reset=1'); $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[9]/span/a[text()='Manage']"); $this->waitForElementPresent('_qf_CaseView_cancel-bottom'); $id2 = $this->urlArg('id'); $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_" . $id2 . "']/tbody/tr[1]/td[2]"); - $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id2 . "']//a[text()='{$subject}']"); + $this->click("xpath=//div[@id='activities']//table[@id='case_id_" . $id2 . "']/tbody//tr/td[2]/div[text()='{$subject}']/../../td[8]/a[1]"); $this->waitForElementPresent('ActivityView'); $this->waitForElementPresent("css=table#crm-activity-view-table tr.crm-case-activityview-form-block-groupTitle"); } diff --git a/tests/phpunit/WebTest/Contact/AddressParsingTest.php b/tests/phpunit/WebTest/Contact/AddressParsingTest.php index 999bd9f0cb..bdf7b0b0af 100644 --- a/tests/phpunit/WebTest/Contact/AddressParsingTest.php +++ b/tests/phpunit/WebTest/Contact/AddressParsingTest.php @@ -76,6 +76,7 @@ class WebTest_Contact_AddressParsingTest extends CiviSeleniumTestCase { $this->click("//div[@id='addMoreAddress1']/a/span"); $this->waitForElementPresent("address_2_street_address"); $this->type("address_2_street_address", "121 Sherman Street #15"); + $this->waitForElementPresent("address_2_city"); $this->type("address_2_city", "Birmingham"); $this->type("address_2_postal_code", "3456"); $this->select("address_2_state_province_id", "value=1002"); @@ -94,6 +95,7 @@ class WebTest_Contact_AddressParsingTest extends CiviSeleniumTestCase { $this->click("//div[@id='addMoreAddress3']/a/span"); $this->waitForElementPresent("address_4_street_address"); $this->type("address_4_street_address", "121 SW Sherman Way Suite 15"); + $this->waitForElementPresent("address_4_city"); $this->type("address_4_city", "Birmingham"); $this->type("address_4_postal_code", "5491"); $this->assertSelected('address_4_country_id', "UNITED STATES"); diff --git a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php index ba76908d72..f51b74f2e1 100644 --- a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php +++ b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php @@ -327,7 +327,7 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { 'title' => 'Memberships', 'fields' => array( 'Membership Type' => array( - 'type' => 'multiselect2', + 'type' => 'select2', 'locator' => 'membership_type_id', 'values' => array(array('General', 'Student')), ), diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index af517e9bbc..ca80dee5b7 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -329,6 +329,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue(TRUE, 'greater than or equal to "{$Pdate}" AND less than or equal to "{$Ndate}"'); $value = "$lastNameSoft, $firstNameSoft"; + $this->waitForElementPresent("xpath= id('rowid{$cid}')/td[3]/a"); $this->verifyText("xpath= id('rowid{$cid}')/td[3]/a", preg_quote($value)); } diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index 72485bac45..ada9094fc6 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -123,8 +123,7 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { // ...need to use mouseDownAt on first result (which is a li element), click does not work $this->clickAt("xpath=//div[@class='select2-result-label']"); - sleep(2); - $this->waitForElementPresent("//div[@id='Tag']/div[2]/div/div/ul/li/div[text()='tagset1']"); + $this->waitForElementPresent("//div[@id='Tag']/div[2]/div/div/ul/li[1]/div[text()='tagset1']"); $this->click("xpath=//div[@id='Tag']/div[2]/div/div/ul/li[2]/input"); $this->keyDown("xpath=//div[@id='Tag']/div[2]/div/div/ul/li[2]/input", " "); $this->type("xpath=//div[@id='Tag']/div[2]/div/div/ul/li[2]/input", 'tagset2'); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 442c73b719..36852c3172 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -77,7 +77,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td/span[contains(text(), '{$params['name']}')]"); $createdBy = $this->getText("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td[3]/a"); $this->click("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td[7]/span/a[2]"); - $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/table/tbody/tr[2]/td[contains(text(), '{$createdBy}')]"); + $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/table[1]/tbody/tr[2]/td[contains(text(), '{$createdBy}')]"); $this->openCiviPage('group', 'reset=1'); //search groups using created by @@ -252,7 +252,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "Contact Saved"); $this->openCiviPage('group', 'reset=1'); - $this->waitForElementPresent("xpath=//a/span[text()='Add Group']"); + $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div[@class='crm-submit-buttons']/a/span[text()=' Add Group']"); $this->waitForElementPresent("xpath=//table[@id='DataTables_Table_0']/tbody//tr/td[1]/span[contains(text(), '{$group}')]"); $this->click("xpath=//table[@id='DataTables_Table_0']/tbody//tr/td[1]/span[text()='{$group}']/../../td[7]/span[1]/a[1]"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contact/TagAddTest.php b/tests/phpunit/WebTest/Contact/TagAddTest.php index ee45db82d9..ca1687f2e3 100644 --- a/tests/phpunit/WebTest/Contact/TagAddTest.php +++ b/tests/phpunit/WebTest/Contact/TagAddTest.php @@ -101,7 +101,7 @@ class WebTest_Contact_TagAddTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("The tag '$tagSetName' has been saved.")); // sort by ID desc - $this->click("xpath=//div[@id='cat']/div/table/thead/tr/th[2]/div[text()='ID']"); + $this->click("xpath=//table[@class='display dataTable no-footer']/thead/tr/th[2]/div[text()='ID']"); $this->waitForElementPresent("css=table.display tbody tr td"); // verify text -- 2.25.1