protected function ContributionPayLaterTest::submitWebform in Webform CiviCRM Integration 8.5
Submit the form
Parameters
string $amountType:
1 call to ContributionPayLaterTest::submitWebform()
- ContributionPayLaterTest::testSubmitContribution in tests/
src/ FunctionalJavascript/ ContributionPayLaterTest.php
File
- tests/
src/ FunctionalJavascript/ ContributionPayLaterTest.php, line 70
Class
- ContributionPayLaterTest
- Tests submitting a Webform with CiviCRM: Contribution with Pay later
Namespace
Drupal\Tests\webform_civicrm\FunctionalJavascriptCode
protected function submitWebform($amountType) {
$this
->drupalGet($this->webform
->toUrl('canonical'));
$this
->assertPageNoErrorMessages();
$this
->getSession()
->getPage()
->fillField('First Name', 'Frederick');
$this
->getSession()
->getPage()
->fillField('Last Name', 'Pabst');
$this
->getSession()
->getPage()
->fillField('Email', 'fred@example.com');
$this
->getSession()
->getPage()
->selectFieldOption("Country", 'United Kingdom');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->getSession()
->getPage()
->selectFieldOption('State/Province', 'Newport');
$this
->getSession()
->getPage()
->pressButton('Next >');
$this
->assertSession()
->waitForField('civicrm_1_contribution_1_contribution_total_amount');
$this
->assertPageNoErrorMessages();
if ($amountType == 'radios') {
$this
->getSession()
->getPage()
->selectFieldOption("civicrm_1_contribution_1_contribution_total_amount", 30);
}
elseif ($amountType == 'webform_radios_other') {
$this
->getSession()
->getPage()
->selectFieldOption("civicrm_1_contribution_1_contribution_total_amount[radios]", '_other_');
$this
->assertSession()
->waitForField('civicrm_1_contribution_1_contribution_total_amount[other]');
$this
->getSession()
->getPage()
->fillField('civicrm_1_contribution_1_contribution_total_amount[other]', '30');
}
else {
$this
->getSession()
->getPage()
->checkField('10');
$this
->getSession()
->getPage()
->checkField('20');
}
$this
->assertSession()
->elementExists('css', '#wf-crm-billing-items');
$this
->htmlOutput();
$this
->assertSession()
->elementTextContains('css', '#wf-crm-billing-total', '30.00');
$this
->getSession()
->getPage()
->fillField('Donation Custom Field', 'Donation for xyz');
$this
->getSession()
->getPage()
->pressButton('Submit');
$this
->assertPageNoErrorMessages();
$this
->assertSession()
->pageTextContains('New submission added to CiviCRM Webform Test.');
}