Commit Graph

3 Commits

Author SHA1 Message Date
Daniel Calviño Sánchez a7e1833cf3 Add the timeout in NoSuchElementException messages
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:04 +02:00
Daniel Calviño Sánchez b22997796b Add wrappers to adapt the element finding system of Mink
Mink elements (including the document element) provide a
"find(selector, locator)" method to look for child elements in their web
browser session. The Locator class is added to be able to store the
selector and locator in a single object; it also provides a fluent API
to ease the definition of Mink locators, specially those using the
"named" selector.

The method "find(locator, timeout, timeoutStep)" is added to Actor
objects; it is simply a wrapper over Mink's "find(selector, locator)"
method, although it throws an exception if the element can not be found
instead of returning null, and it also makes possible to automatically
retry to find the element for certain amount of time.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00
Daniel Calviño Sánchez 7c07f01d59 Add actors for test scenarios
An actor plays the role of an end-user in the test scenario. As such,
each actor has its own web browser session used to perform the actions
specified by the steps of the scenario. Only one actor is active at a
time in a test scenario, and the current actor can be set through the "I
act as XXX" step; from then on, all the steps are performed by that
actor, until a different actor is set by calling "I act as XXX" again.
If no actor was explicitly set in a scenario then the default actor,
unsurprisingly named "default", is the one used.

The ActorContext class is added to provide automatic support for all
that. To use the ActorContext, besides adding it to the context list in
"behat.yml", a Mink session for each actor used in the features must be
specified in "behat.yml". Once done other Contexts just need to
implement the ActorAwareInterface (which can be done simply by using the
ActorAware trait) to have access to the current Actor object of the test
scenario; as the Actor object provides its own session other Contexts do
not need to extend from RawMinkContext. The ActorContext is itself a
RawMinkContext, so it automatically receives the base URL of the
Nextcloud test server run by NextcloudTestServerContext and propagates
that base URL to all the actors.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-04-19 08:26:03 +02:00