From 9ffaaf79b1fc6c7ed1e3da2a97011cec82eac14a Mon Sep 17 00:00:00 2001 From: Web Access Date: Fri, 28 Mar 2014 18:32:11 +0530 Subject: [PATCH] Webtest Fixes --- tests/phpunit/WebTest/Admin/CustomAddTest.php | 6 ------ tests/phpunit/WebTest/Contact/SearchTest.php | 10 +++++----- .../phpunit/WebTest/Event/AddPricesetTest.php | 18 +++++++++--------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/tests/phpunit/WebTest/Admin/CustomAddTest.php b/tests/phpunit/WebTest/Admin/CustomAddTest.php index eda32b46c0..468bcdf7c1 100644 --- a/tests/phpunit/WebTest/Admin/CustomAddTest.php +++ b/tests/phpunit/WebTest/Admin/CustomAddTest.php @@ -96,9 +96,6 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase { $this->click("_qf_Field_next_new-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - //Is custom field created? - $this->waitForText('crm-notification-container', "Your custom field '$checkboxFieldLabel' has been saved."); - //create another custom field - Number Radio $this->click("data_type[0]"); $this->select("data_type[0]", "value=2"); @@ -132,9 +129,6 @@ class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase { $this->click("_qf_Field_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - //Is custom field created - $this->waitForText('crm-notification-container', "Your custom field '$radioFieldLabel' has been saved."); - //On New Individual contact form $this->openCiviPage("contact/add", "ct=Individual&reset=1"); $this->assertElementContainsText('page-title', "New Individual"); diff --git a/tests/phpunit/WebTest/Contact/SearchTest.php b/tests/phpunit/WebTest/Contact/SearchTest.php index 9956df8465..028d82cf8c 100644 --- a/tests/phpunit/WebTest/Contact/SearchTest.php +++ b/tests/phpunit/WebTest/Contact/SearchTest.php @@ -113,7 +113,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForText("crm-notification-container","Contact has been added to '$groupName'."); // tag a contact // visit tag tab @@ -128,7 +128,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $this->openCiviPage("contact/search", "reset=1"); // fill name as first_name - $this->type("css=.crm-basic-criteria-form-block input#sort_name", $firstName); + $this->type("sort_name", $firstName); // select contact type as Indiividual $this->select("contact_type", "value=Individual"); @@ -141,7 +141,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // click to search $this->click("_qf_Basic_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("xpath=//div[@class='crm-search-results']"); // Is contact present in search result? $this->assertElementContainsText('css=.crm-search-results > table.row-highlight', $sortName); @@ -202,7 +202,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$parentGroupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForText("crm-notification-container","Contact has been added to '$parentGroupName'."); // Adding child group contact // We're using Quick Add block on the main page for this. @@ -220,7 +220,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // add to child group $this->select("group_id", "*$childGroupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForText("crm-notification-container","Contact has been added to '$childGroupName'."); // visit contact search page $this->openCiviPage("contact/search", "reset=1"); diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 9e7a988bd8..e0e9f86d85 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -73,7 +73,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->check('extends[2]'); } - $this->select("css=select.form-select", "label={$financialType}"); + $this->select("financial_type_id", "label={$financialType}"); $this->type('help_pre', $setHelp); @@ -170,7 +170,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage('admin/price', 'reset=1'); // Use the price set id ($sid) to pick the correct row - $this->clickLink("css=tr#row_{$sid} a[title='Preview Price Set']", '_qf_Preview_cancel-bottom'); + $this->clickLink("//*[@id='price_set-{$sid}']/td[4]/span[1]/a[2]", '_qf_Preview_cancel-bottom'); // Check for expected price set field strings $this->assertStringsPresent($validateStrings); @@ -554,13 +554,13 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->select('price_set_id', 'label=' . $setTitle); $this->click('_qf_Fee_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForText("crm-notification-container","'Fees' information has been saved."); $this->openCiviPage('participant/add', 'reset=1&action=add&context=standalone', '_qf_Participant_upload-bottom'); // Type contact last name in contact auto-complete, wait for dropdown and click first result $this->webtestFillAutocomplete($firstName); - $this->select('event_id', "label=regexp:$eventTitle"); + $this->select2('event_id', $eventTitle); // Select role $this->click('role_id[2]'); @@ -596,9 +596,9 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { // Is status message correct? $this->assertElementContainsText("css=#crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!"); - $this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//form[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the participant view screen - $this->click("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//form[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom'); $this->webtestVerifyTabularData( @@ -607,7 +607,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { 'Participant Role' => 'Attendee', 'Status' => 'Registered', 'Event Source' => 'Event StandaloneAddTest Webtest', - 'Event Fees' => 'Event Total: $ 2,705.00', + 'Fees' => 'Event Total: $ 2,705.00', ) ); $expectedLineItems = array( @@ -638,7 +638,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->_checkLineItems($expectedLineItems); // check contribution record as well // click through to the contribution view screen - $this->click("xpath=id('ParticipantView')/div[2]/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//*[@id='ParticipantView']/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); $this->webtestVerifyTabularData( @@ -727,7 +727,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { function _checkLineItems($expectedLineItems) { foreach ($expectedLineItems as $lineKey => $lineValue) { foreach ($lineValue as $key => $value) { - $this->verifyText("xpath=//table/tbody/tr/td[text()='Event Fees']/following-sibling::td/table/tbody/tr[$lineKey]/td[$key]", preg_quote($value)); + $this->verifyText("xpath=//table/tbody//tr/td[text()='Selections']/following-sibling::td/table/tbody//tr[$lineKey]/td[$key]", preg_quote($value)); } } } -- 2.25.1