public function AttachmentTest::testSubmitWebform in Webform CiviCRM Integration 8.5
Check if all files are loaded on the webform.
File
- tests/
src/ FunctionalJavascript/ AttachmentTest.php, line 85
Class
- AttachmentTest
- Tests submitting a Webform with CiviCRM: Contact with File.
Namespace
Drupal\Tests\webform_civicrm\FunctionalJavascriptCode
public function testSubmitWebform() {
$this
->drupalLogin($this->rootUser);
$this
->drupalGet(Url::fromRoute('entity.webform.civicrm', [
'webform' => $this->webform
->id(),
]));
$this
->enableCivicrmOnWebform();
$this
->getSession()
->getPage()
->selectFieldOption("contact_1_number_of_cg{$this->_cg['id']}", 'Yes');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->htmlOutput();
// Enable custom fields.
foreach ($this->_cf as $cfName => $cf) {
$this
->getSession()
->getPage()
->checkField($cfName);
$this
->assertSession()
->checkboxChecked($cfName);
}
$this
->saveCiviCRMSettings();
$this
->drupalGet($this->webform
->toUrl('canonical'));
$this
->htmlOutput();
$this
->assertPageNoErrorMessages();
$this
->assertSession()
->pageTextContains($this->fileParams['File1']['name']);
$this
->assertSession()
->pageTextContains($this->fileParams['File2']['name']);
$this
->assertSession()
->pageTextContains($this->fileParams['File3']['name']);
$this
->getSession()
->getPage()
->pressButton('Submit');
$this
->assertPageNoErrorMessages();
$this
->assertSession()
->pageTextContains('New submission added to CiviCRM Webform Test.');
}