NEW Assert element attributes

This commit is contained in:
Steve Boyd 2023-09-12 13:03:49 +12:00
parent 5c4a04864f
commit 5ea2f157b0
2 changed files with 22 additions and 1 deletions

View File

@ -545,6 +545,17 @@ JS;
$this->iDismissTheDialog(); $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$/ * @Given /^I see the text "([^"]+)" in the alert$/
* @param string $expected * @param string $expected

View File

@ -30,6 +30,7 @@ use SilverStripe\Security\Group;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\Core\Config\Config;
/** /**
* Context used to create fixtures in the SilverStripe ORM. * Context used to create fixtures in the SilverStripe ORM.
@ -659,7 +660,16 @@ class FixtureContext implements Context
// Add the extension to the CLI context // Add the extension to the CLI context
/** @var Extensible $targetClass */ /** @var Extensible $targetClass */
$targetClass = $this->convertTypeToClass($class); 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); $targetClass::add_extension($extension);
// Write config for this extension too... // Write config for this extension too...