From 701f18c088b94e90cf59c7d4a7bc62fc8a413dac Mon Sep 17 00:00:00 2001 From: Atif Shaikh Date: Wed, 23 Apr 2014 20:23:08 +0530 Subject: [PATCH] Webtest Fix related to testCreateCampaign --- .../Campaign/OfflineEventRegistrationTest.php | 25 +++++++++++-------- .../Campaign/OnlineContributionTest.php | 10 ++++---- .../Campaign/OnlineEventRegistrationTest.php | 11 +++----- tests/phpunit/WebTest/Campaign/PledgeTest.php | 25 +++++-------------- 4 files changed, 29 insertions(+), 42 deletions(-) diff --git a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php index 223af2806f..aa35659302 100644 --- a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php @@ -51,7 +51,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); $firstName2 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName2, "John", "$firstName2.john@example.org"); @@ -64,7 +64,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); // Enable CiviCampaign module if necessary $this->enableComponents("CiviCampaign"); @@ -123,10 +123,12 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $eventId = $this->registerUrl(); $this->openCiviPage('event/manage/settings', "reset=1&action=update&id=$eventId", "_qf_EventInfo_cancel-bottom"); - + $this->waitForElementPresent('title'); + $eventName = $this->getAttribute("//*[@id='title']@value"); // select campaign $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()); @@ -140,10 +142,10 @@ 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); + $this->webtestFillAutocomplete($firstName, 'contact_id'); // Select event. Based on label for now. - $this->select("event_id", "value=$eventId"); + $this->select2("event_id", $eventName); // Select role $this->click("role_id[2]"); @@ -165,7 +167,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase // Select an event fee $this->waitForElementPresent('priceset'); - $this->click("xpath=//div[@id='priceset']//input[1][@class='form-radio']"); + $this->click("xpath=//*[@id='priceset']//input[1][@class='crm-form-radio']"); // Select 'Record Payment' $this->click("record_contribution"); @@ -179,7 +181,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->type("check_number", "1044"); // go for the chicken combo (obviously) - // $this->click("CIVICRM_QFID_chicken_Chicken"); + // $this->click("CIVICRM_QFID_chicken_Chicken"); // Clicking save. $this->click("_qf_Participant_upload-bottom"); @@ -188,9 +190,9 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase // Is status message correct? $this->assertTrue($this->isTextPresent("Event registration for $displayName has been added"), "Status message didn't show up after saving!"); - $this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the participant view screen - $this->click("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//*[@id='Search']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent("_qf_ParticipantView_cancel-bottom"); // verify participant record @@ -208,7 +210,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->type('sort_name', $firstName); $this->click("_qf_Search_refresh"); - $this->waitForElementPresent("_qf_Search_next_print"); + $this->waitForElementPresent("xpath=//div[@id='participantSearch']"); $this->click("xpath=//div[@id='participantSearch']/table/tbody/tr/td[11]/span/a[text()='Edit']"); $this->waitForElementPresent("_qf_Participant_cancel-bottom"); $this->assertTrue($this->isTextPresent("$campaignTitle")); @@ -216,8 +218,9 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase function registerUrl() { $this->openCiviPage("event/manage", "reset=1"); - $eventId = explode('_', $this->getAttribute("//div[@id='event_status_id']//table/tbody/tr@id")); + $eventId = explode('-', $this->getAttribute("//div[@id='event_status_id']//div[2]/table/tbody/tr@id")); return $eventId[1]; } + } diff --git a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php index bab00a436a..fda0add2fa 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php @@ -51,7 +51,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); $firstName2 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName2, "John", "$firstName2.john@example.org"); @@ -64,7 +64,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); // Enable CiviCampaign module if necessary $this->enableComponents(array('CiviCampaign')); @@ -148,7 +148,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { $this->type("value_1", "100"); $this->type("label_2", "amount 2"); $this->type("value_2", "200"); - $this->click("CIVICRM_QFID_1_2"); + $this->click("xpath=//*[@id='map-field-table']//tr[2]//input[1][@name='default']"); $this->click("_qf_Amount_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -189,7 +189,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Custom_next-bottom"); // fill in step 6 (Include Profiles) - $this->select('custom_pre_id', 'value=1'); + $this->select('css=tr.crm-contribution-contributionpage-custom-form-block-custom_pre_id span.crm-profile-selector-select select', 'value=1'); $this->click('_qf_Custom_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -293,7 +293,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { $this->type("sort_name", "$firstName $lastName"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); //View Contribution Record $this->verifyText("xpath=id('ContributionView')/div[2]/table[1]/tbody/tr[10]/td[2]", preg_quote($campaignTitle)); diff --git a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php index 4bf2a7b47c..49038e71f9 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php @@ -51,7 +51,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); $firstName2 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName2, "John", "$firstName2.john@example.org"); @@ -64,7 +64,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); // Enable CiviCampaign module if necessary $this->enableComponents(array('CiviCampaign')); @@ -174,7 +174,6 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase function _testAddLocation($streetAddress) { // Wait for Location tab form to load - $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForElementPresent("_qf_Location_upload-bottom"); // Fill in address fields @@ -185,7 +184,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase $this->select("address_1_state_province_id", "value=1004"); $this->type("email_1_email", "info@civicrm.org"); - $this->clickLink("_qf_Location_upload-bottom"); + $this->clickLink("_qf_Location_upload-bottom", '', FALSE); // Wait for "saved" status msg $this->waitForText('crm-notification-container', "saved"); @@ -217,7 +216,6 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase $this->click("_qf_Fee_upload-bottom"); // Wait for "saved" status msg - $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForText('crm-notification-container', "saved"); } @@ -241,7 +239,6 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase $this->type("confirm_from_email", "jane.doe@example.org"); $this->click("_qf_Registration_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForText('crm-notification-container', "saved"); } @@ -318,7 +315,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase $this->type('sort_name', $email); $this->click("_qf_Search_refresh"); - $this->waitForElementPresent("_qf_Search_next_print"); + $this->waitForElementPresent("//*[@id='participantSearch']"); $this->click("xpath=//div[@id='participantSearch']/table/tbody/tr/td[11]/span/a[text()='Edit']"); $this->waitForElementPresent("_qf_Participant_cancel-bottom"); $this->assertElementContainsText('crm-container', "$campaignTitle"); diff --git a/tests/phpunit/WebTest/Campaign/PledgeTest.php b/tests/phpunit/WebTest/Campaign/PledgeTest.php index 9959922f49..9770701b6b 100644 --- a/tests/phpunit/WebTest/Campaign/PledgeTest.php +++ b/tests/phpunit/WebTest/Campaign/PledgeTest.php @@ -65,7 +65,7 @@ class WebTest_Campaign_PledgeTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); $firstName2 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName2, "John", "$firstName2.john@example.org"); @@ -78,7 +78,7 @@ class WebTest_Campaign_PledgeTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Remove'); $this->openCiviPage("campaign/add", "reset=1", "_qf_Campaign_upload-bottom"); @@ -154,19 +154,6 @@ class WebTest_Campaign_PledgeTest extends CiviSeleniumTestCase { $this->select("contribution_page_id", "value=3"); - //Honoree section - $this->click("Honoree"); - $this->waitForElementPresent("honor_email"); - - $this->click("CIVICRM_QFID_1_2"); - $this->select("honor_prefix_id", "value=3"); - - $honreeFirstName = 'First' . substr(sha1(rand()), 0, 4); - $honreeLastName = 'last' . substr(sha1(rand()), 0, 7); - $this->type("honor_first_name", $honreeFirstName); - $this->type("honor_last_name", $honreeLastName); - $this->type("honor_email", $honreeFirstName . "@example.com"); - //PaymentReminders $this->click("PaymentReminders"); $this->waitForElementPresent("additional_reminder_day"); @@ -175,13 +162,13 @@ class WebTest_Campaign_PledgeTest extends CiviSeleniumTestCase { $this->type("additional_reminder_day", "4"); $this->click("_qf_Pledge_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent('link=Add Pledge'); - $this->assertTrue($this->isTextPresent("Pledge has been recorded and the payment schedule has been created.")); + $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']"); //click through to the Pledge view screen - $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']"); + $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']"); $this->waitForElementPresent("_qf_PledgeView_next-bottom"); $pledgeDate = date('F jS, Y', strtotime('now')); -- 2.25.1