function ImageTestTestBase::addImage

Overrides ImageTestBase::addImage

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestTestBase.php, line 127

Class

ImageTestTestBase
@coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image @group ckeditor5 @group #slow @internal

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

protected function addImage() {
    $page = $this->getSession()
        ->getPage();
    $this->assertNotEmpty($image_upload_field = $page->find('css', '.ck-file-dialog-button input[type="file"]'));
    $image = $this->getTestFiles('image')[0];
    $image_upload_field->attachFile($this->container
        ->get('file_system')
        ->realpath($image->uri));
    // Wait for the image to be uploaded and rendered by CKEditor 5.
    $this->assertNotEmpty($this->assertSession()
        ->waitForElementVisible('css', '.ck-widget.image > img[src*="' . $image->filename . '"]'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.