assertDialogClosedAndTextVisible example


  protected function replaceFileInBlock(FileInterface $file) {
    $assert_session = $this->assertSession();
    $page = $this->getSession()->getPage();
    $this->clickContextualLink(static::INLINE_BLOCK_LOCATOR, 'Configure');
    $assert_session->waitForElement('css', "#drupal-off-canvas input[value='Remove']");
    $assert_session->assertWaitOnAjaxRequest();
    $page->find('css', '#drupal-off-canvas')->pressButton('Remove');
    $this->attachFileToBlockForm($file);
    $page->pressButton('Update');
    $this->assertDialogClosedAndTextVisible($file->label()static::INLINE_BLOCK_LOCATOR);
  }

  /** * Adds an entity block with a file. * * @param string $title * The title field value. * @param \Drupal\file\Entity\File $file * The file entity. */
  protected function addInlineFileBlockToLayout($title, File $file) {
    
$page->clickLink('Add block');
    $assert_session->assertWaitOnAjaxRequest();
    $this->assertNotEmpty($assert_session->waitForLink('Create content block'));
    $this->clickLink('Create content block');
    $assert_session->assertWaitOnAjaxRequest();
    $textarea = $assert_session->waitForElement('css', '[name="settings[block_form][body][0][value]"]');
    $this->assertNotEmpty($textarea);
    $assert_session->fieldValueEquals('Title', '');
    $page->findField('Title')->setValue($title);
    $textarea->setValue($body);
    $page->pressButton('Add block');
    $this->assertDialogClosedAndTextVisible($bodystatic::INLINE_BLOCK_LOCATOR);
  }

  /** * Configures an inline block in the Layout Builder. * * @param string $old_body * The old body field value. * @param string $new_body * The new body field value. * @param string $block_css_locator * The CSS locator to use to select the contextual link. */
Home | Imprint | This part of the site doesn't use cookies.