public function SwaggerUiFieldFormatterTest::testLinkFormatter in Swagger UI Field Formatter 8.3
Tests the link field formatter.
File
- tests/
src/ FunctionalJavascript/ SwaggerUiFieldFormatterTest.php, line 82
Class
- SwaggerUiFieldFormatterTest
- Tests file and link field formatters.
Namespace
Drupal\Tests\swagger_ui_formatter\FunctionalJavascriptCode
public function testLinkFormatter() : void {
$page = $this
->getSession()
->getPage();
$assert = $this
->assertSession();
$this
->drupalLogin($this->rootUser);
$this
->drupalGet(Url::fromRoute('node.add', [
'node_type' => 'remote_api_doc',
]));
$page
->fillField('field_remote_api_spec[0][uri]', file_create_url('public://petstore-expanded.yaml'));
$page
->pressButton('field_remote_api_spec_add_more');
$assert
->waitForField('field_remote_api_spec[1][uri]');
$page
->fillField('field_remote_api_spec[1][uri]', file_create_url('public://uspto.yaml'));
$this
->drupalPostForm(NULL, [
'title[0][value]' => 'Testing the link field formatter',
], 'Save');
$this
->createScreenshot(__FUNCTION__ . '-after-save');
$assert
->waitForField('swagger-ui-field_api_spec-0');
$assert
->pageTextContains('Swagger Petstore');
$assert
->waitForField('swagger-ui-field_api_spec-1');
$assert
->pageTextContains('USPTO Data Set API');
$this
->validateSwaggerUiErrorMessage(__FUNCTION__);
}