EmailedExportUiTest.php in Webform Scheduled Tasks 8.2
File
tests/src/FunctionalJavascript/EmailedExportUiTest.php
View source
<?php
namespace Drupal\Tests\webform_scheduled_tasks\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\webform_scheduled_tasks\Entity\WebformScheduledTask;
class EmailedExportUiTest extends WebDriverTestBase {
protected $defaultTheme = 'stark';
public static $modules = [
'block',
'webform_scheduled_tasks',
];
protected function setUp() {
parent::setUp();
$this
->drupalPlaceBlock('local_actions_block');
$this
->drupalLogin($this
->drupalCreateUser([
'administer webform',
]));
}
public function testExportUi() {
WebformScheduledTask::create([
'id' => 'foo',
'result_set_type' => 'all_submissions',
'task_type' => 'export_email_results',
'webform' => 'contact',
])
->save();
$this
->drupalGet('admin/structure/webform/manage/contact/scheduled-tasks/foo/edit');
$this
->assertSession()
->fieldValueEquals('task_settings[exporter]', 'delimited');
$this
->assertSession()
->pageTextContains('Delimiter text format');
$this
->getSession()
->getPage()
->fillField('task_settings[exporter]', 'table');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->assertSession()
->fieldValueEquals('task_settings[exporter]', 'table');
$this
->assertSession()
->pageTextContains('Open HTML table in Excel');
$this
->getSession()
->getPage()
->fillField('task_settings[storage_type]', 'filesystem');
$this
->assertSession()
->pageTextNotContains('Sending email file attachments requires webform to have already been configured for attachments');
$this
->getSession()
->getPage()
->fillField('task_settings[storage_type]', 'email');
$this
->assertSession()
->pageTextContains('Sending email file attachments requires webform to have already been configured for attachments');
}
}