mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Graceful handling of regions which aren't CSS selectors
The dual use of regions (CSS selector and natural language name) causes some difficulties in processing. Since the CSS selector is tried first, we need to ensure the underlying logic doesn't bail on invald selector syntax. See https://github.com/silverstripe-labs/silverstripe-behat-extension/pull/84
This commit is contained in:
parent
b28b179df7
commit
0cdfb2e116
@ -138,6 +138,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
|
||||
*/
|
||||
public function getRegionObj($region) {
|
||||
// Try to find regions directly by CSS selector.
|
||||
try {
|
||||
$regionObj = $this->getSession()->getPage()->find(
|
||||
'css',
|
||||
// Escape CSS selector
|
||||
@ -146,6 +147,9 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
|
||||
if($regionObj) {
|
||||
return $regionObj;
|
||||
}
|
||||
} catch(\Symfony\Component\CssSelector\Exception\SyntaxErrorException $e) {
|
||||
// fall through to next case
|
||||
}
|
||||
|
||||
// Fall back to region identified by data-title.
|
||||
// Only apply if no double quotes exist in search string,
|
||||
|
Loading…
Reference in New Issue
Block a user