You are here

public function MediaLibraryContext::assertTypeFilter in Lightning Media 8.3

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

Asserts that the media overview can filter by media type.

@Then I should be able to filter media by type

File

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

Class

MediaLibraryContext
Contains step definitions to interact with the administrative media library.

Namespace

Acquia\LightningExtension\Context

Code

public function assertTypeFilter() {
  $assert = $this
    ->assertSession();

  // Ensure the Type filter exists, then store its value so we can actively
  // assert that the filter works as expected.
  $filter = $assert
    ->fieldExists('Type');
  $original_value = $filter
    ->getValue();
  $filter
    ->selectOption('Tweet');

  /** @var \Acquia\LightningExtension\Context\ViewsContext $context */
  $context = $this
    ->getContext(ViewsContext::class);
  $context
    ->applyExposedFilters();
  $assert
    ->pageTextContains("I'm a tweet");
  $assert
    ->pageTextNotContains("I'm an instagram");

  // Restore the original value.
  $filter
    ->selectOption($original_value);
  $context
    ->applyExposedFilters();
}