X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FContribute%2FContactContextAddTest.php;h=cd7458f501d8e7c6d626d30d8532a8d80f4a777c;hb=6f2500ee7589360102875df4367568fe87485df6;hp=a82f030e29aa1f91dbcbecdd5daf4d8defd2afa3;hpb=356704a752fbae4e3854bf53616ae3a655d5dc9a;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php index a82f030e29..cd7458f501 100644 --- a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php @@ -1,7 +1,7 @@ webtestLogin(); @@ -45,8 +49,8 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { // We're using Quick Add block on the main page for this. $firstName = substr(sha1(rand()), 0, 7); // Add new Financial Account - $orgName = 'Alberta '.substr(sha1(rand()), 0, 7); - $financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4); + $orgName = 'Alberta ' . substr(sha1(rand()), 0, 7); + $financialAccountTitle = 'Financial Account ' . substr(sha1(rand()), 0, 4); $financialAccountDescription = "{$financialAccountTitle} Description"; $accountingCode = 1033; $financialAccountType = 'Asset'; @@ -57,7 +61,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $isDefault = FALSE; //Add new organisation - if($orgName) { + if ($orgName) { $this->webtestAddOrganization($orgName); } $this->_testAddFinancialAccount($financialAccountTitle, @@ -72,7 +76,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $isDefault ); - $this->webtestAddContact($firstName, "Anderson", true); + $this->webtestAddContact($firstName, "Anderson", TRUE); // Get the contact id of the new contact $contactUrl = $this->parseURL(); @@ -124,7 +128,6 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $this->type("invoice_id", time()); $this->webtestFillDate('thankyou_date'); - //Premium section $this->click("Premium"); $this->waitForElementPresent("fulfilled_date"); @@ -133,11 +136,14 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $this->webtestFillDate('fulfilled_date'); // Clicking save. - $this->clickLink("_qf_Contribution_upload-bottom", 'civicrm-footer'); + $this->clickLink("_qf_Contribution_upload-bottom", 'civicrm-footer', FALSE); // Is status message correct? $this->waitForText('crm-notification-container', "The contribution record has been saved"); $this->waitForElementPresent("xpath=//div[@class='view-content']/table[2]/tbody/tr/td[8]/span/a[text()='View']"); + $viewUrl = $this->parseURL($this->getAttribute("xpath=//div[@class='view-content']/table[2]/tbody/tr/td[8]/span/a[text()='View']@href")); + $id = $viewUrl['queryString']['id']; + $this->assertType('numeric', $id); // click through to the Contribution view screen $this->click("xpath=//div[@class='view-content']/table[2]/tbody/tr/td[8]/span/a[text()='View']"); @@ -160,9 +166,6 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { } // check values of contribution record in the DB - $viewUrl = $this->parseURL(); - $id = $viewUrl['queryString']['id']; - $this->assertType('numeric', $id); $searchParams = array('id' => $id); $compareParams = array( @@ -172,7 +175,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams); // go to soft creditor contact view page - $this->click("css=table.crm-soft-credit-listing tbody tr td a"); + $this->clickLink("css=table.crm-soft-credit-listing tbody tr td a"); // go to contribution tab $this->waitForElementPresent("css=li#tab_contribute a"); @@ -187,8 +190,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { 1 => "{$firstName} Anderson", ); foreach ($expected as $value => $label) { - $this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[$value]", preg_quote($label)); + $this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody//tr/td[$value]", preg_quote($label)); } } } -