You are here

public function ImageBrowserContext::assertCrop in Lightning Media 8.3

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

Asserts that cropping is enabled for an uploaded image.

@Then I should be able to crop the image

File

tests/contexts/ImageBrowserContext.behat.inc, line 43

Class

ImageBrowserContext
Contains step definitions for interacting with Lightning's image browsers.

Namespace

Acquia\LightningExtension\Context

Code

public function assertCrop() {

  /** @var \Acquia\LightningExtension\Context\ElementContext $context */
  $context = $this
    ->getContext(ElementContext::class);

  // There should always be a collapsible cropping area, but depending on the
  // circumstances, the Freeform crop widget might either be a vertical tab
  // inside that area, or its own cropping area. Try to account for both.
  $crop = $context
    ->assertOpenDetails('Crop image');
  try {
    $context
      ->assertVerticalTab('Freeform', $crop);
  } catch (ElementNotFoundException $e) {
    $context
      ->assertDetails('Freeform');
  }
}