Webtest fixes and cleanup
authorColeman Watts <coleman@civicrm.org>
Sun, 21 Sep 2014 00:49:46 +0000 (20:49 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 21 Sep 2014 00:49:46 +0000 (20:49 -0400)
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/WebTest/Campaign/OfflineContributionTest.php
tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php
tests/phpunit/WebTest/Event/AddParticipationTest.php
tests/phpunit/WebTest/Event/AdditionalPaymentTest.php

index d6cbb6447d3b5325396617617459246a7ef32538..2993bf30b25765f747ec24aaedce67aa8c4e1343 100644 (file)
@@ -2074,13 +2074,20 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
 
                                      which uses the entity info as its selection value
    * @param array  $pageUrl          the url which on which the ajax custom group load takes place
-   * @param $beforeTriggering        code to execute before actual element triggering
+   * @param callable|boolean $beforeTriggering fn to execute before actual element triggering
    * @return void
    */
   function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, $beforeTriggering = NULL) {
     //add the custom set
     $return = $this->addCustomGroupField($customSets);
 
+    // Hack to ensure caches are properly cleared
+    // FIXME: This shouldn't be necessary, try to find root of the problem with WebTest_Event_AddParticipationTest::testAjaxCustomGroupLoad
+    if ($beforeTriggering === TRUE) {
+      $this->webtestLogout();
+      $this->webtestLogin();
+    }
+
     $this->openCiviPage($pageUrl['url'], $pageUrl['args']);
     foreach($return as $values) {
       foreach ($values as $entityType => $customData) {
@@ -2088,7 +2095,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
         list($entity, $entityData) = explode('_', $entityType);
         $elementType = CRM_Utils_Array::value('type', $customData['triggerElement'], 'select');
         $elementName = CRM_Utils_Array::value('name', $customData['triggerElement']);
-        if ($beforeTriggering) {
+        if (is_callable($beforeTriggering)) {
           call_user_func($beforeTriggering);
         }
         if ($elementType == 'select') {
@@ -2112,8 +2119,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
           }
         }
         //checking for proper custom data which is loading through ajax
-        $this->waitForElementPresent("xpath=//div[contains(@class, 'custom-group-{$customData['cgtitle']}')]",
-          "The on the fly custom group has not been rendered for entity : {$entity} => {$entityData}");
+        $this->waitForElementPresent("xpath=//div[contains(@class, 'custom-group-{$customData['cgtitle']}')]");
         $this->assertElementPresent("xpath=//div[contains(@class, 'custom-group-{$customData['cgtitle']}')]/div[contains(@class, 'crm-accordion-body')]/table/tbody/tr/td[2]/input",
           "The on the fly custom group field is not present for entity : {$entity} => {$entityData}");
       }
index e60da9dae407ab75dbbb48050bf7d6f2c16368ed..b2f702a029a5b9292c0fa9b88908d865a28ee0a1 100644 (file)
@@ -105,14 +105,12 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->select("status_id", "value=2");
 
     // click save
-    $this->click("_qf_Campaign_upload-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink("_qf_Campaign_upload-bottom");
 
-    $this->waitForText('crm-notification-container', "Campaign $title");
+    $this->checkCRMAlert("Campaign $title");
 
-    $this->waitForElementPresent("xpath=//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='$campaignTitle']");
-    $url = explode('id=', $this->getAttribute("xpath=//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='$campaignTitle']/../td[13]/span/a[text()='Edit']@href"));
-    $campaignId = $url[1];
+    $this->waitForElementPresent("//td[text()='$campaignTitle']");
+    $campaignId = $this->urlArg('id', $this->getAttribute("//td[text()='$campaignTitle']/../td[13]/span/a[text()='Edit']@href"));
 
     $this->offlineContributionTest($campaignTitle, $campaignId);
 
@@ -155,13 +153,9 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
 
     if ($past) {
       $this->click("include-past-campaigns");
-      // 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
-      // FIXME: Use a better method for waiting for this AJAX call - sleep is not going to work!
-      sleep(2);
+      $this->waitForElementPresent("css=#campaign_id option[value=$id]");
     }
 
-    $this->click("campaign_id");
     $this->select("campaign_id", "value=$id");
 
     // total amount
@@ -203,7 +197,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contribution_upload-bottom");
 
     // Is status message correct?
-    $this->waitForText('crm-notification-container', "The contribution record has been saved.");
+    $this->checkCRMAlert("The contribution record has been saved.");
 
     $this->waitForElementPresent("xpath=//*[@id='Search']//div[2]//table[2]/tbody/tr/td[8]/span/a[text()='View']");
 
@@ -220,9 +214,9 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
       $this->addSelection("enableComponents-t", "label=CiviCampaign");
       $this->click("//option[@value='CiviCampaign']");
       $this->click("remove");
-      $this->click("_qf_Component_next-bottom");
-      $this->waitForPageToLoad($this->getTimeoutMsec());
-      $this->assertTrue($this->isTextPresent("Changes Saved."));
+      $this->clickLink("_qf_Component_next-bottom");
+
+      $this->checkCRMAlert("Changes Saved.");
 
       $this->openCiviPage('contribute/search', 'reset=1', '_qf_Search_refresh');
 
@@ -255,28 +249,24 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->multiselect2("includeGroups", array("$groupName", "Advisory Board"));
 
     // fill the start date for campaign
-    $this->webtestFillDate("start_date", "1 January 2011");
+    $this->webtestFillDate("start_date", "1 January " . (date('Y') - 1));
 
     // fill the end date for campaign
-    $this->webtestFillDate("end_date", "31 January 2011");
+    $this->webtestFillDate("end_date", "31 January " . (date('Y') - 1));
 
     // select campaign status
     $this->select("status_id", "value=3");
 
     // click save
-    $this->click("_qf_Campaign_upload-bottom");
-    $this->waitForElementPresent("//*[@id='crm-notification-container']");
-    $this->waitForText('crm-notification-container', "Campaign $pastCampaignTitle has been saved.");
+    $this->clickLink("_qf_Campaign_upload-bottom");
+    $this->checkCRMAlert("Campaign $pastCampaignTitle has been saved.");
 
     $this->waitForElementPresent("link=Add Campaign");
     $this->waitForElementPresent("link=Campaigns");
     $this->click("search_form_campaign");
     $this->type("campaign_title", $pastCampaignTitle);
-    $this->click("xpath=//div[@class='crm-accordion-body']/table/tbody/tr[4]/td/a[text()='Search']");
-
-    $this->waitForElementPresent("xpath=//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='$pastCampaignTitle']");
-    $url = explode('id=', $this->getAttribute("xpath=//div[@id='campaignList']/div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='$pastCampaignTitle']/../td[13]/span/a[text()='Edit']@href"));
-    $campaignId = $url[1];
+    $this->clickAjaxLink("//a[text()='Search']", "//td[text()='$pastCampaignTitle']");
+    $campaignId = $this->urlArg('id', $this->getAttribute("//td[text()='$pastCampaignTitle']/../td[13]/span/a[text()='Edit']@href"));
 
     $this->offlineContributionTest($pastCampaignTitle, $campaignId, TRUE);
   }
index 59f256b45f306919afd1086dfa908b32e1c56502..89c4acf1ad0455f041ecb7b6fd7f5f6243894950 100644 (file)
@@ -135,8 +135,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase
     $this->click("campaign_id");
     $this->select("campaign_id", "value=$id");
     $this->waitForElementPresent('_qf_EventInfo_upload_done-bottom');
-    $this->click("_qf_EventInfo_upload_done-bottom");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink("_qf_EventInfo_upload_done-bottom");
 
     // Adding contact with randomized first name (so we can then select that contact when creating event registration)
     // We're using Quick Add block on the main page for this.
@@ -148,7 +147,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase
     $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, 'contact_id');
+    $this->webtestFillAutocomplete($firstName);
 
     // Select event. Based on label for now.
     $this->select2("event_id", $eventName);
index 71227d0c1ace083119a6b1202d1573433d9b7d17..017ae01758b5ab33da960deef8248c2ed89bc754 100644 (file)
@@ -36,14 +36,11 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
   }
 
   function testEventParticipationAdd() {
-    // Log in using webtestLogin() method
     $this->webtestLogin();
 
     // Adding contact with randomized first name (so we can then select that contact when creating event registration)
-    // We're using Quick Add block on the main page for this.
     $firstName = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName, 'Anderson', TRUE);
-    $contactName = "Anderson, $firstName";
     $displayName = "$firstName Anderson";
 
     $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom");
@@ -61,7 +58,6 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     // Using helper webtestFillDate function.
     $this->webtestFillDate('register_date', 'now');
     $today = date('F jS, Y', strtotime('now'));
-    // May 5th, 2010
 
     // Select participant status
     $this->select('status_id', 'value=1');
@@ -92,16 +88,14 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     $this->assertTrue($this->isChecked("send_receipt"), 'Send Confirmation and Receipt checkbox should be checked by default but is not checked.');
     
     // Clicking save.
-    $this->click('_qf_Participant_upload-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink('_qf_Participant_upload-bottom');
 
     // Is status message correct?
-    $this->waitForText('crm-notification-container', "Event registration for $displayName has been added");
+    $this->checkCRMAlert("Event registration for $displayName has been added");
 
     $this->waitForElementPresent("xpath=//*[@id='Search']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
     //click through to the participant view screen
-    $this->click("xpath=//*[@id='Search']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
-    $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom');
+    $this->clickAjaxLink("xpath=//*[@id='Search']//table/tbody/tr[1]/td[8]/span/a[text()='View']", '_qf_ParticipantView_cancel-bottom');
 
     $this->webtestVerifyTabularData(
       array(
@@ -114,8 +108,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     );
     // check contribution record as well
     //click through to the contribution view screen
-    $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->clickAjaxLink("xpath=id('ParticipantView')/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom');
 
     $this->webtestVerifyTabularData(
       array(
@@ -133,18 +126,15 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     $this->webtestLogin();
 
     // Adding contact with randomized first name (so we can then select that contact when creating event registration)
-    // We're using Quick Add block on the main page for this.
     $firstName = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName, 'Anderson', TRUE);
-    $contactName = "Anderson, $firstName";
     $displayName = "$firstName Anderson";
 
     // add custom data for participant role
     $this->openCiviPage("admin/custom/group", "reset=1");
 
     //add new custom data
-    $this->click("//a[@id='newCustomDataGroup']/span");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink("//a[@id='newCustomDataGroup']/span");
 
     //fill custom group title
     $customGroupTitle = 'custom_' . substr(sha1(rand()), 0, 7);
@@ -159,12 +149,13 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     $this->select('extends[1][]', 'value=2');
 
     $this->click("//option[@value='Contact']");
-    $this->clickLink('_qf_Group_next', 'label');
+    $this->clickLink('_qf_Group_next');
 
     //Is custom group created?
-    $this->waitForText('crm-notification-container', "Your custom field set '$customGroupTitle' has been added. You can add custom fields now.");
+    $this->checkCRMAlert("Your custom field set '$customGroupTitle' has been added. You can add custom fields now.");
 
     //add custom field - alphanumeric checkbox
+    $this->waitForAjaxContent();
     $checkboxFieldLabel = 'custom_field' . substr(sha1(rand()), 0, 4);
     $this->click('label');
     $this->type('label', $checkboxFieldLabel);
@@ -195,13 +186,14 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     $this->click('is_searchable');
 
     //clicking save
-    $this->clickLink('_qf_Field_done-bottom', 'newCustomField', FALSE);
+    $this->click('_qf_Field_done-bottom');
 
     //Is custom field created?
-    $this->waitForText('crm-notification-container', "Custom field '$checkboxFieldLabel' has been saved.");
+    $this->checkCRMAlert("Custom field '$checkboxFieldLabel' has been saved.");
+    $this->waitForAjaxContent();
 
     //create another custom field - Integer Radio
-    $this->clickLink('newCustomField', '_qf_Field_cancel', FALSE);
+    $this->clickAjaxLink('newCustomField', '_qf_Field_cancel');
     $this->click('data_type[0]');
     $this->select('data_type[0]', 'value=1');
     $this->click("//option[@value='1']");
@@ -235,7 +227,10 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     $this->click('is_searchable');
 
     //clicking save
-    $this->click('_qf_Field_done-bottom');
+    $this->clickAjaxLink('_qf_Field_done-bottom', NULL);
+
+    // Visit home page for a sec to give caches time to be cleared
+    $this->openCiviPage('');
 
     $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom");
 
@@ -282,16 +277,14 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
     $this->type('check_number', '1044');
 
     // Clicking save.
-    $this->click('_qf_Participant_upload-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink('_qf_Participant_upload-bottom');
 
     // Is status message correct?
-    $this->waitForText('crm-notification-container', "Event registration for $displayName has been added");
+    $this->checkCRMAlert("Event registration for $displayName has been added");
 
     $this->waitForElementPresent("xpath=//*[@id='Search']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
     //click through to the participant view screen
-    $this->click("xpath=//*[@id='Search']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
-    $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom');
+    $this->clickAjaxLink("xpath=//*[@id='Search']//table/tbody/tr[1]/td[8]/span/a[text()='View']", '_qf_ParticipantView_cancel-bottom');
 
     $this->webtestVerifyTabularData(
       array(
@@ -309,8 +302,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
 
     // check contribution record as well
     //click through to the contribution view screen
-    $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->clickAjaxLink("xpath=id('ParticipantView')/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom');
 
     $this->webtestVerifyTabularData(
       array(
@@ -369,7 +361,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
       array('entity' => 'ParticipantRole', 'subEntity' => 'Attendee','triggerElement' => array('name' => 'role_id', 'type' => "select"))
     );
     $pageUrl = array('url' => "participant/add", 'args' => "reset=1&action=add&context=standalone");
-    $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl);
+    $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, TRUE);
   }
 
   /*
index 268b87e5b3ea3e97f648e0bf684ea45fa5c34719..8467774ecce2bb85236a44e8b25f035337f8178a 100644 (file)
@@ -46,7 +46,6 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
 
     $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);
 
     // Select event. Based on label for now.
@@ -59,7 +58,6 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
     // Using helper webtestFillDate function.
     $this->webtestFillDate('register_date', 'now');
     $today = date('F jS, Y', strtotime('now'));
-    // May 5th, 2010
 
     // Select participant status
     $this->select('status_id', 'value=1');
@@ -89,7 +87,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
     $this->type('check_number', '1044');
 
     // give some time for js to process
-    sleep(1);
+    $this->waitForAjaxContent();
     $this->verifySelectedLabel("status_id", 'Partially paid');
 
     // later on change the status
@@ -105,8 +103,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
     $this->select('status_id', 'label=Partially paid');
 
     // Clicking save.
-    $this->click('_qf_Participant_upload-bottom');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->clickLink('_qf_Participant_upload-bottom');
 
     // Is status message correct?
     $this->waitForText('crm-notification-container', "Event registration for $displayName has been added");
@@ -142,22 +139,19 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
       )
     );
 
-    $this->click('_qf_ContributionView_cancel-top');
+    $this->clickAjaxLink('_qf_ContributionView_cancel-top');
     $this->waitForElementPresent("xpath=id('ParticipantView')/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
     // make additional payment
     // 1 - check for links presence on participant view and edit page
     $this->assertElementPresent("xpath=id('Search')/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span[2]/ul/li[2]/a[text()='Record Payment']");
     $this->click("xpath=id('Search')/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
     $this->waitForElementPresent("xpath=id('ParticipantView')");
-    $this->assertElementPresent("xpath=id('ParticipantView')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]");
+    $this->waitForElementPresent("xpath=id('ParticipantView')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]");
 
     $this->click("xpath=id('ParticipantView')//div[@class='action-link']/div/a/span[contains(text(), 'Edit')]");
     $this->waitForElementPresent("xpath=id('Participant')");
-    $this->assertElementPresent("xpath=id('Participant')//td[@id='payment-info']//a/span[contains(text(), 'Record Payment')]");
-    $location = $this->getAttribute("xpath=id('Participant')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]/../@href");
-
-    $this->open($location);
-    $this->waitForElementPresent("xpath=id('AdditionalPayment')");
+    $this->waitForElementPresent("xpath=id('Participant')//td[@id='payment-info']//a/span[contains(text(), 'Record Payment')]");
+    $this->clickLinkSuppressPopup("xpath=id('Participant')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]/../", 'AdditionalPayment');
 
     // verify balance
     $text = $this->getText("xpath=id('AdditionalPayment')/div[2]//table/tbody/tr[3]/td[2]");
@@ -171,7 +165,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
     $this->waitForText("xpath=//span[@id='totalAmount']/span", 'Payment amount cannot be greater than owed amount');
     $this->type('total_amount', $balance);
     $this->click('_qf_AdditionalPayment_upload-bottom');
-    $this->waitForText('crm-notification-container', 'The payment record has been processed.');
+    $this->checkCRMAlert('The payment record has been processed.');
 
     $this->waitForElementPresent("xpath=id('Search')/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
     $this->click("xpath=id('Search')/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
@@ -188,11 +182,10 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
     // check the fee amount and contribution amount
     $this->_checkPaymentInfoTable(800.00, 800.00);
 
-    // check for not apprence of record payment button
+    // check for absence of record payment button
     $this->assertFalse($this->isElementPresent("xpath=id('ParticipantView')//td[@id='payment-info']//a/span[contains(text(), 'Record Payment')]"));
 
-    $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->clickAjaxLink("xpath=id('ParticipantView')/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
 
     $this->webtestVerifyTabularData(
       array(
@@ -208,7 +201,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
 
     // view transaction popup info check
     $this->waitForElementPresent("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a");
-    $this->click("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a");
+    $this->clickAjaxLink("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a");
     $this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[contains(text(), 'Amount')]/../../tr[2]/td[contains(text(), '$ 400.00')]/../../tr[3]/td[contains(text(), '$ 400.00')]");
     $this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[3][contains(text(), 'Paid By')]/../../tr[2]/td[3][contains(text(), 'Check')]/../../tr[3]/td[3][contains(text(), 'Cash')]");
     $this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[6][contains(text(), 'Status')]/../../tr[2]/td[6][contains(text(), 'Completed')]/../../tr[3]/td[6][contains(text(), 'Completed')]");