silverstripe /
silverstripe-elemental-bannerblock
| 1 | <?php |
||
| 2 | namespace SilverStripe\ElementalBannerBlock\Tests\Behat\Context; |
||
| 3 | |||
| 4 | use Behat\Mink\Element\NodeElement; |
||
|
0 ignored issues
–
show
|
|||
| 5 | use DNADesign\Elemental\Tests\Behat\Context\FeatureContext as BaseFeatureContext; |
||
|
0 ignored issues
–
show
The type
DNADesign\Elemental\Test...\Context\FeatureContext was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 6 | use SilverStripe\BehatExtension\Context\MainContextAwareTrait; |
||
|
0 ignored issues
–
show
The type
SilverStripe\BehatExtens...t\MainContextAwareTrait was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 7 | |||
| 8 | if (!class_exists(BaseFeatureContext::class)) { |
||
| 9 | return; |
||
| 10 | } |
||
| 11 | |||
| 12 | class FeatureContext extends BaseFeatureContext |
||
| 13 | { |
||
| 14 | use MainContextAwareTrait; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @Then /^I should( not |\s+)see the thumbnail image for block (\d+)$/i |
||
| 18 | * |
||
| 19 | * @param string $negative |
||
| 20 | * @param int $position |
||
| 21 | * |
||
| 22 | */ |
||
| 23 | public function iShouldSeeTheThumbnailImageForBlock($negative, $position) |
||
| 24 | { |
||
| 25 | $iShouldNotSee = $negative === ' not '; |
||
| 26 | |||
| 27 | $thumbnailImage = $this->findThumbnailImage($position); |
||
| 28 | |||
| 29 | if ($iShouldNotSee) { |
||
| 30 | assertNull($thumbnailImage, 'Thumbnail image displayed (but shouldn\'t)'); |
||
| 31 | } else { |
||
| 32 | assertNotNull($thumbnailImage, 'Thumbnail image not displayed (but should be)'); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | |||
| 37 | /** |
||
| 38 | * Returns the thumbnail image for a specific block if it exists |
||
| 39 | * |
||
| 40 | * @param int $position |
||
| 41 | * @return NodeElement|null |
||
| 42 | */ |
||
| 43 | protected function findThumbnailImage($position) |
||
| 44 | { |
||
| 45 | $block = $this->getSpecificBlock($position); |
||
| 46 | assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); |
||
| 47 | |||
| 48 | $thumbnail = $block->find( |
||
| 49 | 'css', |
||
| 50 | '.element-editor-content .element-editor-summary .element-editor-summary__thumbnail-image' |
||
| 51 | ); |
||
| 52 | |||
| 53 | return $thumbnail; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @Given /^I press the "([^"]*)" button in the actions? menu for call to action link in block (\d+)$/ |
||
| 58 | */ |
||
| 59 | public function stepIPressTheButtonInTheActionMenuForCallToActionLink($buttonName, $blockNumber) |
||
| 60 | { |
||
| 61 | $block = $this->getSpecificBlock($blockNumber); |
||
| 62 | |||
| 63 | // Check if the popover is open for the block |
||
| 64 | $popover = $block->find('css', '.block-link-field .action-menu__dropdown'); |
||
| 65 | if (!$popover->isVisible()) { |
||
| 66 | $block->find('css', '.block-link-field .action-menu__toggle')->click(); |
||
| 67 | } |
||
| 68 | |||
| 69 | $button = $popover->find('xpath', sprintf('/button[contains(text(), \'%s\')]', $buttonName)); |
||
| 70 | |||
| 71 | assertNotNull($button, sprintf('Could not find button labelled "%s"', $buttonName)); |
||
| 72 | |||
| 73 | $button->click(); |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @Then I should see a modal titled :title |
||
| 78 | * @param string $title |
||
| 79 | */ |
||
| 80 | public function iShouldSeeAModalTitled($title) |
||
| 81 | { |
||
| 82 | $page = $this->getMainContext()->getSession()->getPage(); |
||
| 83 | $modalTitle = $page->find('css', '[role=dialog] .modal-header > .modal-title'); |
||
| 84 | assertNotNull($modalTitle, 'No modal on the page'); |
||
| 85 | assertTrue($modalTitle->getText() == $title); |
||
| 86 | } |
||
| 87 | } |
||
| 88 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths