SilverStripeContext
abstract class SilverStripeContext extends MinkContext implements SilverStripeAwareContext (View source)
SilverStripeContext
Generic context wrapper used as a base for Behat FeatureContext.
The default context for each module should extend this and be named FeatureContext
under the standard module namespace.
Properties
protected | $databaseName | |||
protected | array | $ajaxSteps | ||
protected | int | $ajaxTimeout | ||
protected | string | $adminUrl | ||
protected | string | $loginUrl | ||
protected | string | $screenshotPath | ||
protected | TestSessionEnvironment | $testSessionEnvironment | ||
protected | $regionMap | |||
protected | Escaper | $xpathEscaper | XPath escaper |
Methods
Returns NodeElement based off region defined in .yml file.
Checks whether current URL is close enough to the given URL.
Fills in form field with specified id|name|label|value.
Sets the current date. Relies on the underlying functionality using SS_Datetime::now() rather than PHP's system time methods like date().
Sets the current time. Relies on the underlying functionality using \SS_Datetime::now() rather than PHP's system time methods like date().
Selects option in select field with specified id|name|label|value.
Selects option in select field with specified id|name|label|value using javascript This method uses javascript to allow selection of options that may be overridden by javascript libraries, and thus hide the element.
Details
__construct(array $parameters = null)
Initializes context.
Every scenario gets it's own context object.
Escaper
getXpathEscaper()
Get xpath escaper
setDatabase(string $databaseName)
Sets SilverStripe instance.
setAjaxSteps(array $ajaxSteps)
Marks steps as AJAX steps for special treatment
getAjaxSteps()
No description
setAjaxTimeout(int $ajaxTimeout)
Set timeout in millisceonds
getAjaxTimeout()
No description
setAdminUrl(string $adminUrl)
Set admin url
getAdminUrl()
No description
setLoginUrl(string $loginUrl)
Set login url
getLoginUrl()
No description
setScreenshotPath(string $screenshotPath)
Set path to screenshots dir
getScreenshotPath()
No description
getRegionMap()
No description
setRegionMap($regionMap)
I have no idea
NodeElement
getRegionObj(string $region)
Returns NodeElement based off region defined in .yml file.
Also supports direct CSS selectors and regions identified by a "data-title" attribute. When using the "data-title" attribute, ensure not to include double quotes.
before(BeforeScenarioScope $event)
No description
waitResponsesAfterStep(AfterStepScope $event)
No description
array
getTestSessionState()
Returns a parameter map of state to set within the test session.
Takes TESTSESSION_PARAMS environment variable into account for run-specific configurations.
array|mixed
parseUrl($url)
Parses given URL and returns its components
bool
isCurrentUrlSimilarTo($url)
Checks whether current URL is close enough to the given URL.
Unless specified in $url, get vars will be ignored Unless specified in $url, fragment identifiers will be ignored
string
getBaseUrl()
Returns base URL parameter set in MinkExtension.
It simplifies configuration by allowing to specify this parameter once but makes code dependent on MinkExtension.
string
joinUrlParts($part = null)
Joins URL parts into an URL using forward slash.
Forward slash usages are normalised to one between parts. This method takes variable number of parameters.
canIntercept()
No description
fillField(string $field, string $value)
Fills in form field with specified id|name|label|value.
Overwritten to select the first visible element, see https://github.com/Behat/Mink/issues/311
clickLink(string $link)
Overwritten to click the first visible link the DOM.
givenTheCurrentDateIs(string $date)
Sets the current date. Relies on the underlying functionality using SS_Datetime::now() rather than PHP's system time methods like date().
Supports ISO fomat: Y-m-d Example: Given the current date is "2009-10-31"
givenTheCurrentTimeIs(string $time)
Sets the current time. Relies on the underlying functionality using \SS_Datetime::now() rather than PHP's system time methods like date().
Supports ISO fomat: H:i:s Example: Given the current time is "20:31:50"
selectOption(string $select, string $option)
Selects option in select field with specified id|name|label|value.
selectOptionWithJavascript(string $select, string $option)
Selects option in select field with specified id|name|label|value using javascript This method uses javascript to allow selection of options that may be overridden by javascript libraries, and thus hide the element.