You are here

panopoly_test_media.behat.inc in Panopoly 7

Provide Behat step-definitions for the Media module.

@todo Also, add a cleanup function to delete files uploaded.

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test_media.behat.inc
View source
<?php

/**
 * @file
 * Provide Behat step-definitions for the Media module.
 *
 * @todo Also, add a cleanup function to delete files uploaded.
 */
use Drupal\DrupalExtension\Context\DrupalSubContextInterface;
use Drupal\DrupalDriverManager;
use Drupal\DrupalExtension\Context\RawDrupalContext;
class MediaSubContext extends RawDrupalContext implements DrupalSubContextInterface {

  /**
   * Contains the DrupalDriverManager.
   *
   * @var \Drupal\DrupalDriverManager
   */
  private $drupal;

  /**
   * Initializes context.
   */
  public function __construct(DrupalDriverManager $drupal) {
    $this->drupal = $drupal;
  }

  /**
   * @When I click the fake :text button
   */
  public function iClickTheFakeButton($text) {

    // Media style selector "buttons" are A tags with no href, so not findable
    // by normal steps.
    $driver = $this
      ->getSession()
      ->getDriver();
    $buttons = $driver
      ->find("//a[text()='{$text}']");
    $buttons[0]
      ->click();
  }

}

Classes

Namesort descending Description
MediaSubContext