. /** * Fbcomments behat custom steps. * * @package block_fbcomments * @copyright 2015 onwards Ankit Agarwal * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../../../lib/behat/behat_base.php'); use Behat\Behat\Context\Step\Given as Given, Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException; /** * Fbcomments behat custom steps. * * @package block_fbcomments * @copyright 2015 onwards Ankit Agarwal * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class behat_block_fbcomments extends behat_base { /** * Helper used to find and switch to behat frame. This is currently not used as facebook doesn't like opening and parsing * this iframe. * * @Given /^I switch to fbcomments iframe$/ * @throws ElementNotFoundException * @return Given[] the steps. */ public function switch_to_fbcomments_iframe() { $iframe = $this->find('css' ,'iframe[title~="Facebook"]'); if (empty($iframe)) { // Iframe not found. throw new ElementNotFoundException($this->getSession(), 'Facebook iframe '); } $name = $iframe->getAttribute('name'); return new Given('I switch to "' . $name . '" iframe'); } }