2017 © Pedro Peláez
 

library behat-html-context

A Behat Extension for HTML

image

edmondscommerce/behat-html-context

A Behat Extension for HTML

  • Thursday, July 19, 2018
  • by edmondscommerce
  • Repository
  • 1 Watchers
  • 2 Stars
  • 258 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 13 % Grown

The README.md

Behat HTML Context

By Edmonds Commerce

Codacy Badge, (*1)

A simple Behat Context for working with HTML and navigation, (*2)

Installation

Install via composer, (*3)

"edmondscommerce/behat-html-context": "0.0.1"

Include Context in Behat Configuration

default:
    # ...
    suites:
        default:
            # ...
            contexts:
                - # ...
                - EdmondsCommerce\BehatHtmlContext\HTMLContext
                - EdmondsCommerce\BehatHtmlContext\RedirectionContext

EdmondsCommerce\BehatHtmlContext\RedirectionContext is no longer supported and marked as deprecated., (*4)

Helper Methods

You will need to load the HTML context as part of your own suite of contexts using @BeforeScenario to access the helper methods, (*5)

All helpers accept a custom message to use with the exception, (*6)


// Instantiate context class, $args = [ 'args' => [ '--disable-gpu', '--window-size=1920,1080', '--start-maximised', ], ]; $driver = new Selenium2Driver('chrome', $args); $session = new Behat\Mink\Session($driver); $mink = new Mink(['selenium2' => $session]); $htmlContext = new HTMLContext(); $htmlContext->setMink($mink); //Find a node and return it or throw an exception $htmlContext->findOneOrFail($selector, $locator, $message = null) //Find multiple nodes and return an array of them or throw an exception if none are found $htmlContext->findAllOrFail($selector, $locator, $message = null) //Same as findOrFail but searches from the context of another node, can be useful for chaining $htmlContext->findOrFailFromNode(\Behat\Mink\Element\NodeElement $element, $selector, $locator, $message = null)

Developer dependencies

edmondscommerce/phpqa

Simple PHP QA pipeline and scripts, that helps achieving high quality of code. Click here for more details., (*7)

edmondscommerce/mock-server

PHP Built-in web server. Click here for more details., (*8)

behat/mink-goutte-driver

Goutte driver. Click here for more details., (*9)

behat/mink-selenium2-driver

Selenium2 driver. Click here for more details., (*10)

The Versions