From: Coleman Watts Date: Wed, 6 Mar 2013 19:58:21 +0000 (-0800) Subject: The cut-n-paste code avanger strikes again X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b9715b8a5417dd809ffd828da5d9ad4d01373f3b;p=civicrm-core.git The cut-n-paste code avanger strikes again --- diff --git a/tests/phpunit/WebTest/Campaign/MailingTest.php b/tests/phpunit/WebTest/Campaign/MailingTest.php index 7c971cbeb9..0853ce0c14 100644 --- a/tests/phpunit/WebTest/Campaign/MailingTest.php +++ b/tests/phpunit/WebTest/Campaign/MailingTest.php @@ -33,11 +33,6 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase { } function testCreateCampaign() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Log in as admin first to verify permissions for CiviCampaign $this->webtestLogin(TRUE); diff --git a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php index df9518d210..291f9440d1 100644 --- a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php @@ -78,18 +78,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->waitForPageToLoad($this->getTimeoutMsec()); // Enable CiviCampaign module if necessary - $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviCampaign", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviCampaign"); - $this->click("//option[@value='CiviCampaign']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Changes Saved.")); - } + $this->enableComponents("CiviCampaign"); // now logout and login with admin credentials $this->open($this->sboxPath . "civicrm/logout?reset=1"); diff --git a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php index b00ff2dfc6..5c1761ee74 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php @@ -329,4 +329,4 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { $registerUrl = array('url' => 'contribute/transact', 'args' => "reset=1&id=$id[1]"); return $registerUrl; } -} \ No newline at end of file +} diff --git a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php index e1f9682bd5..7ad4b53615 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php @@ -340,4 +340,4 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase $this->waitForElementPresent("_qf_Participant_cancel-bottom"); $this->assertElementContainsText('crm-container', "$campaignTitle"); } -} \ No newline at end of file +} diff --git a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php index 913abd9bcf..3179967d0e 100644 --- a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php @@ -37,32 +37,10 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { } function testPetitionUsageScenario() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); - // Enable CiviCampaign module if necessary - $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviCampaign", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviCampaign"); - $this->click("//option[@value='CiviCampaign']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Your changes have been saved.")); - } + $this->enableComponents("CiviCampaign"); // handle permissions early diff --git a/tests/phpunit/WebTest/Campaign/PledgeTest.php b/tests/phpunit/WebTest/Campaign/PledgeTest.php index fbfcc1765b..0c4cc3e604 100644 --- a/tests/phpunit/WebTest/Campaign/PledgeTest.php +++ b/tests/phpunit/WebTest/Campaign/PledgeTest.php @@ -42,31 +42,7 @@ class WebTest_Campaign_PledgeTest extends CiviSeleniumTestCase { $this->webtestLogin(TRUE); // Enable CiviCampaign module and CiviPledge module if necessary - $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviCampaign", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviCampaign"); - $this->click("//option[@value='CiviCampaign']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Your changes have been saved.")); - } - - $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviPledge", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviPledge"); - $this->click("//option[@value='CiviPledge']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Your changes have been saved.")); - } + $this->enableComponents(array("CiviCampaign", "CiviPledge")); // add the required Drupal permission $permissions = array( diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index ae0f4b806c..512a2a2b9d 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -39,15 +39,7 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->webtestLogin(); // Enable CiviCase module if necessary - $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions('enableComponents-t'); - if (!in_array('CiviCase', $enabledComponents)) { - $this->addSelection('enableComponents-f', "label=CiviCase"); - $this->click("//option[@value='CiviCase']"); - $this->click('add'); - $this->click('_qf_Component_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviCase"); // let's give full CiviCase permissions to demo user (registered user). $permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase'); diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index ca99ffd2ae..ae3e6f4d66 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -33,22 +33,11 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { } function testStandaloneCaseAdd() { - - $this->open($this->sboxPath); - // Log in as admin first to verify permissions for CiviCase $this->webtestLogin(); // Enable CiviCase module if necessary - $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviCase", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviCase"); - $this->click("//option[@value='CiviCase']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviCase"); // let's give full CiviCase permissions to demo user (registered user). $permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase'); diff --git a/tests/phpunit/WebTest/Case/CaseDashboardTest.php b/tests/phpunit/WebTest/Case/CaseDashboardTest.php index 95af874ea5..bbd5b10645 100644 --- a/tests/phpunit/WebTest/Case/CaseDashboardTest.php +++ b/tests/phpunit/WebTest/Case/CaseDashboardTest.php @@ -40,15 +40,7 @@ class WebTest_Case_CaseDashboardTest extends CiviSeleniumTestCase { $this->webtestLogin(); // Enable CiviCase module if necessary - $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviCase", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviCase"); - $this->click("//option[@value='CiviCase']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviCase"); // let's give full CiviCase permissions to demo user (registered user). $permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase'); diff --git a/tests/phpunit/WebTest/Contact/AddCmsUserTest.php b/tests/phpunit/WebTest/Contact/AddCmsUserTest.php index d396fd0584..ae3c11e972 100644 --- a/tests/phpunit/WebTest/Contact/AddCmsUserTest.php +++ b/tests/phpunit/WebTest/Contact/AddCmsUserTest.php @@ -117,11 +117,11 @@ class WebTest_Contact_AddCmsUserTest extends CiviSeleniumTestCase { $this->click("_qf_Basic_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent($emailId)); - $this->assertTrue($this->isTextPresent($lastName . ', ' . $firstName)); - $this->assertTrue($this->isTextPresent("902C El Camino Way SW")); - $this->assertTrue($this->isTextPresent("Dumfries")); - $this->assertTrue($this->isTextPresent("1234")); + $this->assertElementContainsText('css=.crm-search-results', $emailId); + $this->assertElementContainsText('css=.crm-search-results', $lastName . ', ' . $firstName); + $this->assertElementContainsText('css=.crm-search-results', "902C El Camino Way SW"); + $this->assertElementContainsText('css=.crm-search-results', "Dumfries"); + $this->assertElementContainsText('css=.crm-search-results', "1234"); } } diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index 1402cccd27..6c54ef3772 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -792,18 +792,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $fieldId = $url[1]; // Enable CiviCampaign module if necessary - $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions('enableComponents-t'); - if (!in_array("CiviCampaign", $enabledComponents)) { - $this->addSelection('enableComponents-f', "label=CiviCampaign"); - $this->click("//option[@value='CiviCampaign']"); - $this->click('add'); - $this->click('_qf_Component_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent('Your changes have been saved.')); - } + $this->enableComponents("CiviCampaign"); // add the required Drupal permission $permission = array('edit-2-administer-civicampaign'); @@ -1072,18 +1061,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $fieldId = $url[1]; // Enable CiviCampaign module if necessary - $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions('enableComponents-t'); - if (!in_array("CiviCampaign", $enabledComponents)) { - $this->addSelection('enableComponents-f', "label=CiviCampaign"); - $this->click("//option[@value='CiviCampaign']"); - $this->click('add'); - $this->click('_qf_Component_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent('Your changes have been saved.')); - } + $this->enableComponents("CiviCampaign"); // add the required Drupal permission $permission = array('edit-2-administer-civicampaign'); diff --git a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php index 3dd39b2ba2..6dca528bfb 100644 --- a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php +++ b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php @@ -108,15 +108,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { function testContributionDashboard() { $this->login(); // Enable CiviContribute module if necessary - $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviContribute", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviContribute"); - $this->click("//option[@value='CiviContribute']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviContribute"); // Contributions → Dashboard $this->click("css=ul#civicrm-menu li.crm-Contributions"); @@ -133,15 +125,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->login(); // Enable CiviEvent module if necessary - $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviEvent", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviEvent"); - $this->click("//option[@value='CiviEvent']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviEvent"); // Events → Dashboard $this->click("css=ul#civicrm-menu li.crm-Events"); @@ -166,15 +150,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->login(); // Enable CiviMember module if necessary - $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviMember", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviMember"); - $this->click("//option[@value='CiviMember']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviMember"); // Memberships → Dashboard $this->click("css=ul#civicrm-menu li.crm-Memberships"); @@ -191,15 +167,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->login(); // Enable CiviContribute module if necessary - $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviContribute", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviContribute"); - $this->click("//option[@value='CiviContribute']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviContribute"); // Search → Find Contributions // Use class names for menu items since li array can change based on which components are enabled @@ -225,15 +193,7 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->login(); // Enable CiviMail module if necessary - $this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviMail", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviMail"); - $this->click("//option[@value='CiviMail']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } + $this->enableComponents("CiviMail"); // configure default mail-box $this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", "_qf_MailSettings_cancel-bottom"); diff --git a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php index 4e1d16ba54..1766ccf7ba 100644 --- a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php @@ -33,28 +33,11 @@ class WebTest_Grant_ContactContextAddTest extends CiviSeleniumTestCase { } function testContactContextAddTest() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Log in as admin first to verify permissions for CiviGrant $this->webtestLogin(TRUE); // Enable CiviGrant module if necessary - $this->open($this->sboxPath . 'civicrm/admin/setting/component?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions('enableComponents-t'); - if (!in_array('CiviGrant', $enabledComponents)) { - $this->addSelection('enableComponents-f', 'label=CiviGrant'); - $this->click("//option[@value='CiviGrant']"); - $this->click('add'); - $this->click('_qf_Component_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('css=div.success'); - $this->assertTrue($this->isTextPresent('Changes Saved.')); - } + $this->enableComponents("CiviGrant"); // let's give full CiviGrant permissions to demo user (registered user). $permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant'); diff --git a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php index 10f7ba52b3..9bbbc21e7d 100644 --- a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php +++ b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php @@ -33,27 +33,11 @@ class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase { } function testCustomFieldsetTest() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Log in as admin first to verify permissions for CiviGrant $this->webtestLogin(TRUE); // Enable CiviGrant module if necessary - $this->open($this->sboxPath . 'civicrm/admin/setting/component?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions('enableComponents-t'); - if (!in_array('CiviGrant', $enabledComponents)) { - $this->addSelection('enableComponents-f', 'label=CiviGrant'); - $this->click("//option[@value='CiviGrant']"); - $this->click('add'); - $this->click('_qf_Component_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertElementContainsText("css=#crm-notification-container", 'Changes Saved', 'CiviCRM Message does not indicate the enabled component changes were saved'); - } + $this->enableComponents("CiviGrant"); // let's give full CiviGrant permissions to demo user (registered user). $permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant'); diff --git a/tests/phpunit/WebTest/Grant/StandaloneAddTest.php b/tests/phpunit/WebTest/Grant/StandaloneAddTest.php index ade401dd1d..eee48803f3 100644 --- a/tests/phpunit/WebTest/Grant/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Grant/StandaloneAddTest.php @@ -37,27 +37,11 @@ class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase { } function testStandaloneGrantAdd() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Log in as admin first to verify permissions for CiviGrant $this->webtestLogin(TRUE); // Enable CiviGrant module if necessary - $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Component_next-bottom"); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviGrant", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviGrant"); - $this->click("//option[@value='CiviGrant']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue($this->isTextPresent("Your changes have been saved.")); - } + $this->enableComponents("CiviGrant"); // let's give full CiviGrant permissions to demo user (registered user). $permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant'); diff --git a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php index 71b5505dfb..6cb490d9d8 100644 --- a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php +++ b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php @@ -354,16 +354,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { //campaign test for interview //enable CiviCampaign module if necessary - $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviCampaign", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviCampaign"); - $this->click("//option[@value='CiviCampaign']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertElementContainsText('crm-notification-container', 'Changes Saved'); - } + $this->enableComponents("CiviCampaign"); //Adding a survey $this->openCiviPage('survey/add', 'reset=1', '_qf_Main_upload-bottom'); @@ -758,4 +749,4 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { return $returnArray; } -} \ No newline at end of file +} diff --git a/tests/phpunit/WebTest/Report/LoggingReportTest.php b/tests/phpunit/WebTest/Report/LoggingReportTest.php index a505ff02d0..4e736a347f 100644 --- a/tests/phpunit/WebTest/Report/LoggingReportTest.php +++ b/tests/phpunit/WebTest/Report/LoggingReportTest.php @@ -33,16 +33,6 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { } function testLoggingReport() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); //enable the logging @@ -52,16 +42,8 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->waitForTextPresent("Changes Saved"); //enable CiviCase component - $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom'); - $enabledComponents = $this->getSelectOptions("enableComponents-t"); - if (!in_array("CiviCase", $enabledComponents)) { - $this->addSelection("enableComponents-f", "label=CiviCase"); - $this->click("//option[@value='CiviCase']"); - $this->click("add"); - $this->click("_qf_Component_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertElementContainsText('crm-notification-container', "Changes Saved"); - } + $this->enableComponents("CiviCase"); + //add new contact $orginalFirstName = $firstName = 'Anthony' . substr(sha1(rand()), 0, 7); $lastName = 'Anderson' . substr(sha1(rand()), 0, 7); @@ -330,4 +312,4 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); } } -} \ No newline at end of file +}