OskarStark / SonataAdminBehatContext

a Behat context for SonataAdmin
MIT License
6 stars 1 forks source link

Works only for fields whose labels do not differ from the name. #41

Open tkd-hgoertz opened 4 years ago

tkd-hgoertz commented 4 years ago

Environment

Version

$ composer show --latest 'oskarstark/sonata-admin-behat-context'
name     : oskarstark/sonata-admin-behat-context
descrip. : a Behat Context for SonataAdmin
keywords : BDD, Behat, Context, Symfony2, sonata, sonata-admin
versions : * 1.14
latest   : 1.14
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source   : [git] https://github.com/OskarStark/SonataAdminBehatContext.git 9c879e8a02229660d3050d91adf9a99272990249
dist     : [zip] https://api.github.com/repos/OskarStark/SonataAdminBehatContext/zipball/9c879e8a02229660d3050d91adf9a99272990249 9c879e8a02229660d3050d91adf9a99272990249
path     : /var/www/vendor/oskarstark/sonata-admin-behat-context
names    : oskarstark/sonata-admin-behat-context

autoload
psr-4
OStark\ => src/

requires
behat/behat ^3.0
behat/mink-extension ^2.3
behat/symfony2-extension ^2.1
php ^7.1
sonata-project/user-bundle ^4.0

requires (dev)
behat/mink-goutte-driver ^1.1
behat/mink-selenium2-driver ^1.3
guzzlehttp/guzzle ^6.3
phpunit/phpunit ^6.0
symfony/browser-kit ^4.3

Symfony packages

$ composer show --latest 'symfony/*'
symfony/asset                      v4.3.3  v4.3.8  Symfony Asset Component
symfony/browser-kit                v4.3.3  v4.3.8  Symfony BrowserKit Component
symfony/cache                      v4.3.3  v4.3.8  Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v1.1.5  v2.0.0  Generic abstractions related to caching
symfony/class-loader               v3.4.30 v3.4.35 Symfony ClassLoader Component
symfony/config                     v4.3.3  v4.3.8  Symfony Config Component
symfony/console                    v4.3.3  v4.3.8  Symfony Console Component
symfony/css-selector               v3.4.30 v4.3.8  Symfony CssSelector Component
symfony/debug                      v4.3.3  v4.3.8  Symfony Debug Component
symfony/debug-bundle               v4.3.3  v4.3.8  Symfony DebugBundle
symfony/debug-pack                 v1.0.7  v1.0.7  A debug pack for Symfony projects
symfony/dependency-injection       v4.3.3  v4.3.8  Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.3.3  v4.3.8  Symfony Doctrine Bridge
symfony/dom-crawler                v4.3.3  v4.3.8  Symfony DomCrawler Component
symfony/dotenv                     v4.3.3  v4.3.8  Registers environment variables from a .env file
symfony/event-dispatcher           v4.3.3  v4.3.8  Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.5  v2.0.0  Generic abstractions related to dispatching event
symfony/expression-language        v4.3.3  v4.3.8  Symfony ExpressionLanguage Component
symfony/filesystem                 v4.3.3  v4.3.8  Symfony Filesystem Component
symfony/finder                     v4.3.3  v4.3.8  Symfony Finder Component
symfony/flex                       v1.4.5  v1.4.8  Composer plugin for Symfony
symfony/form                       v4.3.3  v4.3.8  Symfony Form Component
symfony/framework-bundle           v4.3.3  v4.3.8  Symfony FrameworkBundle
symfony/http-foundation            v4.3.3  v4.3.8  Symfony HttpFoundation Component
symfony/http-kernel                v4.3.3  v4.3.8  Symfony HttpKernel Component
symfony/inflector                  v4.3.3  v4.3.8  Symfony Inflector Component
symfony/intl                       v4.3.3  v4.3.8  A PHP replacement layer for the C intl extension that includes ...
symfony/lock                       v4.3.3  v4.3.8  Symfony Lock Component
symfony/maker-bundle               v1.13.0 v1.14.3 Symfony Maker helps you create empty commands, controllers, for...
symfony/mime                       v4.3.3  v4.3.8  A library to manipulate MIME messages
symfony/monolog-bridge             v4.3.3  v4.3.8  Symfony Monolog Bridge
symfony/monolog-bundle             v3.4.0  v3.5.0  Symfony MonologBundle
symfony/options-resolver           v4.3.3  v4.3.8  Symfony OptionsResolver Component
symfony/orm-pack                   v1.0.6  v1.0.7  A pack for the Doctrine ORM
symfony/phpunit-bridge             v4.3.3  v4.3.8  Symfony PHPUnit Bridge
symfony/polyfill-ctype             v1.12.0 v1.12.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu          v1.12.0 v1.12.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.12.0 v1.12.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring          v1.12.0 v1.12.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 7.2+ features to lower PH...
symfony/polyfill-php73             v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 7.3+ features to lower PH...
symfony/process                    v4.3.3  v4.3.8  Symfony Process Component
symfony/profiler-pack              v1.0.4  v1.0.4  A pack for the Symfony web profiler
symfony/property-access            v4.3.3  v4.3.8  Symfony PropertyAccess Component
symfony/property-info              v4.3.3  v4.3.8  Symfony Property Info Component
symfony/routing                    v4.3.3  v4.3.8  Symfony Routing Component
symfony/security-acl               v3.0.2  v3.0.2  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.3.3  v4.3.8  Symfony SecurityBundle
symfony/security-core              v4.3.3  v4.3.8  Symfony Security Component - Core Library
symfony/security-csrf              v4.3.3  v4.3.8  Symfony Security Component - CSRF Library
symfony/security-guard             v4.3.3  v4.3.8  Symfony Security Component - Guard
symfony/security-http              v4.3.3  v4.3.8  Symfony Security Component - HTTP Integration
symfony/serializer                 v4.3.3  v4.3.8  Symfony Serializer Component
symfony/serializer-pack            v1.0.2  v1.0.2  A pack for the Symfony serializer
symfony/service-contracts          v1.1.5  v2.0.0  Generic abstractions related to writing services
symfony/stopwatch                  v4.3.3  v4.3.8  Symfony Stopwatch Component
symfony/swiftmailer-bundle         v3.2.8  v3.4.0  Symfony SwiftmailerBundle
symfony/templating                 v4.3.3  v4.3.8  Symfony Templating Component
symfony/test-pack                  v1.0.6  v1.0.6  A pack for functional and end-to-end testing within a Symfony app
symfony/translation                v4.3.3  v4.3.8  Symfony Translation Component
symfony/translation-contracts      v1.1.5  v2.0.0  Generic abstractions related to translation
symfony/twig-bridge                v4.3.3  v4.3.8  Symfony Twig Bridge
symfony/twig-bundle                v4.3.3  v4.3.8  Symfony TwigBundle
symfony/validator                  v4.3.3  v4.3.8  Symfony Validator Component
symfony/var-dumper                 v4.3.3  v4.3.8  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v4.3.3  v4.3.8  A blend of var_export() + serialize() to turn any serializable ...
symfony/web-link                   v4.3.3  v4.3.8  Symfony WebLink Component
symfony/web-profiler-bundle        v4.3.3  v4.3.8  Symfony WebProfilerBundle
symfony/webpack-encore-bundle      v1.6.2  v1.7.1  Integration with your Symfony app & Webpack Encore!
symfony/yaml                       v4.3.3  v4.3.8  Symfony Yaml Component

PHP version

$ php -v
PHP 7.3.6 (cli) (built: Jul  3 2019 20:59:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.6, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans

Subject

The Sonata Admin Bundle generates form fields with the entity field name. If you use a custom label which differs from the entity field name then tests like iShoudSeeFilter or iFilterWith and so on doesnt works. You can't use the name instead of custom label for tests, because some of them searches for label others for the entity field name inside attributes from html tags.

Steps to reproduce

OskarStark commented 4 years ago

I could be wrong, but I think I know which project you are on 😄 I think you can use sth like:

Then the row "1" should contain "O: order@foo.de" on column "Order & Claim Email" (use data-name: "orderEmail")

Please search for data-name usage

tkd-hgoertz commented 4 years ago

on Filter and Form Fields there are no data properties. I've no problem to check listview row values after filtering.

when using custom labels I can't fill the corresponding filter input field. sonata generates the element properties with the entity field name. so only the label html contains the custom label.

public function iFilterWith($name, $value) { $this->iShouldSeeTheFilters(); $this->iClickFilters(); $this->iSelectFilter($name); <---- selection via label $this->iShouldSeeFilter($name); <---- selection via name property $this->iClickFilters(); $this->minkContext->fillField($name, $value); $this->iFilterTheList(); }