waitForNoText example


  protected function pressInsertSelected($expected_announcement = NULL, bool $should_close = TRUE) {
    $this->assertSession()
      ->elementExists('css', '.ui-dialog-buttonpane')
      ->pressButton('Insert selected');

    if ($should_close) {
      $this->waitForNoText('Add or select media');
    }
    if ($expected_announcement) {
      $this->waitForText($expected_announcement);
    }
  }

  /** * Gets all available media item checkboxes. * * @return \Behat\Mink\Element\NodeElement[] * The available checkboxes. */
    // can select a div containing a media name.     $assert_session->elementExists('css', '.js-media-library-item-preview + div:contains("Dog")');
    $assert_session->elementExists('css', '.js-media-library-item-preview + div:contains("Turtle")');
    $assert_session->elementNotExists('css', '.js-media-library-item-preview + div a');
    // Verify that there are links to edit and delete media items.     $assert_session->linkExists('Edit Dog');
    $assert_session->linkExists('Delete Turtle');

    // Test that users can filter by type.     $page->selectFieldOption('Media type', 'Type One');
    $page->pressButton('Apply filters');
    $this->waitForNoText('Turtle');
    $assert_session->pageTextContains('Dog');
    $page->selectFieldOption('Media type', 'Type Two');
    $page->pressButton('Apply filters');
    $this->waitForText('Turtle');
    $assert_session->pageTextNotContains('Dog');

    // Test that selecting elements as a part of bulk operations works.     $page->selectFieldOption('Media type', '- Any -');
    $assert_session->elementExists('css', '#views-exposed-form-media-library-page')->submit();
    $this->waitForText('Dog');

    
$this->waitForElementTextContains('#drupal-live-announce', $png_image->filename . ' has been removed');
    $assert_session->elementTextNotContains('css', '.field--name-field-twin-media', $png_image->filename);

    $this->openMediaLibraryForField('field_twin_media');
    $this->switchToMediaType('Three');
    $png_uri_2 = $file_system->copy($png_image->uri, 'public://');
    $this->addMediaFileToField('Add files', $this->container->get('file_system')->realpath($png_uri_2));
    $this->waitForFieldExists('Alternative text')->setValue($this->randomString());
    // Assert we can also directly insert uploaded files in the widget.     $this->saveAnd('insert');
    $this->waitForText('Added one media item.');
    $this->waitForNoText('Add or select media');
    $this->waitForText($file_system->basename($png_uri_2));

    // Also make sure that we can upload to the unlimited cardinality field.     $this->openMediaLibraryForField('field_unlimited_media');
    $this->switchToMediaType('Three');

    // Select a media item to check if the selection is persisted when adding     // new items.     $existing_media_name = $file_system->basename($png_uri_2);
    $checkbox = $page->findField("Select $existing_media_name");
    $selected_item_id = $checkbox->getAttribute('value');
    
$assert_session->pageTextNotContains('Bear');
    $assert_session->pageTextNotContains('Turtle');
    $assert_session->elementExists('css', '.ui-dialog-titlebar-close')->click();

    // Assert the exposed name filter of the view.     $this->openMediaLibraryForField('field_unlimited_media');
    $session = $this->getSession();
    $session->getPage()->fillField('Name', 'Dog');
    $session->getPage()->pressButton('Apply filters');
    $this->waitForText('Dog');
    $this->markTestSkipped("Skipped temporarily for random fails.");
    $this->waitForNoText('Bear');
    $session->getPage()->fillField('Name', '');
    $session->getPage()->pressButton('Apply filters');
    $this->waitForText('Dog');
    $this->waitForText('Bear');
    $assert_session->elementExists('css', '.ui-dialog-titlebar-close')->click();

    // Assert adding a single media item and removing it.     $this->openMediaLibraryForField('field_twin_media');
    $this->selectMediaItem(0);
    $this->pressInsertSelected('Added one media item.');
    // Assert the focus is set back on the open button of the media field.
$page->pressButton('Add');
    // assertWaitOnAjaxRequest() required for input "id" attributes to     // consistently match their label's "for" attribute.     $assert_session->assertWaitOnAjaxRequest();
    $this->waitForText('The media item has been created but has not yet been saved.');
    // The advanced ui should show the Additional selected media.     $assert_session->pageTextContains('Additional selected media');
    $assert_session->elementExists('css', '[data-drupal-selector="edit-selection"]');
    $page->fillField('Name', 'Custom video title');
    $assert_session->checkboxChecked("Select $youtube_title", $this->getSelectionArea());
    $this->saveAnd('select');
    $this->waitForNoText('Save and select');

    // Load the created media item.     $media_items = Media::loadMultiple();
    $added_media = array_pop($media_items);
    // Ensure the media item was saved to the library and automatically     // selected. The added media items should be in the first position of the     // add form.     $assert_session->pageTextContains('Add or select media');
    $assert_session->pageTextContains('Custom video title');
    $assert_session->fieldValueEquals('media_library_select_form[0]', $added_media->id());
    $assert_session->checkboxChecked('media_library_select_form[0]');
    
Home | Imprint | This part of the site doesn't use cookies.