Skip to content
Snippets Groups Projects
Commit 58ae076c authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

Merge pull request #1429 from kurund/webtest-fixes

Webtest fixes
parents e5e4f756 461d123d
Branches
Tags
No related merge requests found
......@@ -147,15 +147,24 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
'Contribution Status' => 'Completed',
'Paid By' => 'Check',
'Check Number' => 'check #1041',
'Soft Credit To' => "{$softCreditFname} {$softCreditLname}",
);
foreach ($expected as $label => $value) {
$this->verifyText("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='$label']/../td[2]", preg_quote($value));
}
// go to soft creditor contact view page
$this->click("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='Soft Credit To']/../td[2]/a[text()='{$softCreditFname} {$softCreditLname}']");
// verify if soft credit was created successfully
$expected = array(
'Soft Credit To' => "{$softCreditFname} {$softCreditLname}",
'Amount' => '100.00',
);
foreach ($expected as $value) {
$this->verifyText("css=table.crm-soft-credit-listing", preg_quote($value));
}
// go to first soft creditor contact view page
$this->click("css=table.crm-soft-credit-listing tbody tr td a");
// go to contribution tab
$this->waitForElementPresent("css=li#tab_contribute a");
......
......@@ -66,12 +66,12 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$numberRegistrations = 3;
$anonymous = TRUE;
$this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous);
// Now test making a copy of the event
$this->webtestLogin();
$this->openCiviPage("event/manage", "reset=1&action=copy&id=$eventId");
$copyEventId = $this->_testVerifyEventInfo('Copy of ' . $eventTitle, $eventInfoStrings);
$registerUrl = $this->_testVerifyRegisterPage($registerStrings);
$this->_testVerifyEventInfo('Copy of ' . $eventTitle, $eventInfoStrings);
$this->_testVerifyRegisterPage($registerStrings);
}
function testAddPaidEventDiscount() {
......@@ -292,7 +292,6 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
}
function testUnpaidPaid() {
// Log in using webtestLogin() method
$this->webtestLogin();
......@@ -417,7 +416,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
if ($payLater) {
$this->check('is_pay_later');
$this->type('pay_later_receipt', 'testing later instructions');
$this->fillRichTextField('pay_later_receipt', 'testing later instructions');
}
else {
$this->uncheck('is_pay_later');
......@@ -447,8 +446,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$this->webtestFillDate("discount_end_date_1", "-2 week");
$this->clickLink("_qf_Fee_submit", "discounted_value_1_1");
$this->type("discounted_value_1_1","225.00");
$this->type("discounted_value_2_1","300.00");
$this->type("discounted_value_1_1", "225.00");
$this->type("discounted_value_2_1", "300.00");
if ($double) {
$discount2 = "Early-bird" . substr(sha1(rand()), 0, 7);
......@@ -459,9 +458,9 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$this->webtestFillDate("discount_start_date_2", "-1 week");
$this->webtestFillDate("discount_end_date_2", "+1 week");
$this->clickLink("_qf_Fee_submit", "discounted_value_2_1");
$this->type("discounted_value_1_2","225.00");
$this->type("discounted_value_2_2","300.00");
}
$this->type("discounted_value_1_2", "225.00");
$this->type("discounted_value_2_2", "300.00");
}
$this->click("xpath=//fieldset[@id='discount']/fieldset/table/tbody/tr[2]/td[3]/input");
}
$this->click("_qf_Fee_upload-bottom");
......@@ -539,21 +538,31 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$this->select("additional_participants", "value=" . $numberRegistrations);
$email = $infoPassed ? $participantEmailInfo[0] : "smith" . substr(sha1(rand()), 0, 7) . "@example.org";
$primaryParticipantInfo['email'] = $email;
$this->type("email-Primary", $email);
if ($infoPassed) {
$primaryParticipantInfo['first_name'] = $participantEmailInfo[0]['first_name'];
$primaryParticipantInfo['last_name'] = $participantEmailInfo[0]['last_name'];
$primaryParticipantInfo['email'] = $participantEmailInfo[0]['email'];
}
else {
$primaryParticipantInfo['first_name'] = "Jane";
$primaryParticipantInfo['last_name'] = "Smith" . substr(sha1(rand()), 0, 7);
$primaryParticipantInfo['email'] = "smith" . substr(sha1(rand()), 0, 7) . "@example.org";
}
$this->type("first_name", $primaryParticipantInfo['first_name']);
$this->type("last_name", $primaryParticipantInfo['last_name']);
$this->type("email-Primary", $primaryParticipantInfo['email']);
if (!$isPayLater) {
if ($paymentProcessor) {
$paymentProcessorEle = $this->getAttribute("xpath=//form[@id='Register']//label[contains(text(), '{$paymentProcessor}')]/@for");
$this->check($paymentProcessorEle);
$paymentProcessorEle = $this->getAttribute("xpath=//form[@id='Register']//label[contains(text(), '{$paymentProcessor}')]/@for");
$this->check($paymentProcessorEle);
}
$this->select("credit_card_type", "value=Visa");
$this->type("credit_card_number", "4111111111111111");
$this->type("cvv2", "000");
$this->select("credit_card_exp_date[M]", "value=1");
$this->select("credit_card_exp_date[Y]", "value=2020");
$primaryParticipantInfo['first_name'] = "Jane";
$primaryParticipantInfo['last_name'] = "Smith" . substr(sha1(rand()), 0, 7);
$this->type("billing_first_name", $primaryParticipantInfo['first_name']);
$this->type("billing_last_name", $primaryParticipantInfo['last_name']);
$this->type("billing_street_address-5", "15 Main St.");
......@@ -570,23 +579,33 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$this->waitForPageToLoad($this->getTimeoutMsec());
// Look for Skip button
$this->waitForElementPresent("_qf_Participant_{$i}_next_skip-Array");
$addtlEmail = $infoPassed ? $participantEmailInfo[$i] : "smith" . substr(sha1(rand()), 0, 7) . "@example.org";
$this->type("email-Primary", $addtlEmail);
if ($infoPassed) {
$this->type("first_name", $participantEmailInfo[$i]['first_name']);
$this->type("last_name", $participantEmailInfo[$i]['last_name']);
$this->type("email-Primary", $participantEmailInfo[$i]['email']);
}
else {
$this->type("first_name", "Jane Add $i");
$this->type("last_name", "Smith" . substr(sha1(rand()), 0, 7));
$this->type("email-Primary", "smith" . substr(sha1(rand()), 0, 7) . "@example.org");
}
$this->click("_qf_Participant_{$i}_next");
}
}
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Confirm_next-bottom");
$confirmStrings = array("Event Fee(s)");
if (!$isPayLater) {
$confirmStrings += array("Billing Name and Address", "Credit Card Information");
$confirmStrings = array("Event Fee(s)");
if (!$isPayLater) {
$confirmStrings += array("Billing Name and Address", "Credit Card Information");
}
$this->assertStringsPresent($confirmStrings);
$this->click("_qf_Confirm_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
$thankStrings = array("Thank You for Registering", "Event Total");
if (!$isPayLater) {
$thankStrings = array("Thank You for Registering", "Event Total");
if (!$isPayLater) {
$thankStrings = array("Transaction Date");
}
else {
......@@ -662,12 +681,26 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$anonymous = TRUE;
// CRM-12615 add additional participants and check email, amount
$primaryParticipant = "smith" . substr(sha1(rand()), 0, 7) . "@example.org";
$secParticipant = "smith" . substr(sha1(rand()), 0, 7) . "@example.org";
$thirdParticipant = "smith" . substr(sha1(rand()), 0, 7) . "@example.org";
$primaryParticipant = array(
'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org",
'first_name' => "Kate",
'last_name' => "Simth" . substr(sha1(rand()), 0, 7),
);
$secParticipant = array(
'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org",
'first_name' => "Kate Add 1",
'last_name' => "Simth" . substr(sha1(rand()), 0, 7),
);
$thirdParticipant = array(
'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org",
'first_name' => "Kate Add 2",
'last_name' => "Simth" . substr(sha1(rand()), 0, 7),
);
$participantEmails = array($primaryParticipant, $secParticipant, $thirdParticipant);
$addtlPart = array($secParticipant, $thirdParticipant);
$primaryParticipantInfo = $this->_testOnlineRegistration($registerUrl, 2, $anonymous, FALSE, $participantEmails, "Test Processor");
$primaryParticipantInfo =
$this->_testOnlineRegistration($registerUrl, 2, $anonymous, FALSE, $participantEmails, "Test Processor");
$primaryDisplayName = "{$primaryParticipantInfo['first_name']} {$primaryParticipantInfo['last_name']}";
$this->webtestLogin();
$this->openCiviPage("event/search?reset=1", "reset=1");
......@@ -676,18 +709,28 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$this->waitForElementPresent("css=div.ac_results-inner li");
$this->click("css=div.ac_results-inner li");
$this->clickLink('_qf_Search_refresh');
$this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(), '{$secParticipant}')]/../../td[6]", preg_quote('225.00'));
$this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(), '{$thirdParticipant}')]/../../td[6]", preg_quote('225.00'));
$this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(),
'{$secParticipant['last_name']}, {$secParticipant['first_name']}')]/../../td[6]", preg_quote('225.00'));
$this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(),
'{$thirdParticipant['last_name']}, {$thirdParticipant['first_name']}')]/../../td[6]", preg_quote('225.00'));
//CRM-12618 check edit screen of additional participant and ensuring record_contribution not present
foreach ($addtlPart as $value) {
$this->clickLink("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(), '{$value}')]/../../td[11]/span/a[2][contains(text(), 'Edit')]", '_qf_Participant_upload-bottom');
$this->assertTrue($this->isElementPresent("xpath=//tr[@class='crm-participant-form-block-registered-by']/td[2]/a[contains(text(), '$primaryDisplayName')]"), 'Registered By info is wrong on additional participant edit form');
$this->clickLink("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(),
'{$value['last_name']}, {$value['first_name']}')]/../../td[11]/span/a[2][contains(text(), 'Edit')]",
'_qf_Participant_upload-bottom');
$this->assertTrue(
$this->isElementPresent("xpath=//tr[@class='crm-participant-form-block-registered-by']/td[2]/a[contains(text(),
'$primaryDisplayName')]"), 'Registered By info is wrong on additional participant edit form');
$this->assertElementContainsText("xpath=//form[@id='Participant']/h3", 'Edit Event Registration');
$this->assertTrue($this->isElementPresent("xpath=//table/tbody/tr[@class='crm-participant-form-block-displayName']/td[2][contains(text(), '{$value}')]"),
$this->assertTrue(
$this->isElementPresent(
"xpath=//table/tbody/tr[@class='crm-participant-form-block-displayName']/td[2][contains(text(),
'{$value['first_name']} {$value['last_name']}')]"),
'Wrong Participant edit form'
);
$this->assertFalse($this->isElementPresent('record_contribution'), 'Record Payment checkbox showed up wrongly for additional participant edit screen');
$this->assertFalse($this->isElementPresent('record_contribution'),
'Record Payment checkbox showed up wrongly for additional participant edit screen');
$this->clickLink("_qf_Participant_cancel-top");
}
......@@ -718,12 +761,13 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
$this->click('_qf_Participant_upload-top');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->verifyFinancialRecords($contributionID);
// add participant and 3 additional participant and change status of participant from edit contribution
$this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous, TRUE);
$this->webtestLogin();
$this->webtestLogin();
$this->openCiviPage("event/search?reset=1", "reset=1"); $this->type('event_name', $eventTitle);
$this->openCiviPage("event/search?reset=1", "reset=1");
$this->type('event_name', $eventTitle);
$this->click("event_name");
$this->waitForElementPresent("css=div.ac_results-inner li");
$this->click("css=div.ac_results-inner li");
......@@ -752,7 +796,7 @@ WHERE c1.entity_table = 'civicrm_contribution' AND c1.entity_id = %1 AND cfi.st
$dao = CRM_Core_DAO::executeQuery($query, $params);
$dao->fetch();
$this->assertEquals('2', $dao->civicrm_contribution, 'civicrm_financial_trxn count does not match');
$this->assertEquals('8',$dao->civicrm_financial_item, 'civicrm_financial_item count does not match');
$this->assertEquals('8', $dao->civicrm_financial_item, 'civicrm_financial_item count does not match');
$query = "SELECT COUNT(cft.id) civicrm_financial_trxn FROM civicrm_entity_financial_trxn ceft
INNER JOIN civicrm_financial_trxn cft ON ceft.financial_trxn_id = cft.id
WHERE ceft.entity_id = %1 AND ceft.entity_table = 'civicrm_contribution'";
......
......@@ -284,6 +284,9 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
$this->type("xpath=//input[@class='form-text four required']", "1");
$this->click("xpath=//input[@class='form-radio']");
$this->click("xpath=//input[@class='form-checkbox']");
$this->type("first_name", "Jane");
$lastName = "Smith" . substr(sha1(rand()), 0, 7);
$this->type("last_name", $lastName);
$this->type('email-Primary', $email);
$this->waitForElementPresent('credit_card_type');
......@@ -293,7 +296,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
$this->select('credit_card_exp_date[M]', 'value=1');
$this->select('credit_card_exp_date[Y]', 'value=2020');
$this->type('billing_first_name', 'Jane');
$this->type('billing_last_name', 'San');
$this->type('billing_last_name', $lastName);
$this->type('billing_street_address-5', '15 Main St.');
$this->type(' billing_city-5', 'San Jose');
$this->select('billing_country_id-5', 'value=1228');
......@@ -704,7 +707,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
$this->chooseOkOnNextConfirmation();
$this->waitForPageToLoad($this->getTimeoutMsec());
//assert the message
$this->waitForText('price_set_used_by', "it is currently in use by one or more active events or contribution pages or contributions or event templates. If you no longer want to use this price set, click the event template title below, and modify the fees for that event.");
$this->waitForText('price_set_used_by',
"it is currently in use by one or more active events or contribution pages or contributions or event templates.");
//check the delete for priceset
$this->openCiviPage("admin/price", "reset=1");
......@@ -716,14 +720,13 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
$this->chooseOkOnNextConfirmation();
$this->waitForPageToLoad($this->getTimeoutMsec());
//assert the message
$this->waitForText('price_set_used_by', "it is currently in use by one or more active events or contribution pages or contributions or event templates. If you no longer want to use this price set, click the event template title below, and modify the fees for that event. ");
$this->waitForText('price_set_used_by',
"it is currently in use by one or more active events or contribution pages or contributions or event templates.");
}
function _checkLineItems($expectedLineItems) {
foreach ($expectedLineItems as $lineKey => $lineValue) {
foreach ($lineValue as $key => $value) {
$this->verifyText("xpath=//table/tbody/tr/td[text()='Event Fees']/following-sibling::td/table/tbody/tr[$lineKey]/td[$key]", preg_quote($value));
}
}
......
......@@ -33,27 +33,27 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase {
//go to manage event and check for presence of ongoing and
//upcomming events
$this->openCiviPage("event/manage", "reset=1");
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle1);
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $eventTitle1);
$this->click("_qf_SearchEvent_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertFalse($this->isTextPresent("{$eventTitle1}"));
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle2);
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $eventTitle2);
$this->click("_qf_SearchEvent_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertFalse($this->isTextPresent("{$eventTitle2}"));
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle3);
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $eventTitle3);
$this->click("_qf_SearchEvent_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForText("SearchEvent", "{$eventTitle3}");
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle4);
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $eventTitle4);
$this->click("_qf_SearchEvent_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForText("SearchEvent", "{$eventTitle4}");
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$eventTitle5);
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $eventTitle5);
$this->click("_qf_SearchEvent_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForText("SearchEvent", "{$eventTitle5}");
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input","");
$this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", "");
//check if closed Event is present
$this->waitForElementPresent('CIVICRM_QFID_1_eventsByDates');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment