From: Coleman Watts Date: Fri, 19 Sep 2014 02:45:47 +0000 (-0400) Subject: Webtest fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c3ad86334b83050ce3869a4b00925280ca50e4a2;p=civicrm-core.git Webtest fixes --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 1c20374340..cb33571f29 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -721,17 +721,16 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { * @return int */ - function webtestAddPaymentProcessor($processorName, $processorType = 'Dummy', $processorSettings = NULL, $financialAccount = 'Deposit Bank Account') { + function webtestAddPaymentProcessor($processorName = 'Test Processor', $processorType = 'Dummy', $processorSettings = NULL, $financialAccount = 'Deposit Bank Account') { if (!$processorName) { $this->fail("webTestAddPaymentProcessor requires $processorName."); } - if ($processorType == 'Dummy') { - $processorSettings = array( - 'user_name' => 'dummy', - 'url_site' => 'http://dummy.com', - 'test_user_name' => 'dummytest', - 'test_url_site' => 'http://dummytest.com', - ); + if ($processorName === 'Test Processor') { + // Use the default test processor, no need to create a new one + $this->openCiviPage('admin/paymentProcessor', 'action=update&id=1&reset=1'); + $this->check('is_default'); + $this->clickLink('_qf_PaymentProcessor_next-bottom'); + return 1; } elseif ($processorType == 'AuthNet') { // FIXME: we 'll need to make a new separate account for testing @@ -970,7 +969,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { function webtestAddContributionPage($hash = NULL, $rand = NULL, $pageTitle = NULL, - $processor = array('Dummy Processor' => 'Dummy'), + $processor = array('Test Processor' => 'Dummy'), $amountSection = TRUE, $payLater = TRUE, $onBehalf = TRUE, @@ -2113,15 +2112,17 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->waitForTextPresent("{$customGroupTitle} - New Field"); $fieldLabel = "custom_field_for_{$customSet['entity']}_{$customSet['subEntity']}" . substr(sha1(rand()), 0, 4); + $this->waitForElementPresent('label'); $this->type('label', $fieldLabel); $this->click('_qf_Field_done-bottom'); - $customGroupTitle = preg_replace('/\s/', '_', trim($customGroupTitle)); + $this->waitForText('crm-notification-container', $fieldLabel); + $this->waitForAjaxContent(); + + $customGroupTitle = preg_replace('/\s/', '_', trim($customGroupTitle)); $return[] = array( "{$customSet['entity']}_{$customSet['subEntity']}" => array('cgtitle' => $customGroupTitle, 'gid' => $gid, 'triggerElement' => $customSet['triggerElement'])); } - // Avoid weird qf_key bug when going straight from here to the next form - $this->openCiviPage(''); return $return; } diff --git a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php index 66cbc2456c..40a6d6b9c8 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php @@ -120,8 +120,8 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { * @param $id */ function onlineContributionAddTest($campaignTitle, $id) { - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $paymentProcessorId = $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("admin/contribute/add", "reset=1&action=add"); diff --git a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php index 7e9e1a9df5..146538eeb8 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php @@ -117,8 +117,8 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase * @param $id */ function onlineParticipantAddTest($campaignTitle, $id) { - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $paymentProcessorId = $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("event/add", "reset=1&action=add"); diff --git a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php index e972c6624f..1eef4875ca 100644 --- a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php @@ -297,8 +297,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->select("campaign_survey_id", "label=Survey $title"); $this->waitForElementPresent('_qf_Search_refresh'); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]",'1 Result'); } diff --git a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php index 9bd7121b89..dda1b0c47d 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php @@ -71,7 +71,7 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { $this->select2("xpath=//tr[@class='addRow']/td[contains(text(),'Add activity:')]/span/div/a", $tActivityType, FALSE, TRUE); } - $this->click("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']"); + $this->clickAjaxLink("xpath=//div[@class='crm-submit-buttons']/span/input[@value='Save']", NULL); $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); $firstName = substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index 479958640d..d3053109c2 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -39,8 +39,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $paymentProcessorId = $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage('event/add', 'reset=1&action=add'); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 8122518bd3..9160f210c4 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -77,16 +77,12 @@ 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[2]/tbody/tr/td[2]/select"); - - //assert created by in the edit page - $this->assertTrue($this->isElementPresent( - "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/tbody/tr[2]/td[contains(text(), '{$createdBy}')]"); $this->openCiviPage('group', 'reset=1'); //search groups using created by $this->type('created_by', $createdBy); - $this->click('_qf_Search_refresh'); + $this->clickLink('_qf_Search_refresh'); //show maximum no. of groups on first result set page //as many groups can be created by same creator @@ -97,11 +93,10 @@ 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']}')]"); $this->click("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td/span[contains(text(), '{$params['name']}')]/../following-sibling::td[2]/a[text()='{$createdBy}']"); - $this->assertTrue($this->isElementPresent("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td/span[contains(text(), '{$params['name']}')]/../following-sibling::td[2]/a[text()='{$createdBy}']")); + $this->waitForElementPresent("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody/tr/td/span[contains(text(), '{$params['name']}')]/../following-sibling::td[2]/a[text()='{$createdBy}']"); //check link of the contact who created the group - $this->click("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody//tr/td[1]/span[contains(text(),'{$params['name']}')]/../following-sibling::td[2]/a"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("xpath=//table[@class='crm-group-selector no-footer dataTable']/tbody//tr/td[1]/span[contains(text(),'{$params['name']}')]/../following-sibling::td[2]/a", "css=div.crm-summary-display_name"); $name = explode(',', $createdBy); $name1 = isset($name[1]) ? trim($name[1]) : NULL; $name0 = trim($name[0]); @@ -144,11 +139,10 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->click("is_reserved"); // Clicking save. - $this->click("_qf_Edit_upload"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Edit_upload"); // Is status message correct? - $this->assertTrue($this->isTextPresent("The Group '{$params['name']}' has been saved.")); + $this->waitForText('crm-notification-container', "The Group '{$params['name']}' has been saved."); // Create a new role w/o reserved group permissions $role = 'role' . substr(sha1(rand()), 0, 7); @@ -156,8 +150,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("edit-add"); $this->type("edit-name", $role); - $this->click("edit-add"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("edit-add", NULL); $this->open($this->sboxPath . "admin/people/permissions/roles"); $this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role}']"); diff --git a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php index 49aa5a23b5..89f4ce23c5 100644 --- a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php @@ -342,8 +342,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("admin/contribute/add", "reset=1&action=add"); @@ -463,8 +463,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("admin/contribute/add", "reset=1&action=add"); diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index 26e906d311..90ee451689 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -39,7 +39,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $rand = 2 * rand(2, 50); $pageTitle = 'Donate Online ' . $hash; // create contribution page with randomized title and default params - $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array("Webtest Dummy" . substr(sha1(rand()), 0, 7) => 'Dummy'), TRUE, TRUE, 'required'); + $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array('Test Processor' => 'Dummy'), TRUE, TRUE, 'required'); $this->openCiviPage("admin/contribute", "reset=1"); @@ -94,7 +94,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $rand = 2 * rand(2, 50); $pageTitle = 'Donate Online ' . $hash; // create contribution page with randomized title and default params - $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array("Webtest Dummy" . substr(sha1(rand()), 0, 7) => 'Dummy'), TRUE, TRUE, 'required'); + $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array('Test Processor' => 'Dummy'), TRUE, TRUE, 'required'); $this->openCiviPage("admin/contribute", "reset=1"); @@ -152,7 +152,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $pageTitle = 'Donate Online ' . $hash; // create contribution page with randomized title, default params and separate payment for Membership and Contribution - $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array("Webtest Dummy" . substr(sha1(rand()), 0, 7) => 'Dummy'), + $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array('Test Processor' => 'Dummy'), TRUE, TRUE, 'required', TRUE, FALSE, TRUE, NULL, TRUE, 1, 7, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE ); @@ -292,7 +292,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $hash = substr(sha1(rand()), 0, 7); $rand = 2 * rand(2, 50); $pageTitle = 'Donate Online ' . $hash; - $processor = array("Webtest Dummy" . substr(sha1(rand()), 0, 7) => 'Dummy'); + $processor = array('Test Processor' => 'Dummy'); // Create a new payment processor while (list($processorName, $processorType) = each($processor)) { diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index 5f6cb83f77..f0da52f82f 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -53,8 +53,8 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->webtestAddContact($firstName, $lastName, $email); $cid = $this->urlArg('cid'); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $processorType = 'Dummy'; $pageTitle = substr(sha1(rand()), 0, 7); $rand = 100; @@ -315,8 +315,8 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click("details-save"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $processorType = 'Dummy'; $pageTitle = substr(sha1(rand()), 0, 7); $rand = 100; @@ -1411,8 +1411,8 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click('_qf_Field_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $processorType = 'Dummy'; $pageTitle = substr(sha1(rand()), 0, 7); $rand = 100; diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index fb3e6d9657..60d83a3d42 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -38,8 +38,8 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { function testOnlineContributionAdd() { $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $processorType = 'Dummy'; $pageTitle = substr(sha1(rand()), 0, 7); $rand = 2 * rand(10, 50); @@ -181,8 +181,8 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { function testOnlineContributionWithZeroAmount () { $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $processorType = 'Dummy'; $pageTitle = substr(sha1(rand()), 0, 7); $rand = 2 * rand(10, 50); diff --git a/tests/phpunit/WebTest/Contribute/PCPAddTest.php b/tests/phpunit/WebTest/Contribute/PCPAddTest.php index a41648b617..7265a78210 100755 --- a/tests/phpunit/WebTest/Contribute/PCPAddTest.php +++ b/tests/phpunit/WebTest/Contribute/PCPAddTest.php @@ -62,8 +62,6 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $hash = substr(sha1(rand()), 0, 7); $rand = $contributionAmount = 2 * rand(2, 50); $pageTitle = 'PCP Contribution' . $hash; - $processorType = 'Dummy'; - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $amountSection = TRUE; $payLater = TRUE; $onBehalf = FALSE; @@ -84,7 +82,7 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, - array($processorName => $processorType), + array('Test Processor' => 'Dummy'), $amountSection, $payLater, $onBehalf, @@ -133,9 +131,7 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->type("cms_confirm_pass", $pass); } - $this->click("_qf_PCPAccount_next-bottom"); - - $this->waitForElementPresent("_qf_Campaign_upload-bottom"); + $this->clickLink("_qf_PCPAccount_next-bottom", "_qf_Campaign_upload-bottom"); $pcpTitle = 'PCPTitle' . substr(sha1(rand()), 0, 7); $this->type("pcp_title", $pcpTitle); @@ -146,13 +142,11 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->webtestLogin(); $this->openCiviPage("admin/pcp", "reset=1", "_qf_PCP_refresh"); $this->select('status_id', 'value=1'); - $this->click("_qf_PCP_refresh"); - $this->waitForElementPresent("_qf_PCP_refresh"); + $this->clickLink("_qf_PCP_refresh", "_qf_PCP_refresh"); $id = explode('id=', $this->getAttribute("xpath=//div[@id='option11_wrapper']/table[@id='option11']/tbody/tr/td/a[text()='$pcpTitle']@href")); $pcpId = trim($id[1]); $pcpUrl = "civicrm/contribute/pcp/info?reset=1&id=$pcpId"; - $this->click("xpath=//td[@id=$pcpId]/span[1]/a[2]"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("xpath=//td[@id=$pcpId]/span[1]/a[2]"); // logout $this->webtestLogout(); diff --git a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php index e391693a7a..21b9dccfbe 100644 --- a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php @@ -191,8 +191,8 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC */ function _testOnlineContribution($firstName, $lastName, $email) { - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $processorType = 'Dummy'; $pageTitle = substr(sha1(rand()), 0, 7); $rand = 2 * rand(2, 50); diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index d2a09355ec..55586c7caa 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -39,8 +39,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("event/add", "reset=1&action=add"); @@ -83,8 +83,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("event/add", "reset=1&action=add"); @@ -123,8 +123,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("event/add", "reset=1&action=add"); @@ -169,8 +169,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("event/add", "reset=1&action=add"); @@ -225,8 +225,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("event/add", "reset=1&action=add"); diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 8aecd6cfc4..5f09b95ee1 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -222,8 +222,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom'); @@ -383,8 +383,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom'); diff --git a/tests/phpunit/WebTest/Event/EventWaitListTest.php b/tests/phpunit/WebTest/Event/EventWaitListTest.php index 293b700c60..f3692e7da4 100644 --- a/tests/phpunit/WebTest/Event/EventWaitListTest.php +++ b/tests/phpunit/WebTest/Event/EventWaitListTest.php @@ -37,8 +37,8 @@ class WebTest_Event_EventWaitListTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("event/add", "reset=1&action=add"); diff --git a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php index df91083e7f..94380c810f 100755 --- a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php +++ b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php @@ -47,8 +47,8 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->click("_qf_Event_next-top"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); //event 1 @@ -137,8 +137,8 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); //event 1 diff --git a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php index cbc8dcc7a1..6d68e4dca9 100644 --- a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php +++ b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php @@ -47,8 +47,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $email1 = $firstName . "@test.com"; $email2 = $participantfname . "@test.com"; - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); //add email to name and address profile @@ -147,8 +147,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $email3 = $participantfname2 . "@test.com"; $email4 = $firstName2 . "@test.com"; - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); //add email field to name and address profile diff --git a/tests/phpunit/WebTest/Event/PCPAddTest.php b/tests/phpunit/WebTest/Event/PCPAddTest.php index 57c88b5599..061017417a 100644 --- a/tests/phpunit/WebTest/Event/PCPAddTest.php +++ b/tests/phpunit/WebTest/Event/PCPAddTest.php @@ -77,8 +77,8 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $conPcp = FALSE; $conIsAprovalNeeded = TRUE; - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; //create contribution page for event pcp with campaign type as contribution $contributionPageId = $this->webtestAddContributionPage($conHash, @@ -490,8 +490,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $this->select2("event_id", $eventName); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $this->clickLink("xpath=//div[@id='participantSearch']/table/tbody/tr[1]/td[@class='crm-participant-sort_name']/a[text()='{$sortName}']/../../td[11]/span/a[text()='View']", "xpath=//table[@class='selector row-highlight']/tbody/tr/td[8]/span/a[text()='View']", FALSE); $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr/td[8]/span/a[text()='View']"); diff --git a/tests/phpunit/WebTest/Event/ParticipantCountTest.php b/tests/phpunit/WebTest/Event/ParticipantCountTest.php index 1d35f1a5ef..edf51c51ad 100644 --- a/tests/phpunit/WebTest/Event/ParticipantCountTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantCountTest.php @@ -39,8 +39,8 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create an event @@ -113,8 +113,8 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create priceset diff --git a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php index 1fcb6878b2..6ad68116ec 100644 --- a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php @@ -88,8 +88,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $crypticName = "foobardoogoo_" . md5(time()); $this->type("sort_name", $crypticName); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $stringsToCheck = array( 'No matches found for', @@ -109,8 +108,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $eventName = "Fall Fundraiser Dinner"; $this->select2("event_id", $eventName); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $stringsToCheck = array( "Event = $eventName", @@ -132,8 +130,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestFillDate('event_start_date_low', '-2 year'); $this->webtestFillDate('event_end_date_high', '+1 year'); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $stringsToCheck = array( "Start Date - greater than or equal to", @@ -160,8 +157,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $eventTypeName = 'Fundraiser'; $this->select2("event_type_id", $eventTypeName); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $stringsToCheck = array( "Start Date - greater than or equal to", @@ -184,8 +180,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->select("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//select", 'Chicken Combo'); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); // note since this is generated data // we are not sure if someone has this selection, so @@ -195,8 +190,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->_checkStrings($stringsToCheck); $this->select("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//select", 'Salmon Stew'); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $stringsToCheck = array("Soup Selection = Salmon Stew"); diff --git a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php index 06945a48bb..9e81951942 100644 --- a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php +++ b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php @@ -39,8 +39,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create priceset @@ -237,8 +237,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create priceset @@ -443,8 +443,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create priceset @@ -735,8 +735,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create priceset diff --git a/tests/phpunit/WebTest/Import/MatchExternalIdTest.php b/tests/phpunit/WebTest/Import/MatchExternalIdTest.php index 9d904e231a..e8a1df5f26 100644 --- a/tests/phpunit/WebTest/Import/MatchExternalIdTest.php +++ b/tests/phpunit/WebTest/Import/MatchExternalIdTest.php @@ -285,8 +285,8 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase { )) { if (empty($params)) { - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create an event diff --git a/tests/phpunit/WebTest/Import/ParticipantTest.php b/tests/phpunit/WebTest/Import/ParticipantTest.php index 8100917e9c..09ee62f1da 100644 --- a/tests/phpunit/WebTest/Import/ParticipantTest.php +++ b/tests/phpunit/WebTest/Import/ParticipantTest.php @@ -255,8 +255,8 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase { if (empty($params)) { - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); // create an event diff --git a/tests/phpunit/WebTest/Member/EditMembershipTest.php b/tests/phpunit/WebTest/Member/EditMembershipTest.php index 03d41e09a8..0e94438a8e 100644 --- a/tests/phpunit/WebTest/Member/EditMembershipTest.php +++ b/tests/phpunit/WebTest/Member/EditMembershipTest.php @@ -93,8 +93,7 @@ class WebTest_Member_EditMembershipTest extends CiviSeleniumTestCase { $this->type("sort_name", $contactName); $this->click('activity_type_id[35]'); $this->click('activity_type_id[36]'); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink("_qf_Search_refresh"); $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[2][text()='Change Membership Status']")); $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr[2]/td[3][text()='Status changed from New to Current']")); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php index 0a4bf01a00..6b20352066 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php @@ -67,8 +67,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->_testVerifyPriceSet($validateStrings, $sid); $contributionPageTitle = "Contribution Page $title"; - $paymentProcessor = "Webtest Dummy $title"; - $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array($paymentProcessor => 'Dummy'), + $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array('Test Processor' => 'Dummy'), TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, $sid, FALSE, 1, NULL ); @@ -141,32 +140,27 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $i = 2; foreach($options as $index => $values){ $this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}"); - // 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->waitForElementPresent("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input"); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input",$values['membership_num_terms']); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input",$values['label']); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input",$values['amount']); if($i > 3){ $this->click('link=another choice'); - } $i++; } $this->waitForElementPresent( 'financial_type_id' ); $this->select("financial_type_id", "label={$contributionType}"); $this->waitForElementPresent('_qf_Field_next-bottom'); - $this->click('_qf_Field_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Field_next-bottom'); $this->waitForText('crm-notification-container', "Price Field '{$fields[0]}' has been saved."); // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); $contributionPageTitle = "Contribution Page $title"; - $paymentProcessor = "Webtest Dummy $title"; - $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array($paymentProcessor => 'Dummy'), + $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array('Test Processor' => 'Dummy'), TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, $sid, FALSE, 1, NULL ); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php index a155793b6a..82cf0e0274 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php @@ -47,8 +47,8 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $hash = substr(sha1(rand()), 0, 7); $rand = 2 * rand(2, 50); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; // create contribution page with randomized title and default params $amountSection = TRUE; @@ -258,8 +258,8 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $hash = substr(sha1(rand()), 0, 7); $rand = 2 * rand(2, 50); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $amountSection = TRUE; $payLater = TRUE; $allowOtherAmmount = TRUE; diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index 8235aee063..61017d891f 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -46,8 +46,8 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=2", "_qf_Amount_next"); @@ -220,8 +220,8 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; $this->webtestAddPaymentProcessor($processorName); $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=2", '_qf_Amount_next'); @@ -414,8 +414,8 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { preg_match('/id=([0-9]+)/', $url, $matches); $membershipTypeId = $matches[1]; - // We need a payment processor - $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); + // Use default payment processor + $processorName = 'Test Processor'; // create contribution page with randomized title and default params $hash = substr(sha1(rand()), 0, 7);