You are here

public function MediaLibraryContext::assertDelete in Lightning Media 8.2

Same name and namespace in other branches
  1. 8.3 tests/contexts/MediaLibraryContext.behat.inc \Acquia\LightningExtension\Context\MediaLibraryContext::assertDelete()

Asserts that media can be selected and deleted from the media overview.

@Then I should be able to select and delete media

File

tests/contexts/MediaLibraryContext.behat.inc, line 128

Class

MediaLibraryContext

Namespace

Acquia\LightningExtension\Context

Code

public function assertDelete() {
  $assert = $this
    ->assertSession();
  $assert
    ->fieldExists('Action')
    ->selectOption('Delete media');
  $assert
    ->fieldExists('media_bulk_form[0]')
    ->check();
  $assert
    ->fieldExists('media_bulk_form[1]')
    ->check();
  $assert
    ->elementExists('named', [
    'button',
    'Apply to selected items',
  ])
    ->press();
  $assert
    ->elementExists('named', [
    'button',
    'Delete',
  ])
    ->press();
  $assert
    ->pageTextContains('Deleted 2 items.');
  array_walk($this->media, [
    $assert,
    'pageTextNotContains',
  ]);
}