waitForElementsCount example

$this->waitForText('Dog has been removed.');
    // Assert the focus is set back on the open button of the media field.     $this->assertJsCondition('jQuery("#field_twin_media-media-library-wrapper .js-media-library-open-button").is(":focus")');

    // Assert we can select the same media item twice.     $this->openMediaLibraryForField('field_twin_media');
    $page->checkField('Select Dog');
    $this->pressInsertSelected('Added one media item.');
    $this->openMediaLibraryForField('field_twin_media');
    $page->checkField('Select Dog');
    $this->pressInsertSelected('Added one media item.');
    $this->waitForElementsCount('css', '.field--name-field-twin-media [data-media-library-item-delta]', 2);
    // Assert that we can toggle the visibility of the weight inputs when the     // field contains more than one item.     $wrapper = $assert_session->elementExists('css', '.field--name-field-twin-media');
    $wrapper->pressButton('Show media item weights');
    // Ensure that the styling doesn't accidentally render the weight field     // unusable.     $assert_session->fieldExists('Weight', $wrapper)->click();
    $wrapper->pressButton('Hide media item weights');

    // Assert the same has been added twice and remove the items again.     $this->waitForElementsCount('css', '.field--name-field-twin-media [data-media-library-item-delta]', 2);
    
$this->drupalLogin($account);
  }

  /** * Tests that the integration with Views works correctly. */
  public function testViewsAdmin() {
    $page = $this->getSession()->getPage();

    // Assert that the widget can be seen and that there are 8 items.     $this->drupalGet('/admin/structure/views/view/media_library/edit/widget');
    $this->waitForElementsCount('css', '.js-media-library-item', 8);

    // Assert that filtering works in live preview.     $page->find('css', '.js-media-library-view')->fillField('name', 'snake');
    $page->find('css', '.js-media-library-view')->pressButton('Apply filters');
    $this->waitForElementsCount('css', '.js-media-library-item', 1);

    // Test the same routine but in the view for the table widget.     $this->drupalGet('/admin/structure/views/view/media_library/edit/widget_table');
    $this->waitForElementsCount('css', '.js-media-library-item', 8);

    // Assert that filtering works in live preview.
Home | Imprint | This part of the site doesn't use cookies.