mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
NEW Assert element attributes
This commit is contained in:
parent
5c4a04864f
commit
5ea2f157b0
@ -545,6 +545,17 @@ JS;
|
||||
$this->iDismissTheDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the "([^"]+)" element "([^"]+)" attribute should be "([^"]*)"$/
|
||||
*/
|
||||
public function theElementAttributeShouldBe($selector, $attribute, $value)
|
||||
{
|
||||
$page = $this->getSession()->getPage();
|
||||
$element = $page->find('css', $selector);
|
||||
Assert::assertNotNull($element, sprintf('Element %s not found', $selector));
|
||||
Assert::assertEquals($value, $element->getAttribute($attribute));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^I see the text "([^"]+)" in the alert$/
|
||||
* @param string $expected
|
||||
|
@ -30,6 +30,7 @@ use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
|
||||
/**
|
||||
* Context used to create fixtures in the SilverStripe ORM.
|
||||
@ -659,7 +660,16 @@ class FixtureContext implements Context
|
||||
|
||||
// Add the extension to the CLI context
|
||||
/** @var Extensible $targetClass */
|
||||
try {
|
||||
$targetClass = $this->convertTypeToClass($class);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
// will end up here if the class is not a subclass of DataObject
|
||||
if (class_exists($class)) {
|
||||
$targetClass = $class;
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
$targetClass::add_extension($extension);
|
||||
|
||||
// Write config for this extension too...
|
||||
|
Loading…
Reference in New Issue
Block a user